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

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

Issue 9114054: Port a couple more stubs to x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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) 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/globals.h" 5 #include "vm/globals.h"
6 6
7 #if defined(TARGET_ARCH_X64) 7 #if defined(TARGET_ARCH_X64)
8 8
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 10
11 #include "vm/constants_x64.h"
12 #include "vm/heap.h"
13 #include "vm/isolate.h"
14 #include "vm/object.h"
15
11 namespace dart { 16 namespace dart {
12 17
13 void CPU::FlushICache(uword start, uword size) { 18 void CPU::FlushICache(uword start, uword size) {
14 // Nothing to be done here. 19 // Nothing to be done here.
15 } 20 }
16 21
17 22
18 void CPU::JumpToExceptionHandler(uword pc, 23 void CPU::JumpToExceptionHandler(uword program_counter,
19 uword sp, 24 uword stack_pointer,
20 uword fp, 25 uword frame_pointer,
21 const Instance& exception_object, 26 const Instance& exception_object,
22 const Instance& stacktrace_object) { 27 const Instance& stacktrace_object) {
28 NoGCScope no_gc;
Ivan Posva 2012/01/13 06:27:40 This is also in the ia32 code, but I was wondering
regis 2012/01/13 18:57:31 Done here, below, and in cpu_ia32.cc.
29 RawInstance* exception = exception_object.raw();
30 RawInstance* stacktrace = stacktrace_object.raw();
31
32 // Prepare for unwinding frames by destroying all the stack resources
33 // in the previous frames.
34 Isolate* isolate = Isolate::Current();
35 while (isolate->top_resource() != NULL &&
36 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) {
37 isolate->top_resource()->~StackResource();
38 }
39
40 // Set up the appropriate register state and jump to the handler.
41 ASSERT(kExceptionObjectReg == RAX);
42 ASSERT(kStackTraceObjectReg == RDX);
43 #if defined(TARGET_OS_WINDOWS)
23 UNIMPLEMENTED(); 44 UNIMPLEMENTED();
45 #else
46 asm volatile("mov %[exception], %%rax;"
47 "mov %[stacktrace], %%rdx;"
48 "mov %[pc], %%rbx;"
49 "mov %[fp], %%rcx;"
50 "mov %[sp], %%rdi;"
51 "mov %%rcx, %%rbp;"
52 "mov %%rdi, %%rsp;"
53 "jmp *%%rbx;"
54 :
55 : [exception] "m" (exception),
56 [stacktrace] "m" (stacktrace),
57 [pc] "m" (program_counter),
58 [sp] "m" (stack_pointer),
59 [fp] "m" (frame_pointer));
60 #endif
61 UNREACHABLE();
24 } 62 }
25 63
26 64
27 void CPU::JumpToUnhandledExceptionHandler( 65 void CPU::JumpToUnhandledExceptionHandler(
28 uword pc, 66 uword program_counter,
29 uword sp, 67 uword stack_pointer,
30 uword fp, 68 uword frame_pointer,
31 const UnhandledException& unhandled_exception) { 69 const UnhandledException& unhandled_exception_object) {
70 NoGCScope no_gc;
71 ASSERT(!unhandled_exception_object.IsNull());
72 RawUnhandledException* unhandled_exception = unhandled_exception_object.raw();
73
74 // Prepare for unwinding frames by destroying all the stack resources
75 // in the previous frames.
76 Isolate* isolate = Isolate::Current();
77 while (isolate->top_resource() != NULL &&
78 (reinterpret_cast<uword>(isolate->top_resource()) < stack_pointer)) {
79 isolate->top_resource()->~StackResource();
80 }
81
82 // Set up the unhandled exception object as the return value in EAX
Ivan Posva 2012/01/13 06:27:40 EAX -> RAX
regis 2012/01/13 18:57:31 Done.
83 // and continue from the invocation stub.
84 #if defined(TARGET_OS_WINDOWS)
32 UNIMPLEMENTED(); 85 UNIMPLEMENTED();
86 #else
87 asm volatile("mov %[unhandled_exception], %%rax;"
88 "mov %[pc], %%rbx;"
89 "mov %[fp], %%rcx;"
90 "mov %[sp], %%rdi;"
91 "mov %%rcx, %%rbp;"
92 "mov %%rdi, %%rsp;"
93 "jmp *%%rbx;"
94 :
95 : [unhandled_exception] "m" (unhandled_exception),
96 [pc] "m" (program_counter),
97 [sp] "m" (stack_pointer),
98 [fp] "m" (frame_pointer));
99 #endif
100 UNREACHABLE();
33 } 101 }
34 102
35 103
36 const char* CPU::Id() { 104 const char* CPU::Id() {
37 return "x64"; 105 return "x64";
38 } 106 }
39 107
40 } // namespace dart 108 } // namespace dart
41 109
42 #endif // defined TARGET_ARCH_X64 110 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698