| 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 13308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13319 | 13319 |
| 13320 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13320 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13321 JSONObject jsobj(stream); | 13321 JSONObject jsobj(stream); |
| 13322 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13322 AddTypeProperties(&jsobj, "Error", JSONType(), ref); |
| 13323 jsobj.AddProperty("id", ""); | 13323 jsobj.AddProperty("id", ""); |
| 13324 jsobj.AddProperty("message", ToErrorCString()); | 13324 jsobj.AddProperty("message", ToErrorCString()); |
| 13325 } | 13325 } |
| 13326 | 13326 |
| 13327 | 13327 |
| 13328 RawUnhandledException* UnhandledException::New(const Instance& exception, | 13328 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 13329 const Stacktrace& stacktrace, | 13329 const Instance& stacktrace, |
| 13330 Heap::Space space) { | 13330 Heap::Space space) { |
| 13331 ASSERT(Object::unhandled_exception_class() != Class::null()); | 13331 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 13332 UnhandledException& result = UnhandledException::Handle(); | 13332 UnhandledException& result = UnhandledException::Handle(); |
| 13333 { | 13333 { |
| 13334 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 13334 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| 13335 UnhandledException::InstanceSize(), | 13335 UnhandledException::InstanceSize(), |
| 13336 space); | 13336 space); |
| 13337 NoGCScope no_gc; | 13337 NoGCScope no_gc; |
| 13338 result ^= raw; | 13338 result ^= raw; |
| 13339 } | 13339 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 13357 result.set_stacktrace(Stacktrace::Handle()); | 13357 result.set_stacktrace(Stacktrace::Handle()); |
| 13358 return result.raw(); | 13358 return result.raw(); |
| 13359 } | 13359 } |
| 13360 | 13360 |
| 13361 | 13361 |
| 13362 void UnhandledException::set_exception(const Instance& exception) const { | 13362 void UnhandledException::set_exception(const Instance& exception) const { |
| 13363 StorePointer(&raw_ptr()->exception_, exception.raw()); | 13363 StorePointer(&raw_ptr()->exception_, exception.raw()); |
| 13364 } | 13364 } |
| 13365 | 13365 |
| 13366 | 13366 |
| 13367 void UnhandledException::set_stacktrace(const Stacktrace& stacktrace) const { | 13367 void UnhandledException::set_stacktrace(const Instance& stacktrace) const { |
| 13368 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); | 13368 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); |
| 13369 } | 13369 } |
| 13370 | 13370 |
| 13371 | 13371 |
| 13372 const char* UnhandledException::ToErrorCString() const { | 13372 const char* UnhandledException::ToErrorCString() const { |
| 13373 Isolate* isolate = Isolate::Current(); | 13373 Isolate* isolate = Isolate::Current(); |
| 13374 if (exception() == isolate->object_store()->out_of_memory()) { | 13374 if (exception() == isolate->object_store()->out_of_memory()) { |
| 13375 return "Unhandled exception:\nOut of memory"; | 13375 return "Unhandled exception:\nOut of memory"; |
| 13376 } | 13376 } |
| 13377 if (exception() == isolate->object_store()->stack_overflow()) { | 13377 if (exception() == isolate->object_store()->stack_overflow()) { |
| (...skipping 7237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20615 return tag_label.ToCString(); | 20615 return tag_label.ToCString(); |
| 20616 } | 20616 } |
| 20617 | 20617 |
| 20618 | 20618 |
| 20619 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20619 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20620 Instance::PrintJSONImpl(stream, ref); | 20620 Instance::PrintJSONImpl(stream, ref); |
| 20621 } | 20621 } |
| 20622 | 20622 |
| 20623 | 20623 |
| 20624 } // namespace dart | 20624 } // namespace dart |
| OLD | NEW |