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

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

Issue 23638003: Improve performance of exception handling: quicker (and correcter) determination if the exception c… (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 | « no previous file | no next file » | 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 371 }
372 Isolate* isolate = Isolate::Current(); 372 Isolate* isolate = Isolate::Current();
373 Class& error_class = Class::Handle(isolate, 373 Class& error_class = Class::Handle(isolate,
374 isolate->object_store()->error_class()); 374 isolate->object_store()->error_class());
375 if (error_class.IsNull()) { 375 if (error_class.IsNull()) {
376 const Library& core_lib = Library::Handle(isolate, Library::CoreLibrary()); 376 const Library& core_lib = Library::Handle(isolate, Library::CoreLibrary());
377 error_class = core_lib.LookupClass(Symbols::Error(), NULL); 377 error_class = core_lib.LookupClass(Symbols::Error(), NULL);
378 ASSERT(!error_class.IsNull()); 378 ASSERT(!error_class.IsNull());
379 isolate->object_store()->set_error_class(error_class); 379 isolate->object_store()->set_error_class(error_class);
380 } 380 }
381 const Class& instance_class = Class::Handle(isolate, instance.clazz()); 381
382 Error& malformed_type_error = Error::Handle(isolate); 382 Class& test_class = Class::Handle(isolate, instance.clazz());
Ivan Posva 2013/08/29 19:35:19 // Comments please.
srdjan 2013/08/29 19:37:29 Done.
383 if (instance_class.IsSubtypeOf(Object::null_abstract_type_arguments(), 383 AbstractType& type = AbstractType::Handle(isolate, AbstractType::null());
384 error_class, 384 while (true) {
385 Object::null_abstract_type_arguments(), 385 if (test_class.raw() == error_class.raw()) {
386 &malformed_type_error)) { 386 return error_class.LookupInstanceField(Symbols::_stackTrace());
387 ASSERT(malformed_type_error.IsNull()); 387 }
388 return error_class.LookupInstanceField(Symbols::_stackTrace()); 388 type = test_class.super_type();
389 } 389 if (type.IsNull()) return Field::null();
390 test_class = type.type_class();
391 };
392 UNREACHABLE();
390 return Field::null(); 393 return Field::null();
391 } 394 }
392 395
393 396
394 static void ThrowExceptionHelper(const Instance& incoming_exception, 397 static void ThrowExceptionHelper(const Instance& incoming_exception,
395 const Instance& existing_stacktrace) { 398 const Instance& existing_stacktrace) {
396 bool use_preallocated_stacktrace = false; 399 bool use_preallocated_stacktrace = false;
397 Isolate* isolate = Isolate::Current(); 400 Isolate* isolate = Isolate::Current();
398 Instance& exception = Instance::Handle(isolate, incoming_exception.raw()); 401 Instance& exception = Instance::Handle(isolate, incoming_exception.raw());
399 if (exception.IsNull()) { 402 if (exception.IsNull()) {
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 break; 752 break;
750 } 753 }
751 754
752 return DartLibraryCalls::InstanceCreate(library, 755 return DartLibraryCalls::InstanceCreate(library,
753 *class_name, 756 *class_name,
754 *constructor_name, 757 *constructor_name,
755 arguments); 758 arguments);
756 } 759 }
757 760
758 } // namespace dart 761 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698