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

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

Issue 10704210: Fix problem of excessive attempts to optimize, fix excessive deoptimizations for load/store indexed… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
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_entry.h" 7 #include "vm/dart_entry.h"
8 #include "vm/debugger.h" 8 #include "vm/debugger.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 #include "vm/stack_frame.h" 11 #include "vm/stack_frame.h"
12 #include "vm/stub_code.h" 12 #include "vm/stub_code.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 DEFINE_FLAG(bool, print_stack_trace_at_throw, false, 16 DEFINE_FLAG(bool, print_stacktrace_at_throw, false,
17 "Prints a stack trace everytime a throw occurs."); 17 "Prints a stack trace everytime a throw occurs.");
18 18
19 19
20 const char* Exceptions::kCastExceptionDstName = "type cast"; 20 const char* Exceptions::kCastExceptionDstName = "type cast";
21 21
22 22
23 // Iterate through the stack frames and try to find a frame with an 23 // Iterate through the stack frames and try to find a frame with an
24 // exception handler. Once found, set the pc, sp and fp so that execution 24 // exception handler. Once found, set the pc, sp and fp so that execution
25 // can continue in that frame. 25 // can continue in that frame.
26 static bool FindExceptionHandler(uword* handler_pc, 26 static bool FindExceptionHandler(uword* handler_pc,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (stack_frame_pcs.length() > 0) { 146 if (stack_frame_pcs.length() > 0) {
147 if (existing_stacktrace.IsNull()) { 147 if (existing_stacktrace.IsNull()) {
148 stacktrace = Stacktrace::New(stack_frame_pcs); 148 stacktrace = Stacktrace::New(stack_frame_pcs);
149 } else { 149 } else {
150 stacktrace ^= existing_stacktrace.raw(); 150 stacktrace ^= existing_stacktrace.raw();
151 stacktrace.Append(stack_frame_pcs); 151 stacktrace.Append(stack_frame_pcs);
152 } 152 }
153 } else { 153 } else {
154 stacktrace ^= existing_stacktrace.raw(); 154 stacktrace ^= existing_stacktrace.raw();
155 } 155 }
156 if (FLAG_print_stack_trace_at_throw) { 156 if (FLAG_print_stacktrace_at_throw) {
157 OS::Print("Exception '%s' thrown:\n", exception.ToCString()); 157 OS::Print("Exception '%s' thrown:\n", exception.ToCString());
158 OS::Print("%s\n", stacktrace.ToCString()); 158 OS::Print("%s\n", stacktrace.ToCString());
159 } 159 }
160 if (handler_exists) { 160 if (handler_exists) {
161 // Found a dart handler for the exception, jump to it. 161 // Found a dart handler for the exception, jump to it.
162 JumpToExceptionHandler(handler_pc, 162 JumpToExceptionHandler(handler_pc,
163 handler_sp, 163 handler_sp,
164 handler_fp, 164 handler_fp,
165 exception, 165 exception,
166 stacktrace); 166 stacktrace);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 SetField(type_error, cls, "dstType", dst_type_name); 277 SetField(type_error, cls, "dstType", dst_type_name);
278 278
279 // Initialize field 'dstName'. 279 // Initialize field 'dstName'.
280 SetField(type_error, cls, "dstName", dst_name); 280 SetField(type_error, cls, "dstName", dst_name);
281 281
282 // Initialize field 'malformedError'. 282 // Initialize field 'malformedError'.
283 SetField(type_error, cls, "malformedError", malformed_error); 283 SetField(type_error, cls, "malformedError", malformed_error);
284 284
285 // Type errors in the core library may be difficult to diagnose. 285 // Type errors in the core library may be difficult to diagnose.
286 // Print type error information before throwing the error when debugging. 286 // Print type error information before throwing the error when debugging.
287 if (FLAG_print_stack_trace_at_throw) { 287 if (FLAG_print_stacktrace_at_throw) {
288 if (!malformed_error.IsNull()) { 288 if (!malformed_error.IsNull()) {
289 OS::Print("%s\n", malformed_error.ToCString()); 289 OS::Print("%s\n", malformed_error.ToCString());
290 } 290 }
291 intptr_t line, column; 291 intptr_t line, column;
292 script.GetTokenLocation(location, &line, &column); 292 script.GetTokenLocation(location, &line, &column);
293 OS::Print("'%s': Failed type check: line %d pos %d: ", 293 OS::Print("'%s': Failed type check: line %d pos %d: ",
294 String::Handle(script.url()).ToCString(), line, column); 294 String::Handle(script.url()).ToCString(), line, column);
295 if (!dst_name.IsNull() && (dst_name.Length() > 0)) { 295 if (!dst_name.IsNull() && (dst_name.Length() > 0)) {
296 OS::Print("type '%s' is not a subtype of type '%s' of '%s'.\n", 296 OS::Print("type '%s' is not a subtype of type '%s' of '%s'.\n",
297 src_type_name.ToCString(), 297 src_type_name.ToCString(),
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 case kIsolateSpawn: 417 case kIsolateSpawn:
418 library = Library::IsolateLibrary(); 418 library = Library::IsolateLibrary();
419 class_name = String::NewSymbol("IsolateSpawnException"); 419 class_name = String::NewSymbol("IsolateSpawnException");
420 break; 420 break;
421 } 421 }
422 422
423 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments); 423 return DartLibraryCalls::ExceptionCreate(library, class_name, arguments);
424 } 424 }
425 425
426 } // namespace dart 426 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698