| 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 13192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13203 | 13203 |
| 13204 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { | 13204 void LanguageError::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 13205 JSONObject jsobj(stream); | 13205 JSONObject jsobj(stream); |
| 13206 AddTypeProperties(&jsobj, "Error", JSONType(), ref); | 13206 AddTypeProperties(&jsobj, "Error", JSONType(), ref); |
| 13207 jsobj.AddProperty("id", ""); | 13207 jsobj.AddProperty("id", ""); |
| 13208 jsobj.AddProperty("message", ToErrorCString()); | 13208 jsobj.AddProperty("message", ToErrorCString()); |
| 13209 } | 13209 } |
| 13210 | 13210 |
| 13211 | 13211 |
| 13212 RawUnhandledException* UnhandledException::New(const Instance& exception, | 13212 RawUnhandledException* UnhandledException::New(const Instance& exception, |
| 13213 const Instance& stacktrace, | 13213 const Stacktrace& stacktrace, |
| 13214 Heap::Space space) { | 13214 Heap::Space space) { |
| 13215 ASSERT(Object::unhandled_exception_class() != Class::null()); | 13215 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 13216 UnhandledException& result = UnhandledException::Handle(); | 13216 UnhandledException& result = UnhandledException::Handle(); |
| 13217 { | 13217 { |
| 13218 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 13218 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| 13219 UnhandledException::InstanceSize(), | 13219 UnhandledException::InstanceSize(), |
| 13220 space); | 13220 space); |
| 13221 NoGCScope no_gc; | 13221 NoGCScope no_gc; |
| 13222 result ^= raw; | 13222 result ^= raw; |
| 13223 } | 13223 } |
| 13224 result.set_exception(exception); | 13224 result.set_exception(exception); |
| 13225 result.set_stacktrace(stacktrace); | 13225 result.set_stacktrace(stacktrace); |
| 13226 return result.raw(); | 13226 return result.raw(); |
| 13227 } | 13227 } |
| 13228 | 13228 |
| 13229 | 13229 |
| 13230 RawUnhandledException* UnhandledException::New(Heap::Space space) { | 13230 RawUnhandledException* UnhandledException::New(Heap::Space space) { |
| 13231 ASSERT(Object::unhandled_exception_class() != Class::null()); | 13231 ASSERT(Object::unhandled_exception_class() != Class::null()); |
| 13232 UnhandledException& result = UnhandledException::Handle(); | 13232 UnhandledException& result = UnhandledException::Handle(); |
| 13233 { | 13233 { |
| 13234 RawObject* raw = Object::Allocate(UnhandledException::kClassId, | 13234 RawObject* raw = Object::Allocate(UnhandledException::kClassId, |
| 13235 UnhandledException::InstanceSize(), | 13235 UnhandledException::InstanceSize(), |
| 13236 space); | 13236 space); |
| 13237 NoGCScope no_gc; | 13237 NoGCScope no_gc; |
| 13238 result ^= raw; | 13238 result ^= raw; |
| 13239 } | 13239 } |
| 13240 result.set_exception(Object::null_instance()); | 13240 result.set_exception(Object::null_instance()); |
| 13241 result.set_stacktrace(Object::null_instance()); | 13241 result.set_stacktrace(Stacktrace::Handle()); |
| 13242 return result.raw(); | 13242 return result.raw(); |
| 13243 } | 13243 } |
| 13244 | 13244 |
| 13245 | 13245 |
| 13246 void UnhandledException::set_exception(const Instance& exception) const { | 13246 void UnhandledException::set_exception(const Instance& exception) const { |
| 13247 StorePointer(&raw_ptr()->exception_, exception.raw()); | 13247 StorePointer(&raw_ptr()->exception_, exception.raw()); |
| 13248 } | 13248 } |
| 13249 | 13249 |
| 13250 | 13250 |
| 13251 void UnhandledException::set_stacktrace(const Instance& stacktrace) const { | 13251 void UnhandledException::set_stacktrace(const Stacktrace& stacktrace) const { |
| 13252 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); | 13252 StorePointer(&raw_ptr()->stacktrace_, stacktrace.raw()); |
| 13253 } | 13253 } |
| 13254 | 13254 |
| 13255 | 13255 |
| 13256 const char* UnhandledException::ToErrorCString() const { | 13256 const char* UnhandledException::ToErrorCString() const { |
| 13257 Isolate* isolate = Isolate::Current(); | 13257 Isolate* isolate = Isolate::Current(); |
| 13258 if (exception() == isolate->object_store()->out_of_memory()) { | 13258 if (exception() == isolate->object_store()->out_of_memory()) { |
| 13259 return "Unhandled exception:\nOut of memory"; | 13259 return "Unhandled exception:\nOut of memory"; |
| 13260 } | 13260 } |
| 13261 if (exception() == isolate->object_store()->stack_overflow()) { | 13261 if (exception() == isolate->object_store()->stack_overflow()) { |
| (...skipping 7304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20566 return tag_label.ToCString(); | 20566 return tag_label.ToCString(); |
| 20567 } | 20567 } |
| 20568 | 20568 |
| 20569 | 20569 |
| 20570 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20570 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20571 Instance::PrintJSONImpl(stream, ref); | 20571 Instance::PrintJSONImpl(stream, ref); |
| 20572 } | 20572 } |
| 20573 | 20573 |
| 20574 | 20574 |
| 20575 } // namespace dart | 20575 } // namespace dart |
| OLD | NEW |