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