| 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.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 8266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8277 } | 8277 } |
| 8278 | 8278 |
| 8279 | 8279 |
| 8280 intptr_t ExceptionHandlers::Length() const { | 8280 intptr_t ExceptionHandlers::Length() const { |
| 8281 return raw_ptr()->length_; | 8281 return raw_ptr()->length_; |
| 8282 } | 8282 } |
| 8283 | 8283 |
| 8284 | 8284 |
| 8285 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, | 8285 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, |
| 8286 intptr_t outer_try_index, | 8286 intptr_t outer_try_index, |
| 8287 intptr_t handler_pc) const { | 8287 intptr_t handler_pc, |
| 8288 bool needs_stacktrace) const { |
| 8288 ASSERT((try_index >= 0) && (try_index < Length())); | 8289 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8289 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index]; | 8290 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index]; |
| 8290 info->outer_try_index = outer_try_index; | 8291 info->outer_try_index = outer_try_index; |
| 8291 info->handler_pc = handler_pc; | 8292 info->handler_pc = handler_pc; |
| 8293 info->needs_stacktrace = needs_stacktrace; |
| 8292 } | 8294 } |
| 8293 | 8295 |
| 8294 void ExceptionHandlers::GetHandlerInfo( | 8296 void ExceptionHandlers::GetHandlerInfo( |
| 8295 intptr_t try_index, | 8297 intptr_t try_index, |
| 8296 RawExceptionHandlers::HandlerInfo* info) const { | 8298 RawExceptionHandlers::HandlerInfo* info) const { |
| 8297 ASSERT((try_index >= 0) && (try_index < Length())); | 8299 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8298 ASSERT(info != NULL); | 8300 ASSERT(info != NULL); |
| 8299 RawExceptionHandlers::HandlerInfo* data = &raw_ptr()->data_[try_index]; | 8301 RawExceptionHandlers::HandlerInfo* data = &raw_ptr()->data_[try_index]; |
| 8300 info->outer_try_index = data->outer_try_index; | 8302 info->outer_try_index = data->outer_try_index; |
| 8301 info->handler_pc = data->handler_pc; | 8303 info->handler_pc = data->handler_pc; |
| 8302 } | 8304 } |
| 8303 | 8305 |
| 8304 | 8306 |
| 8305 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const { | 8307 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const { |
| 8306 ASSERT((try_index >= 0) && (try_index < Length())); | 8308 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8307 return raw_ptr()->data_[try_index].handler_pc; | 8309 return raw_ptr()->data_[try_index].handler_pc; |
| 8308 } | 8310 } |
| 8309 | 8311 |
| 8310 | 8312 |
| 8311 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { | 8313 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { |
| 8312 ASSERT((try_index >= 0) && (try_index < Length())); | 8314 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8313 return raw_ptr()->data_[try_index].outer_try_index; | 8315 return raw_ptr()->data_[try_index].outer_try_index; |
| 8314 } | 8316 } |
| 8315 | 8317 |
| 8316 | 8318 |
| 8319 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const { |
| 8320 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8321 return raw_ptr()->data_[try_index].needs_stacktrace; |
| 8322 } |
| 8323 |
| 8324 |
| 8317 void ExceptionHandlers::SetHandledTypes(intptr_t try_index, | 8325 void ExceptionHandlers::SetHandledTypes(intptr_t try_index, |
| 8318 const Array& handled_types) const { | 8326 const Array& handled_types) const { |
| 8319 ASSERT((try_index >= 0) && (try_index < Length())); | 8327 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8320 const Array& handled_types_data = | 8328 const Array& handled_types_data = |
| 8321 Array::Handle(raw_ptr()->handled_types_data_); | 8329 Array::Handle(raw_ptr()->handled_types_data_); |
| 8322 handled_types_data.SetAt(try_index, handled_types); | 8330 handled_types_data.SetAt(try_index, handled_types); |
| 8323 } | 8331 } |
| 8324 | 8332 |
| 8325 | 8333 |
| 8326 RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const { | 8334 RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const { |
| 8327 ASSERT((try_index >= 0) && (try_index < Length())); | 8335 ASSERT((try_index >= 0) && (try_index < Length())); |
| 8328 Array& array = Array::Handle(raw_ptr()->handled_types_data_); | 8336 Array& array = Array::Handle(raw_ptr()->handled_types_data_); |
| 8329 array ^= array.At(try_index); | 8337 array ^= array.At(try_index); |
| 8330 return array.raw(); | 8338 return array.raw(); |
| 8331 } | 8339 } |
| 8332 | 8340 |
| 8333 | 8341 |
| 8334 void ExceptionHandlers::set_handled_types_data(const Array& value) const { | 8342 void ExceptionHandlers::set_handled_types_data(const Array& value) const { |
| 8335 StorePointer(&raw_ptr()->handled_types_data_, value.raw()); | 8343 StorePointer(&raw_ptr()->handled_types_data_, value.raw()); |
| 8336 } | 8344 } |
| 8337 | 8345 |
| 8338 | 8346 |
| 8339 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { | 8347 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { |
| 8340 ASSERT(Object::exception_handlers_class() != Class::null()); | 8348 ASSERT(Object::exception_handlers_class() != Class::null()); |
| 8341 if (num_handlers < 0 || num_handlers >= kMaxHandlers) { | 8349 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) { |
| 8342 FATAL1("Fatal error in ExceptionHandlers::New(): " | 8350 FATAL1("Fatal error in ExceptionHandlers::New(): " |
| 8343 "invalid num_handlers %" Pd "\n", | 8351 "invalid num_handlers %" Pd "\n", |
| 8344 num_handlers); | 8352 num_handlers); |
| 8345 } | 8353 } |
| 8346 ExceptionHandlers& result = ExceptionHandlers::Handle(); | 8354 ExceptionHandlers& result = ExceptionHandlers::Handle(); |
| 8347 { | 8355 { |
| 8348 uword size = ExceptionHandlers::InstanceSize(num_handlers); | 8356 uword size = ExceptionHandlers::InstanceSize(num_handlers); |
| 8349 RawObject* raw = Object::Allocate(ExceptionHandlers::kClassId, | 8357 RawObject* raw = Object::Allocate(ExceptionHandlers::kClassId, |
| 8350 size, | 8358 size, |
| 8351 Heap::kOld); | 8359 Heap::kOld); |
| (...skipping 6495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14847 } | 14855 } |
| 14848 | 14856 |
| 14849 | 14857 |
| 14850 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14858 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14851 stream->OpenObject(); | 14859 stream->OpenObject(); |
| 14852 stream->CloseObject(); | 14860 stream->CloseObject(); |
| 14853 } | 14861 } |
| 14854 | 14862 |
| 14855 | 14863 |
| 14856 } // namespace dart | 14864 } // namespace dart |
| OLD | NEW |