OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_store.h" | 5 #include "vm/object_store.h" |
6 | 6 |
7 #include "vm/exceptions.h" | 7 #include "vm/exceptions.h" |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 canonical_type_arguments_(Array::null()), | 46 canonical_type_arguments_(Array::null()), |
47 core_library_(Library::null()), | 47 core_library_(Library::null()), |
48 core_impl_library_(Library::null()), | 48 core_impl_library_(Library::null()), |
49 native_wrappers_library_(Library::null()), | 49 native_wrappers_library_(Library::null()), |
50 root_library_(Library::null()), | 50 root_library_(Library::null()), |
51 registered_libraries_(Library::null()), | 51 registered_libraries_(Library::null()), |
52 pending_classes_(Array::null()), | 52 pending_classes_(Array::null()), |
53 sticky_error_(String::null()), | 53 sticky_error_(String::null()), |
54 empty_context_(Context::null()), | 54 empty_context_(Context::null()), |
55 stack_overflow_(Instance::null()), | 55 stack_overflow_(Instance::null()), |
| 56 out_of_memory_(Instance::null()), |
56 preallocate_objects_called_(false) { | 57 preallocate_objects_called_(false) { |
57 } | 58 } |
58 | 59 |
59 | 60 |
60 ObjectStore::~ObjectStore() { | 61 ObjectStore::~ObjectStore() { |
61 } | 62 } |
62 | 63 |
63 | 64 |
64 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 65 void ObjectStore::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
65 ASSERT(visitor != NULL); | 66 ASSERT(visitor != NULL); |
(...skipping 13 matching lines...) Expand all Loading... |
79 return true; | 80 return true; |
80 } | 81 } |
81 | 82 |
82 Isolate* isolate = Isolate::Current(); | 83 Isolate* isolate = Isolate::Current(); |
83 ASSERT(isolate != NULL && isolate->object_store() == this); | 84 ASSERT(isolate != NULL && isolate->object_store() == this); |
84 LongJump* base = isolate->long_jump_base(); | 85 LongJump* base = isolate->long_jump_base(); |
85 LongJump jump; | 86 LongJump jump; |
86 isolate->set_long_jump_base(&jump); | 87 isolate->set_long_jump_base(&jump); |
87 if (setjmp(*jump.Set()) == 0) { | 88 if (setjmp(*jump.Set()) == 0) { |
88 GrowableArray<const Object*> args; | 89 GrowableArray<const Object*> args; |
89 const Instance& exception = | 90 Instance& exception =Instance::Handle(); |
90 Instance::Handle(Exceptions::Create(Exceptions::kStackOverflow, args)); | 91 exception = Exceptions::Create(Exceptions::kStackOverflow, args); |
91 set_stack_overflow(exception); | 92 set_stack_overflow(exception); |
| 93 exception = Exceptions::Create(Exceptions::kOutOfMemory, args); |
| 94 set_out_of_memory(exception); |
92 } else { | 95 } else { |
93 return false; | 96 return false; |
94 } | 97 } |
95 isolate->set_long_jump_base(base); | 98 isolate->set_long_jump_base(base); |
96 preallocate_objects_called_ = true; | 99 preallocate_objects_called_ = true; |
97 return true; | 100 return true; |
98 } | 101 } |
99 | 102 |
100 | 103 |
101 RawClass* ObjectStore::GetClass(int index) { | 104 RawClass* ObjectStore::GetClass(int index) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return kBoolInterface; | 213 return kBoolInterface; |
211 } else if (raw_type == string_interface()) { | 214 } else if (raw_type == string_interface()) { |
212 return kStringInterface; | 215 return kStringInterface; |
213 } else if (raw_type == list_interface()) { | 216 } else if (raw_type == list_interface()) { |
214 return kListInterface; | 217 return kListInterface; |
215 } | 218 } |
216 return kInvalidIndex; | 219 return kInvalidIndex; |
217 } | 220 } |
218 | 221 |
219 } // namespace dart | 222 } // namespace dart |
OLD | NEW |