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