| 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_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/object.h" | 9 #include "vm/object.h" |
| 10 #include "vm/raw_object.h" | 10 #include "vm/raw_object.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 bool ObjectStore::PreallocateObjects() { | 108 bool ObjectStore::PreallocateObjects() { |
| 109 Isolate* isolate = Isolate::Current(); | 109 Isolate* isolate = Isolate::Current(); |
| 110 ASSERT(isolate != NULL && isolate->object_store() == this); | 110 ASSERT(isolate != NULL && isolate->object_store() == this); |
| 111 if (this->stack_overflow() != Instance::null() && | 111 if (this->stack_overflow() != Instance::null() && |
| 112 this->out_of_memory() != Instance::null()) { | 112 this->out_of_memory() != Instance::null()) { |
| 113 return true; | 113 return true; |
| 114 } | 114 } |
| 115 ASSERT(this->stack_overflow() == Instance::null()); | 115 ASSERT(this->stack_overflow() == Instance::null()); |
| 116 ASSERT(this->out_of_memory() == Instance::null()); | 116 ASSERT(this->out_of_memory() == Instance::null()); |
| 117 GrowableArray<const Object*> args; | 117 const Array& args = Array::Handle(Object::empty_array()); |
| 118 Object& result = Object::Handle(); | 118 Object& result = Object::Handle(); |
| 119 | 119 |
| 120 result = Exceptions::Create(Exceptions::kStackOverflow, args); | 120 result = Exceptions::Create(Exceptions::kStackOverflow, args); |
| 121 if (result.IsError()) { | 121 if (result.IsError()) { |
| 122 return false; | 122 return false; |
| 123 } | 123 } |
| 124 set_stack_overflow(Instance::Cast(result)); | 124 set_stack_overflow(Instance::Cast(result)); |
| 125 | 125 |
| 126 result = Exceptions::Create(Exceptions::kOutOfMemory, args); | 126 result = Exceptions::Create(Exceptions::kOutOfMemory, args); |
| 127 if (result.IsError()) { | 127 if (result.IsError()) { |
| 128 return false; | 128 return false; |
| 129 } | 129 } |
| 130 set_out_of_memory(Instance::Cast(result)); | 130 set_out_of_memory(Instance::Cast(result)); |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 | 134 |
| 135 void ObjectStore::InitKeywordTable() { | 135 void ObjectStore::InitKeywordTable() { |
| 136 // Set up the keywords symbol array so that we can access it while scanning. | 136 // Set up the keywords symbol array so that we can access it while scanning. |
| 137 Array& keywords = Array::Handle(keyword_symbols()); | 137 Array& keywords = Array::Handle(keyword_symbols()); |
| 138 ASSERT(keywords.IsNull()); | 138 ASSERT(keywords.IsNull()); |
| 139 keywords = Array::New(Token::numKeywords, Heap::kOld); | 139 keywords = Array::New(Token::numKeywords, Heap::kOld); |
| 140 ASSERT(!keywords.IsError() && !keywords.IsNull()); | 140 ASSERT(!keywords.IsError() && !keywords.IsNull()); |
| 141 set_keyword_symbols(keywords); | 141 set_keyword_symbols(keywords); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace dart | 144 } // namespace dart |
| OLD | NEW |