| 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 14270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14281 | 14281 |
| 14282 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { | 14282 RawUnwindError* UnwindError::New(const String& message, Heap::Space space) { |
| 14283 ASSERT(Object::unwind_error_class() != Class::null()); | 14283 ASSERT(Object::unwind_error_class() != Class::null()); |
| 14284 UnwindError& result = UnwindError::Handle(); | 14284 UnwindError& result = UnwindError::Handle(); |
| 14285 { | 14285 { |
| 14286 RawObject* raw = Object::Allocate(UnwindError::kClassId, | 14286 RawObject* raw = Object::Allocate(UnwindError::kClassId, |
| 14287 UnwindError::InstanceSize(), | 14287 UnwindError::InstanceSize(), |
| 14288 space); | 14288 space); |
| 14289 NoSafepointScope no_safepoint; | 14289 NoSafepointScope no_safepoint; |
| 14290 result ^= raw; | 14290 result ^= raw; |
| 14291 result.StoreNonPointer(&result.raw_ptr()->is_user_initiated_, false); | |
| 14292 } | 14291 } |
| 14293 result.set_message(message); | 14292 result.set_message(message); |
| 14293 result.set_is_user_initiated(false); |
| 14294 result.set_is_vm_restart(false); |
| 14294 return result.raw(); | 14295 return result.raw(); |
| 14295 } | 14296 } |
| 14296 | 14297 |
| 14297 | 14298 |
| 14298 void UnwindError::set_message(const String& message) const { | 14299 void UnwindError::set_message(const String& message) const { |
| 14299 StorePointer(&raw_ptr()->message_, message.raw()); | 14300 StorePointer(&raw_ptr()->message_, message.raw()); |
| 14300 } | 14301 } |
| 14301 | 14302 |
| 14302 | 14303 |
| 14303 void UnwindError::set_is_user_initiated(bool value) const { | 14304 void UnwindError::set_is_user_initiated(bool value) const { |
| 14304 StoreNonPointer(&raw_ptr()->is_user_initiated_, value); | 14305 StoreNonPointer(&raw_ptr()->is_user_initiated_, value); |
| 14305 } | 14306 } |
| 14306 | 14307 |
| 14307 | 14308 |
| 14309 void UnwindError::set_is_vm_restart(bool value) const { |
| 14310 StoreNonPointer(&raw_ptr()->is_vm_restart_, value); |
| 14311 } |
| 14312 |
| 14313 |
| 14308 const char* UnwindError::ToErrorCString() const { | 14314 const char* UnwindError::ToErrorCString() const { |
| 14309 const String& msg_str = String::Handle(message()); | 14315 const String& msg_str = String::Handle(message()); |
| 14310 return msg_str.ToCString(); | 14316 return msg_str.ToCString(); |
| 14311 } | 14317 } |
| 14312 | 14318 |
| 14313 | 14319 |
| 14314 const char* UnwindError::ToCString() const { | 14320 const char* UnwindError::ToCString() const { |
| 14315 return "UnwindError"; | 14321 return "UnwindError"; |
| 14316 } | 14322 } |
| 14317 | 14323 |
| 14318 | 14324 |
| 14319 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 14325 void UnwindError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 14320 JSONObject jsobj(stream); | 14326 JSONObject jsobj(stream); |
| 14321 AddCommonObjectProperties(&jsobj, "Error", ref); | 14327 AddCommonObjectProperties(&jsobj, "Error", ref); |
| 14322 jsobj.AddProperty("kind", "TerminationError"); | 14328 jsobj.AddProperty("kind", "TerminationError"); |
| 14323 jsobj.AddServiceId(*this); | 14329 jsobj.AddServiceId(*this); |
| 14324 jsobj.AddProperty("message", ToErrorCString()); | 14330 jsobj.AddProperty("message", ToErrorCString()); |
| 14331 jsobj.AddProperty("_is_user_initiated", is_user_initiated()); |
| 14332 jsobj.AddProperty("_is_vm_restart", is_vm_restart()); |
| 14325 } | 14333 } |
| 14326 | 14334 |
| 14327 | 14335 |
| 14328 RawObject* Instance::Evaluate(const String& expr, | 14336 RawObject* Instance::Evaluate(const String& expr, |
| 14329 const Array& param_names, | 14337 const Array& param_names, |
| 14330 const Array& param_values) const { | 14338 const Array& param_values) const { |
| 14331 const Class& cls = Class::Handle(clazz()); | 14339 const Class& cls = Class::Handle(clazz()); |
| 14332 const Function& eval_func = | 14340 const Function& eval_func = |
| 14333 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); | 14341 Function::Handle(EvaluateHelper(cls, expr, param_names, false)); |
| 14334 const Array& args = Array::Handle(Array::New(1 + param_values.Length())); | 14342 const Array& args = Array::Handle(Array::New(1 + param_values.Length())); |
| (...skipping 7147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21482 return tag_label.ToCString(); | 21490 return tag_label.ToCString(); |
| 21483 } | 21491 } |
| 21484 | 21492 |
| 21485 | 21493 |
| 21486 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21494 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21487 Instance::PrintJSONImpl(stream, ref); | 21495 Instance::PrintJSONImpl(stream, ref); |
| 21488 } | 21496 } |
| 21489 | 21497 |
| 21490 | 21498 |
| 21491 } // namespace dart | 21499 } // namespace dart |
| OLD | NEW |