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

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

Issue 9316071: Dart_PropagateError, take 2. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 10 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 | « runtime/vm/cpu_arm.cc ('k') | runtime/vm/cpu_x64.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) 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/globals.h" 5 #include "vm/globals.h"
6 6
7 #if defined(TARGET_ARCH_IA32) 7 #if defined(TARGET_ARCH_IA32)
8 8
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 : [exception] "m" (exception), 66 : [exception] "m" (exception),
67 [stacktrace] "m" (stacktrace), 67 [stacktrace] "m" (stacktrace),
68 [pc] "m" (program_counter), 68 [pc] "m" (program_counter),
69 [sp] "m" (stack_pointer), 69 [sp] "m" (stack_pointer),
70 [fp] "m" (frame_pointer)); 70 [fp] "m" (frame_pointer));
71 #endif 71 #endif
72 UNREACHABLE(); 72 UNREACHABLE();
73 } 73 }
74 74
75 75
76 void CPU::JumpToUnhandledExceptionHandler( 76 void CPU::JumpToErrorHandler(
77 uword program_counter, 77 uword program_counter,
78 uword stack_pointer, 78 uword stack_pointer,
79 uword frame_pointer, 79 uword frame_pointer,
80 const UnhandledException& unhandled_exception_object) { 80 const Error& error) {
81 // The no_gc StackResource is unwound through the tear down of 81 // The no_gc StackResource is unwound through the tear down of
82 // stack resources below. 82 // stack resources below.
83 NoGCScope no_gc; 83 NoGCScope no_gc;
84 ASSERT(!unhandled_exception_object.IsNull()); 84 ASSERT(!error.IsNull());
85 RawUnhandledException* unhandled_exception = unhandled_exception_object.raw(); 85 RawError* raw_error = error.raw();
86 86
87 // Prepare for unwinding frames by destroying all the stack resources 87 // Prepare for unwinding frames by destroying all the stack resources
88 // in the previous frames. 88 // in the previous frames.
89 Isolate* isolate = Isolate::Current(); 89 Isolate* isolate = Isolate::Current();
90 while (isolate->top_resource() != NULL && 90 while (isolate->top_resource() != NULL &&
91 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) { 91 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) {
92 isolate->top_resource()->~StackResource(); 92 isolate->top_resource()->~StackResource();
93 } 93 }
94 94
95 // Set up the unhandled exception object as the return value in EAX 95 // Set up the error object as the return value in EAX and continue
96 // and continue from the invocation stub. 96 // from the invocation stub.
97 #if defined(TARGET_OS_WINDOWS) 97 #if defined(TARGET_OS_WINDOWS)
98 __asm { 98 __asm {
99 mov eax, unhandled_exception 99 mov eax, raw_error
100 mov ebx, program_counter 100 mov ebx, program_counter
101 mov ecx, frame_pointer 101 mov ecx, frame_pointer
102 mov edi, stack_pointer 102 mov edi, stack_pointer
103 mov ebp, ecx 103 mov ebp, ecx
104 mov esp, edi 104 mov esp, edi
105 jmp ebx 105 jmp ebx
106 } 106 }
107 #else 107 #else
108 asm volatile("mov %[unhandled_exception], %%eax;" 108 asm volatile("mov %[raw_error], %%eax;"
109 "mov %[pc], %%ebx;" 109 "mov %[pc], %%ebx;"
110 "mov %[fp], %%ecx;" 110 "mov %[fp], %%ecx;"
111 "mov %[sp], %%edi;" 111 "mov %[sp], %%edi;"
112 "mov %%ecx, %%ebp;" 112 "mov %%ecx, %%ebp;"
113 "mov %%edi, %%esp;" 113 "mov %%edi, %%esp;"
114 "jmp *%%ebx;" 114 "jmp *%%ebx;"
115 : 115 :
116 : [unhandled_exception] "m" (unhandled_exception), 116 : [raw_error] "m" (raw_error),
117 [pc] "m" (program_counter), 117 [pc] "m" (program_counter),
118 [sp] "m" (stack_pointer), 118 [sp] "m" (stack_pointer),
119 [fp] "m" (frame_pointer)); 119 [fp] "m" (frame_pointer));
120 #endif 120 #endif
121 UNREACHABLE(); 121 UNREACHABLE();
122 } 122 }
123 123
124 124
125 const char* CPU::Id() { 125 const char* CPU::Id() {
126 return "ia32"; 126 return "ia32";
127 } 127 }
128 128
129 } // namespace dart 129 } // namespace dart
130 130
131 #endif // defined TARGET_ARCH_IA32 131 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/cpu_arm.cc ('k') | runtime/vm/cpu_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698