OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 14297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14308 | 14308 |
14309 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 14309 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
14310 ASSERT(Object::unwind_error_class() != Class::null()); | 14310 ASSERT(Object::unwind_error_class() != Class::null()); |
14311 UnwindError& result = UnwindError::Handle(); | 14311 UnwindError& result = UnwindError::Handle(); |
14312 { | 14312 { |
14313 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 14313 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
14314 UnwindError::InstanceSize(), | 14314 UnwindError::InstanceSize(), |
14315 space); | 14315 space); |
14316 NoSafepointScope no_safepoint; | 14316 NoSafepointScope no_safepoint; |
14317 result ^= raw; | 14317 result ^= raw; |
14318 result.StoreNonPointer(&result.raw_ptr()->is_user_initiated_, false); | |
14319 } | 14318 } |
14320 result.set_message(message); | 14319 result.set_message(message); |
| 14320 result.set_is_user_initiated(false); |
| 14321 result.set_is_vm_restart(false); |
14321 return result.raw(); | 14322 return result.raw(); |
14322 } | 14323 } |
14323 | 14324 |
14324 | 14325 |
14325 void UnwindError::set_message(const String& message) const { | 14326 void UnwindError::set_message(const String& message) const { |
14326 StorePointer(&raw_ptr()->message_, message.raw()); | 14327 StorePointer(&raw_ptr()->message_, message.raw()); |
14327 } | 14328 } |
14328 | 14329 |
14329 | 14330 |
14330 void UnwindError::set_is_user_initiated(bool value) const { | 14331 void UnwindError::set_is_user_initiated(bool value) const { |
14331 StoreNonPointer(&raw_ptr()->is_user_initiated_, value); | 14332 StoreNonPointer(&raw_ptr()->is_user_initiated_, value); |
14332 } | 14333 } |
14333 | 14334 |
14334 | 14335 |
| 14336 void UnwindError::set_is_vm_restart(bool value) const { |
| 14337 StoreNonPointer(&raw_ptr()->is_vm_restart_, value); |
| 14338 } |
| 14339 |
| 14340 |
14335 const char* UnwindError::ToErrorCString() const { | 14341 const char* UnwindError::ToErrorCString() const { |
14336 const String& msg_str = String::Handle(message()); | 14342 const String& msg_str = String::Handle(message()); |
14337 return msg_str.ToCString(); | 14343 return msg_str.ToCString(); |
14338 } | 14344 } |
14339 | 14345 |
14340 | 14346 |
14341 const char* UnwindError::ToCString() const { | 14347 const char* UnwindError::ToCString() const { |
14342 return "UnwindError"; | 14348 return "UnwindError"; |
14343 } | 14349 } |
14344 | 14350 |
14345 | 14351 |
14346 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 14352 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
14347 JSONObject jsobj(stream); | 14353 JSONObject jsobj(stream); |
14348 AddCommonObjectProperties(&jsobj, "Error", ref); | 14354 AddCommonObjectProperties(&jsobj, "Error", ref); |
14349 jsobj.AddProperty("kind", "TerminationError"); | 14355 jsobj.AddProperty("kind", "TerminationError"); |
14350 jsobj.AddServiceId(*this); | 14356 jsobj.AddServiceId(*this); |
14351 jsobj.AddProperty("message", ToErrorCString()); | 14357 jsobj.AddProperty("message", ToErrorCString()); |
| 14358 jsobj.AddProperty("_is_user_initiated", is_user_initiated()); |
| 14359 jsobj.AddProperty("_is_vm_restart", is_vm_restart()); |
14352 } | 14360 } |
14353 | 14361 |
14354 | 14362 |
14355 RawObject* Instance::Evaluate(const String& expr, | 14363 RawObject* Instance::Evaluate(const String& expr, |
14356 const Array& param_names, | 14364 const Array& param_names, |
14357 const Array& param_values) const { | 14365 const Array& param_values) const { |
14358 const Class& cls = Class::Handle(clazz()); | 14366 const Class& cls = Class::Handle(clazz()); |
14359 const Function& eval_func = | 14367 const Function& eval_func = |
14360 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); | 14368 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); |
14361 const Array& args = Array::Handle(Array::New(1 + param_values.Length())); | 14369 const Array& args = Array::Handle(Array::New(1 + param_values.Length())); |
(...skipping 7166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21528 return tag_label.ToCString(); | 21536 return tag_label.ToCString(); |
21529 } | 21537 } |
21530 | 21538 |
21531 | 21539 |
21532 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21540 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21533 Instance::PrintJSONImpl(stream, ref); | 21541 Instance::PrintJSONImpl(stream, ref); |
21534 } | 21542 } |
21535 | 21543 |
21536 | 21544 |
21537 } // namespace dart | 21545 } // namespace dart |
OLD | NEW |