OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Isolate* isolate = Isolate::Current(); | 97 Isolate* isolate = Isolate::Current(); |
98 ASSERT(isolate != NULL && isolate->object_store() == this); | 98 ASSERT(isolate != NULL && isolate->object_store() == this); |
99 if (this->stack_overflow() != Instance::null()) { | 99 if (this->stack_overflow() != Instance::null()) { |
100 ASSERT(this->out_of_memory() != Instance::null()); | 100 ASSERT(this->out_of_memory() != Instance::null()); |
101 ASSERT(this->preallocated_stack_trace() != Stacktrace::null()); | 101 ASSERT(this->preallocated_stack_trace() != Stacktrace::null()); |
102 return true; | 102 return true; |
103 } | 103 } |
104 ASSERT(this->stack_overflow() == Instance::null()); | 104 ASSERT(this->stack_overflow() == Instance::null()); |
105 ASSERT(this->out_of_memory() == Instance::null()); | 105 ASSERT(this->out_of_memory() == Instance::null()); |
106 ASSERT(this->preallocated_stack_trace() == Stacktrace::null()); | 106 ASSERT(this->preallocated_stack_trace() == Stacktrace::null()); |
107 // TODO(regis): Reenable this code for mips when possible. | 107 |
108 #if defined(TARGET_ARCH_IA32) || \ | |
109 defined(TARGET_ARCH_X64) || \ | |
110 defined(TARGET_ARCH_ARM) | |
111 Object& result = Object::Handle(); | 108 Object& result = Object::Handle(); |
112 | 109 |
113 result = Exceptions::Create(Exceptions::kStackOverflow, | 110 result = Exceptions::Create(Exceptions::kStackOverflow, |
114 Object::empty_array()); | 111 Object::empty_array()); |
115 if (result.IsError()) { | 112 if (result.IsError()) { |
116 return false; | 113 return false; |
117 } | 114 } |
118 set_stack_overflow(Instance::Cast(result)); | 115 set_stack_overflow(Instance::Cast(result)); |
119 | 116 |
120 result = Exceptions::Create(Exceptions::kOutOfMemory, Object::empty_array()); | 117 result = Exceptions::Create(Exceptions::kOutOfMemory, Object::empty_array()); |
121 if (result.IsError()) { | 118 if (result.IsError()) { |
122 return false; | 119 return false; |
123 } | 120 } |
124 set_out_of_memory(Instance::Cast(result)); | 121 set_out_of_memory(Instance::Cast(result)); |
125 const Array& func_array = Array::Handle( | 122 const Array& func_array = Array::Handle( |
126 isolate, | 123 isolate, |
127 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 124 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
128 const Array& code_array = Array::Handle( | 125 const Array& code_array = Array::Handle( |
129 isolate, | 126 isolate, |
130 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 127 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
131 const Array& pc_offset_array = Array::Handle( | 128 const Array& pc_offset_array = Array::Handle( |
132 isolate, | 129 isolate, |
133 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 130 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
134 result = Stacktrace::New(func_array, code_array, pc_offset_array); | 131 result = Stacktrace::New(func_array, code_array, pc_offset_array); |
135 set_preallocated_stack_trace(Stacktrace::Cast(result)); | 132 set_preallocated_stack_trace(Stacktrace::Cast(result)); |
136 #endif | 133 |
137 return true; | 134 return true; |
138 } | 135 } |
139 | 136 |
140 | 137 |
141 void ObjectStore::InitKeywordTable() { | 138 void ObjectStore::InitKeywordTable() { |
142 // 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. |
143 Array& keywords = Array::Handle(keyword_symbols()); | 140 Array& keywords = Array::Handle(keyword_symbols()); |
144 ASSERT(keywords.IsNull()); | 141 ASSERT(keywords.IsNull()); |
145 keywords = Array::New(Token::numKeywords, Heap::kOld); | 142 keywords = Array::New(Token::numKeywords, Heap::kOld); |
146 ASSERT(!keywords.IsError() && !keywords.IsNull()); | 143 ASSERT(!keywords.IsError() && !keywords.IsNull()); |
147 set_keyword_symbols(keywords); | 144 set_keyword_symbols(keywords); |
148 } | 145 } |
149 | 146 |
150 } // namespace dart | 147 } // namespace dart |
OLD | NEW |