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

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 8272 matching lines...) Expand 10 before | Expand all | Expand 10 after
8283 8283
8284 8284
8285 intptr_t ExceptionHandlers::Length() const { 8285 intptr_t ExceptionHandlers::Length() const {
8286 return raw_ptr()->length_; 8286 return raw_ptr()->length_;
8287 } 8287 }
8288 8288
8289 8289
8290 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, 8290 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
8291 intptr_t outer_try_index, 8291 intptr_t outer_try_index,
8292 intptr_t handler_pc, 8292 intptr_t handler_pc,
8293 bool needs_stacktrace) const { 8293 bool needs_stacktrace,
8294 bool has_catch_all) const {
8294 ASSERT((try_index >= 0) && (try_index < Length())); 8295 ASSERT((try_index >= 0) && (try_index < Length()));
8295 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index]; 8296 RawExceptionHandlers::HandlerInfo* info = &raw_ptr()->data_[try_index];
8296 info->outer_try_index = outer_try_index; 8297 info->outer_try_index = outer_try_index;
8297 info->handler_pc = handler_pc; 8298 info->handler_pc = handler_pc;
8298 info->needs_stacktrace = needs_stacktrace; 8299 info->needs_stacktrace = needs_stacktrace;
8300 info->has_catch_all = has_catch_all;
8299 } 8301 }
8300 8302
8301 void ExceptionHandlers::GetHandlerInfo( 8303 void ExceptionHandlers::GetHandlerInfo(
8302 intptr_t try_index, 8304 intptr_t try_index,
8303 RawExceptionHandlers::HandlerInfo* info) const { 8305 RawExceptionHandlers::HandlerInfo* info) const {
8304 ASSERT((try_index >= 0) && (try_index < Length())); 8306 ASSERT((try_index >= 0) && (try_index < Length()));
8305 ASSERT(info != NULL); 8307 ASSERT(info != NULL);
8306 RawExceptionHandlers::HandlerInfo* data = &raw_ptr()->data_[try_index]; 8308 *info = raw_ptr()->data_[try_index];
siva 2013/08/30 04:15:19 WIll this structure assignment work on all platfor
srdjan 2013/08/30 20:43:47 I expect that.
8307 info->outer_try_index = data->outer_try_index;
8308 info->handler_pc = data->handler_pc;
8309 } 8309 }
8310 8310
8311 8311
8312 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const { 8312 intptr_t ExceptionHandlers::HandlerPC(intptr_t try_index) const {
8313 ASSERT((try_index >= 0) && (try_index < Length())); 8313 ASSERT((try_index >= 0) && (try_index < Length()));
8314 return raw_ptr()->data_[try_index].handler_pc; 8314 return raw_ptr()->data_[try_index].handler_pc;
8315 } 8315 }
8316 8316
8317 8317
8318 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const { 8318 intptr_t ExceptionHandlers::OuterTryIndex(intptr_t try_index) const {
8319 ASSERT((try_index >= 0) && (try_index < Length())); 8319 ASSERT((try_index >= 0) && (try_index < Length()));
8320 return raw_ptr()->data_[try_index].outer_try_index; 8320 return raw_ptr()->data_[try_index].outer_try_index;
8321 } 8321 }
8322 8322
8323 8323
8324 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const { 8324 bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const {
8325 ASSERT((try_index >= 0) && (try_index < Length())); 8325 ASSERT((try_index >= 0) && (try_index < Length()));
8326 return raw_ptr()->data_[try_index].needs_stacktrace; 8326 return raw_ptr()->data_[try_index].needs_stacktrace;
8327 } 8327 }
8328 8328
8329 8329
8330 bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
8331 ASSERT((try_index >= 0) && (try_index < Length()));
8332 return raw_ptr()->data_[try_index].has_catch_all;
8333 }
8334
8335
8330 void ExceptionHandlers::SetHandledTypes(intptr_t try_index, 8336 void ExceptionHandlers::SetHandledTypes(intptr_t try_index,
8331 const Array& handled_types) const { 8337 const Array& handled_types) const {
8332 ASSERT((try_index >= 0) && (try_index < Length())); 8338 ASSERT((try_index >= 0) && (try_index < Length()));
8333 const Array& handled_types_data = 8339 const Array& handled_types_data =
8334 Array::Handle(raw_ptr()->handled_types_data_); 8340 Array::Handle(raw_ptr()->handled_types_data_);
8335 handled_types_data.SetAt(try_index, handled_types); 8341 handled_types_data.SetAt(try_index, handled_types);
8336 } 8342 }
8337 8343
8338 8344
8339 RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const { 8345 RawArray* ExceptionHandlers::GetHandledTypes(intptr_t try_index) const {
8340 ASSERT((try_index >= 0) && (try_index < Length())); 8346 ASSERT((try_index >= 0) && (try_index < Length()));
8341 Array& array = Array::Handle(raw_ptr()->handled_types_data_); 8347 Array& array = Array::Handle(raw_ptr()->handled_types_data_);
8342 array ^= array.At(try_index); 8348 array ^= array.At(try_index);
8343 return array.raw(); 8349 return array.raw();
8344 } 8350 }
8345 8351
8346 8352
8347 bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
8348 ASSERT((try_index >= 0) && (try_index < Length()));
8349 Array& array = Array::Handle(raw_ptr()->handled_types_data_);
8350 array ^= array.At(try_index);
8351 for (intptr_t i = 0; i < array.Length(); i++) {
8352 if (array.At(i) == Type::DynamicType()) {
8353 return true;
8354 }
8355 }
8356 return false;
8357 }
8358
8359
8360 void ExceptionHandlers::set_handled_types_data(const Array& value) const { 8353 void ExceptionHandlers::set_handled_types_data(const Array& value) const {
8361 StorePointer(&raw_ptr()->handled_types_data_, value.raw()); 8354 StorePointer(&raw_ptr()->handled_types_data_, value.raw());
8362 } 8355 }
8363 8356
8364 8357
8365 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) { 8358 RawExceptionHandlers* ExceptionHandlers::New(intptr_t num_handlers) {
8366 ASSERT(Object::exception_handlers_class() != Class::null()); 8359 ASSERT(Object::exception_handlers_class() != Class::null());
8367 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) { 8360 if ((num_handlers < 0) || (num_handlers >= kMaxHandlers)) {
8368 FATAL1("Fatal error in ExceptionHandlers::New(): " 8361 FATAL1("Fatal error in ExceptionHandlers::New(): "
8369 "invalid num_handlers %" Pd "\n", 8362 "invalid num_handlers %" Pd "\n",
(...skipping 6518 matching lines...) Expand 10 before | Expand all | Expand 10 after
14888 } 14881 }
14889 14882
14890 14883
14891 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14884 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14892 stream->OpenObject(); 14885 stream->OpenObject();
14893 stream->CloseObject(); 14886 stream->CloseObject();
14894 } 14887 }
14895 14888
14896 14889
14897 } // namespace dart 14890 } // 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