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

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

Issue 23494014: - Reapply change r26880. (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 | runtime/vm/object.h » ('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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Code& frame_code = Code::Handle(); 154 Code& frame_code = Code::Handle();
155 Smi& frame_offset = Smi::Handle(); 155 Smi& frame_offset = Smi::Handle();
156 intptr_t start = Stacktrace::kPreallocatedStackdepth - (kNumTopframes - 1); 156 intptr_t start = Stacktrace::kPreallocatedStackdepth - (kNumTopframes - 1);
157 intptr_t null_slot = start - 2; 157 intptr_t null_slot = start - 2;
158 // Add an empty slot to indicate the overflow so that the toString 158 // Add an empty slot to indicate the overflow so that the toString
159 // method can account for the overflow. 159 // method can account for the overflow.
160 if (stacktrace_.FunctionAtFrame(null_slot) != Function::null()) { 160 if (stacktrace_.FunctionAtFrame(null_slot) != Function::null()) {
161 stacktrace_.SetFunctionAtFrame(null_slot, frame_func); 161 stacktrace_.SetFunctionAtFrame(null_slot, frame_func);
162 stacktrace_.SetCodeAtFrame(null_slot, frame_code); 162 stacktrace_.SetCodeAtFrame(null_slot, frame_code);
163 } 163 }
164 // Move frames one slot down so that we can accomadate the new frame. 164 // Move frames one slot down so that we can accomodate the new frame.
165 for (intptr_t i = start; i < Stacktrace::kPreallocatedStackdepth; i++) { 165 for (intptr_t i = start; i < Stacktrace::kPreallocatedStackdepth; i++) {
166 intptr_t prev = (i - 1); 166 intptr_t prev = (i - 1);
167 frame_func = stacktrace_.FunctionAtFrame(i); 167 frame_func = stacktrace_.FunctionAtFrame(i);
168 frame_code = stacktrace_.CodeAtFrame(i); 168 frame_code = stacktrace_.CodeAtFrame(i);
169 frame_offset = stacktrace_.PcOffsetAtFrame(i); 169 frame_offset = stacktrace_.PcOffsetAtFrame(i);
170 stacktrace_.SetFunctionAtFrame(prev, frame_func); 170 stacktrace_.SetFunctionAtFrame(prev, frame_func);
171 stacktrace_.SetCodeAtFrame(prev, frame_code); 171 stacktrace_.SetCodeAtFrame(prev, frame_code);
172 stacktrace_.SetPcOffsetAtFrame(prev, frame_offset); 172 stacktrace_.SetPcOffsetAtFrame(prev, frame_offset);
173 } 173 }
174 cur_index_ = (Stacktrace::kPreallocatedStackdepth - 1); 174 cur_index_ = (Stacktrace::kPreallocatedStackdepth - 1);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 __asan_unpoison_memory_region(reinterpret_cast<void*>(current_sp), 358 __asan_unpoison_memory_region(reinterpret_cast<void*>(current_sp),
359 stack_pointer - current_sp); 359 stack_pointer - current_sp);
360 func(program_counter, stack_pointer, frame_pointer, 360 func(program_counter, stack_pointer, frame_pointer,
361 raw_exception, raw_stacktrace); 361 raw_exception, raw_stacktrace);
362 #endif 362 #endif
363 UNREACHABLE(); 363 UNREACHABLE();
364 } 364 }
365 365
366 366
367 static RawField* LookupStacktraceField(const Instance& instance) { 367 static RawField* LookupStacktraceField(const Instance& instance) {
368 if (instance.GetClassId() < kNumPredefinedCids) {
369 // 'class Error' is not a predefined class.
370 return Field::null();
371 }
368 Isolate* isolate = Isolate::Current(); 372 Isolate* isolate = Isolate::Current();
369 Class& error_class = Class::Handle(isolate, 373 Class& error_class = Class::Handle(isolate,
370 isolate->object_store()->error_class()); 374 isolate->object_store()->error_class());
371 if (error_class.IsNull()) { 375 if (error_class.IsNull()) {
372 const Library& core_lib = Library::Handle(isolate, Library::CoreLibrary()); 376 const Library& core_lib = Library::Handle(isolate, Library::CoreLibrary());
373 error_class = core_lib.LookupClass(Symbols::Error(), NULL); 377 error_class = core_lib.LookupClass(Symbols::Error(), NULL);
374 ASSERT(!error_class.IsNull()); 378 ASSERT(!error_class.IsNull());
375 isolate->object_store()->set_error_class(error_class); 379 isolate->object_store()->set_error_class(error_class);
376 } 380 }
377 // If instance class extends 'class Error' return '_stackTrace' field. 381 // If instance class extends 'class Error' return '_stackTrace' field.
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 break; 752 break;
749 } 753 }
750 754
751 return DartLibraryCalls::InstanceCreate(library, 755 return DartLibraryCalls::InstanceCreate(library,
752 *class_name, 756 *class_name,
753 *constructor_name, 757 *constructor_name,
754 arguments); 758 arguments);
755 } 759 }
756 760
757 } // namespace dart 761 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698