| 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/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 set_stack_overflow(Instance::Cast(result)); | 125 set_stack_overflow(Instance::Cast(result)); |
| 126 | 126 |
| 127 result = DartLibraryCalls::InstanceCreate(library, | 127 result = DartLibraryCalls::InstanceCreate(library, |
| 128 Symbols::OutOfMemoryError(), | 128 Symbols::OutOfMemoryError(), |
| 129 Symbols::Dot(), | 129 Symbols::Dot(), |
| 130 Object::empty_array()); | 130 Object::empty_array()); |
| 131 if (result.IsError()) { | 131 if (result.IsError()) { |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 set_out_of_memory(Instance::Cast(result)); | 134 set_out_of_memory(Instance::Cast(result)); |
| 135 |
| 136 // Allocate pre-allocated unhandled exception object initialized with the |
| 137 // pre-allocated OutOfMemoryError. |
| 138 const UnhandledException& unhandled_exception = UnhandledException::Handle( |
| 139 UnhandledException::New(Instance::Cast(result), Object::null_instance())); |
| 140 set_preallocated_unhandled_exception(unhandled_exception); |
| 141 |
| 135 const Array& code_array = Array::Handle( | 142 const Array& code_array = Array::Handle( |
| 136 isolate, | 143 isolate, |
| 137 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 144 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
| 138 const Array& pc_offset_array = Array::Handle( | 145 const Array& pc_offset_array = Array::Handle( |
| 139 isolate, | 146 isolate, |
| 140 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); | 147 Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld)); |
| 141 const Stacktrace& stack_trace = | 148 const Stacktrace& stack_trace = |
| 142 Stacktrace::Handle(Stacktrace::New(code_array, pc_offset_array)); | 149 Stacktrace::Handle(Stacktrace::New(code_array, pc_offset_array)); |
| 143 // Expansion of inlined functions requires additional memory at run time, | 150 // Expansion of inlined functions requires additional memory at run time, |
| 144 // avoid it. | 151 // avoid it. |
| 145 stack_trace.set_expand_inlined(false); | 152 stack_trace.set_expand_inlined(false); |
| 146 set_preallocated_stack_trace(stack_trace); | 153 set_preallocated_stack_trace(stack_trace); |
| 147 | 154 |
| 148 return true; | 155 return true; |
| 149 } | 156 } |
| 150 | 157 |
| 151 } // namespace dart | 158 } // namespace dart |
| OLD | NEW |