Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: runtime/vm/object.cc

Issue 23531008: Last round of cleanups in exception handler, before going to the next stage. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8285 matching lines...) Expand 10 before | Expand all | Expand 10 after
8296 8296
8297 8297
8298 intptr_t ExceptionHandlers::Length() const { 8298 intptr_t ExceptionHandlers::Length() const {
8299 return raw_ptr()->length_; 8299 return raw_ptr()->length_;
8300 } 8300 }
8301 8301
8302 8302
8303 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, 8303 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
8304 intptr_t outer_try_index, 8304 intptr_t outer_try_index,
8305 intptr_t handler_pc, 8305 intptr_t handler_pc,
8306 bool needs_stacktrace) const { 8306 bool needs_stacktrace,
8307 bool has_catch_all) const {
8307 ASSERT((try_index >= 0) && (try_index < Length())); 8308 ASSERT((try_index >= 0) && (try_index < Length()));
8308 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index]; 8309 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index];
8309 info->outer_try_index = outer_try_index; 8310 info->outer_try_index = outer_try_index;
8310 info->handler_pc = handler_pc; 8311 info->handler_pc = handler_pc;
8311 info->needs_stacktrace = needs_stacktrace; 8312 info->needs_stacktrace = needs_stacktrace;
8313 info->has_catch_all = has_catch_all;
8312 } 8314 }
8313 8315
8314 void ExceptionHandlers::GetHandlerInfo( 8316 void ExceptionHandlers::GetHandlerInfo(
8315 intptr_t try_index, 8317 intptr_t try_index,
8316 RawExceptionHandlers::HandlerInfo* info) const { 8318 RawExceptionHandlers::HandlerInfo* info) const {
8317 ASSERT((try_index >= 0) && (try_index < Length())); 8319 ASSERT((try_index >= 0) && (try_index < Length()));
8318 ASSERT(info != NULL); 8320 ASSERT(info != NULL);
8319 RawExceptionHandlers::HandlerInfo* data = &raw_ptr()->data_[try_index]; 8321 *info = raw_ptr()->data_[try_index];
8320 info->outer_try_index = data->outer_try_index;
8321 info->handler_pc = data->handler_pc;
8322 } 8322 }
8323 8323
8324 8324
8325 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const { 8325 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const {
8326 ASSERT((try_index >= 0) && (try_index < Length())); 8326 ASSERT((try_index >= 0) && (try_index < Length()));
8327 return raw_ptr()->data_[try_index].handler_pc; 8327 return raw_ptr()->data_[try_index].handler_pc;
8328 } 8328 }
8329 8329
8330 8330
8331 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { 8331 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const {
8332 ASSERT((try_index >= 0) && (try_index < Length())); 8332 ASSERT((try_index >= 0) && (try_index < Length()));
8333 return raw_ptr()->data_[try_index].outer_try_index; 8333 return raw_ptr()->data_[try_index].outer_try_index;
8334 } 8334 }
8335 8335
8336 8336
8337 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const { 8337 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const {
8338 ASSERT((try_index >= 0) && (try_index < Length())); 8338 ASSERT((try_index >= 0) && (try_index < Length()));
8339 return raw_ptr()->data_[try_index].needs_stacktrace; 8339 return raw_ptr()->data_[try_index].needs_stacktrace;
8340 } 8340 }
8341 8341
8342 8342
8343 bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
8344 ASSERT((try_index >= 0) && (try_index < Length()));
8345 return raw_ptr()->data_[try_index].has_catch_all;
8346 }
8347
8348
8343 void ExceptionHandlers::SetHandledTypes(intptr_t try_index, 8349 void ExceptionHandlers::SetHandledTypes(intptr_t try_index,
8344 const Array& handled_types) const { 8350 const Array& handled_types) const {
8345 ASSERT((try_index >= 0) && (try_index < Length())); 8351 ASSERT((try_index >= 0) && (try_index < Length()));
8346 const Array& handled_types_data = 8352 const Array& handled_types_data =
8347 Array::Handle(raw_ptr()->handled_types_data_); 8353 Array::Handle(raw_ptr()->handled_types_data_);
8348 handled_types_data.SetAt(try_index, handled_types); 8354 handled_types_data.SetAt(try_index, handled_types);
8349 } 8355 }
8350 8356
8351 8357
8352 RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const { 8358 RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const {
8353 ASSERT((try_index >= 0) && (try_index < Length())); 8359 ASSERT((try_index >= 0) && (try_index < Length()));
8354 Array& array = Array::Handle(raw_ptr()->handled_types_data_); 8360 Array& array = Array::Handle(raw_ptr()->handled_types_data_);
8355 array ^= array.At(try_index); 8361 array ^= array.At(try_index);
8356 return array.raw(); 8362 return array.raw();
8357 } 8363 }
8358 8364
8359 8365
8360 bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
8361 ASSERT((try_index >= 0) && (try_index < Length()));
8362 Array& array = Array::Handle(raw_ptr()->handled_types_data_);
8363 array ^= array.At(try_index);
8364 for (intptr_t i = 0; i < array.Length(); i++) {
8365 if (array.At(i) == Type::DynamicType()) {
8366 return true;
8367 }
8368 }
8369 return false;
8370 }
8371
8372
8373 void ExceptionHandlers::set_handled_types_data(const Array& value) const { 8366 void ExceptionHandlers::set_handled_types_data(const Array& value) const {
8374 StorePointer(&raw_ptr()->handled_types_data_, value.raw()); 8367 StorePointer(&raw_ptr()->handled_types_data_, value.raw());
8375 } 8368 }
8376 8369
8377 8370
8378 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { 8371 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) {
8379 ASSERT(Object::exception_handlers_class() != Class::null()); 8372 ASSERT(Object::exception_handlers_class() != Class::null());
8380 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) { 8373 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) {
8381 FATAL1("Fatal error in ExceptionHandlers::New(): " 8374 FATAL1("Fatal error in ExceptionHandlers::New(): "
8382 "invalid num_handlers %" Pd "\n", 8375 "invalid num_handlers %" Pd "\n",
(...skipping 6520 matching lines...) Expand 10 before | Expand all | Expand 10 after
14903 } 14896 }
14904 14897
14905 14898
14906 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14899 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14907 stream->OpenObject(); 14900 stream->OpenObject();
14908 stream->CloseObject(); 14901 stream->CloseObject();
14909 } 14902 }
14910 14903
14911 14904
14912 } // namespace dart 14905 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698