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

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

Issue 22889002: Fix minor bug which was causing throw of Null to not be recognized properly. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | « no previous file | tests/corelib/corelib.status » ('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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/exceptions.h" 5 #include "vm/exceptions.h"
6 6
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/debugger.h" 9 #include "vm/debugger.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 bool handler_exists = false; 357 bool handler_exists = false;
358 if (use_preallocated_stacktrace) { 358 if (use_preallocated_stacktrace) {
359 stacktrace ^= isolate->object_store()->preallocated_stack_trace(); 359 stacktrace ^= isolate->object_store()->preallocated_stack_trace();
360 PreallocatedStacktraceBuilder frame_builder(stacktrace); 360 PreallocatedStacktraceBuilder frame_builder(stacktrace);
361 handler_exists = FindExceptionHandler(&handler_pc, 361 handler_exists = FindExceptionHandler(&handler_pc,
362 &handler_sp, 362 &handler_sp,
363 &handler_fp, 363 &handler_fp,
364 &frame_builder); 364 &frame_builder);
365 } else { 365 } else {
366 const Field& stacktrace_field = 366 const Field& stacktrace_field =
367 Field::Handle(LookupStacktraceField(incoming_exception)); 367 Field::Handle(LookupStacktraceField(exception));
368 bool full_stacktrace = !stacktrace_field.IsNull(); 368 bool full_stacktrace = !stacktrace_field.IsNull();
369 RegularStacktraceBuilder frame_builder(full_stacktrace); 369 RegularStacktraceBuilder frame_builder(full_stacktrace);
370 handler_exists = FindExceptionHandler(&handler_pc, 370 handler_exists = FindExceptionHandler(&handler_pc,
371 &handler_sp, 371 &handler_sp,
372 &handler_fp, 372 &handler_fp,
373 &frame_builder); 373 &frame_builder);
374 // Create arrays for function, code and pc_offset triplet of each frame. 374 // Create arrays for function, code and pc_offset triplet of each frame.
375 const Array& func_array = 375 const Array& func_array =
376 Array::Handle(isolate, Array::MakeArray(frame_builder.func_list())); 376 Array::Handle(isolate, Array::MakeArray(frame_builder.func_list()));
377 const Array& code_array = 377 const Array& code_array =
(...skipping 11 matching lines...) Expand all
389 const Array& catch_code_array = 389 const Array& catch_code_array =
390 Array::Handle(isolate, 390 Array::Handle(isolate,
391 Array::MakeArray(frame_builder.catch_code_list())); 391 Array::MakeArray(frame_builder.catch_code_list()));
392 const Array& catch_pc_offset_array = 392 const Array& catch_pc_offset_array =
393 Array::Handle(isolate, 393 Array::Handle(isolate,
394 Array::MakeArray(frame_builder.catch_pc_offset_list())); 394 Array::MakeArray(frame_builder.catch_pc_offset_list()));
395 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array); 395 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
396 stacktrace.SetCatchStacktrace(catch_func_array, 396 stacktrace.SetCatchStacktrace(catch_func_array,
397 catch_code_array, 397 catch_code_array,
398 catch_pc_offset_array); 398 catch_pc_offset_array);
399 if (incoming_exception.GetField(stacktrace_field) == Object::null()) { 399 if (exception.GetField(stacktrace_field) == Object::null()) {
400 incoming_exception.SetField(stacktrace_field, stacktrace); 400 exception.SetField(stacktrace_field, stacktrace);
401 } 401 }
402 } 402 }
403 // TODO(5411263): At some point we can optimize by figuring out if a 403 // TODO(5411263): At some point we can optimize by figuring out if a
404 // stack trace is needed based on whether the catch code specifies a 404 // stack trace is needed based on whether the catch code specifies a
405 // stack trace object or there is a rethrow in the catch clause. 405 // stack trace object or there is a rethrow in the catch clause.
406 if (pc_offset_array.Length() != 0) { 406 if (pc_offset_array.Length() != 0) {
407 if (existing_stacktrace.IsNull()) { 407 if (existing_stacktrace.IsNull()) {
408 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array); 408 stacktrace = Stacktrace::New(func_array, code_array, pc_offset_array);
409 } else { 409 } else {
410 stacktrace ^= existing_stacktrace.raw(); 410 stacktrace ^= existing_stacktrace.raw();
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 break; 701 break;
702 } 702 }
703 703
704 return DartLibraryCalls::InstanceCreate(library, 704 return DartLibraryCalls::InstanceCreate(library,
705 *class_name, 705 *class_name,
706 *constructor_name, 706 *constructor_name,
707 arguments); 707 arguments);
708 } 708 }
709 709
710 } // namespace dart 710 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/corelib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698