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

Side by Side Diff: runtime/lib/errors.cc

Issue 2997993002: Revert "Reapply "Eliminate dependencies on assemblers and code stubs in precompiled runtime."" (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | runtime/vm/assembler.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/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 #include "vm/exceptions.h" 6 #include "vm/exceptions.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/runtime_entry.h" 8 #include "vm/runtime_entry.h"
9 #include "vm/stack_frame.h" 9 #include "vm/stack_frame.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // Scan the stack until we hit the first function in the _AssertionError 14 // Scan the stack until we hit the first function in the _AssertionError
15 // class. We then return the next frame's script taking inlining into account. 15 // class. We then return the next frame's script taking inlining into account.
16 static RawScript* FindScript(DartFrameIterator* iterator) { 16 static RawScript* FindScript(DartFrameIterator* iterator) {
17 #if defined(DART_PRECOMPILED_RUNTIME) 17 if (FLAG_precompiled_runtime) {
18 // The precompiled runtime faces two issues in recovering the correct 18 // The precompiled runtime faces two issues in recovering the correct
19 // assertion text. First, the precompiled runtime does not include 19 // assertion text. First, the precompiled runtime does not include
20 // the inlining meta-data so we cannot walk the inline-aware stack trace. 20 // the inlining meta-data so we cannot walk the inline-aware stack trace.
21 // Second, the script text itself is missing so whatever script is returned 21 // Second, the script text itself is missing so whatever script is returned
22 // from here will be missing the assertion expression text. 22 // from here will be missing the assertion expression text.
23 iterator->NextFrame(); // Skip _AssertionError._evaluateAssertion frame 23 iterator->NextFrame(); // Skip _AssertionError._evaluateAssertion frame
24 return Exceptions::GetCallerScript(iterator); 24 return Exceptions::GetCallerScript(iterator);
25 #else 25 }
26 StackFrame* stack_frame = iterator->NextFrame(); 26 StackFrame* stack_frame = iterator->NextFrame();
27 Code& code = Code::Handle(); 27 Code& code = Code::Handle();
28 Function& func = Function::Handle(); 28 Function& func = Function::Handle();
29 const Class& assert_error_class = 29 const Class& assert_error_class =
30 Class::Handle(Library::LookupCoreClass(Symbols::AssertionError())); 30 Class::Handle(Library::LookupCoreClass(Symbols::AssertionError()));
31 ASSERT(!assert_error_class.IsNull()); 31 ASSERT(!assert_error_class.IsNull());
32 bool hit_assertion_error = false; 32 bool hit_assertion_error = false;
33 while (stack_frame != NULL) { 33 while (stack_frame != NULL) {
34 code ^= stack_frame->LookupDartCode(); 34 code ^= stack_frame->LookupDartCode();
35 if (code.is_optimized()) { 35 if (code.is_optimized()) {
(...skipping 13 matching lines...) Expand all
49 if (hit_assertion_error) { 49 if (hit_assertion_error) {
50 return func.script(); 50 return func.script();
51 } 51 }
52 ASSERT(!hit_assertion_error); 52 ASSERT(!hit_assertion_error);
53 hit_assertion_error = (func.Owner() == assert_error_class.raw()); 53 hit_assertion_error = (func.Owner() == assert_error_class.raw());
54 } 54 }
55 stack_frame = iterator->NextFrame(); 55 stack_frame = iterator->NextFrame();
56 } 56 }
57 UNREACHABLE(); 57 UNREACHABLE();
58 return Script::null(); 58 return Script::null();
59 #endif // defined(DART_PRECOMPILED_RUNTIME)
60 } 59 }
61 60
62 // Allocate and throw a new AssertionError. 61 // Allocate and throw a new AssertionError.
63 // Arg0: index of the first token of the failed assertion. 62 // Arg0: index of the first token of the failed assertion.
64 // Arg1: index of the first token after the failed assertion. 63 // Arg1: index of the first token after the failed assertion.
65 // Arg2: Message object or null. 64 // Arg2: Message object or null.
66 // Return value: none, throws an exception. 65 // Return value: none, throws an exception.
67 DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 3) { 66 DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 3) {
68 // No need to type check the arguments. This function can only be called 67 // No need to type check the arguments. This function can only be called
69 // internally from the VM. 68 // internally from the VM.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 180
182 // Rethrow an error with a stacktrace. 181 // Rethrow an error with a stacktrace.
183 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) { 182 DEFINE_NATIVE_ENTRY(Async_rethrow, 2) {
184 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); 183 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0));
185 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1)); 184 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1));
186 Exceptions::ReThrow(thread, error, stacktrace); 185 Exceptions::ReThrow(thread, error, stacktrace);
187 return Object::null(); 186 return Object::null();
188 } 187 }
189 188
190 } // namespace dart 189 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698