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

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

Issue 10453098: Move Throw and ReThrow to the location based code generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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) 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/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "lib/error.h" 8 #include "lib/error.h"
9 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/locations.h" 10 #include "vm/locations.h"
11 #include "vm/object_store.h" 11 #include "vm/object_store.h"
12 #include "vm/parser.h" 12 #include "vm/parser.h"
13 #include "vm/stub_code.h" 13 #include "vm/stub_code.h"
14 14
15 #define __ compiler->assembler()-> 15 #define __ compiler->assembler()->
16 16
17 namespace dart { 17 namespace dart {
18 18
19 19
20 static LocationSummary* MakeSimpleLocationSummary(
21 intptr_t input_count, Location out) {
22 LocationSummary* summary = new LocationSummary(input_count, 0);
23 for (intptr_t i = 0; i < input_count; i++) {
24 summary->set_in(i, Location::RequiresRegister());
25 }
26 summary->set_out(out);
27 return summary;
28 }
29
30
20 // True iff. the arguments to a call will be properly pushed and can 31 // True iff. the arguments to a call will be properly pushed and can
21 // be popped after the call. 32 // be popped after the call.
22 template <typename T> static bool VerifyCallComputation(T* comp) { 33 template <typename T> static bool VerifyCallComputation(T* comp) {
23 // Argument values should be consecutive temps. 34 // Argument values should be consecutive temps.
24 // 35 //
25 // TODO(kmillikin): implement stack height tracking so we can also assert 36 // TODO(kmillikin): implement stack height tracking so we can also assert
26 // they are on top of the stack. 37 // they are on top of the stack.
27 intptr_t previous = -1; 38 intptr_t previous = -1;
28 for (int i = 0; i < comp->ArgumentCount(); ++i) { 39 for (int i = 0; i < comp->ArgumentCount(); ++i) {
29 Value* val = comp->ArgumentAt(i); 40 Value* val = comp->ArgumentAt(i);
(...skipping 15 matching lines...) Expand all
45 v2->AsUse()->definition()->temp_index(); 56 v2->AsUse()->definition()->temp_index();
46 } 57 }
47 58
48 59
49 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 60 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
50 computation()->EmitNativeCode(compiler); 61 computation()->EmitNativeCode(compiler);
51 __ pushq(locs()->out().reg()); 62 __ pushq(locs()->out().reg());
52 } 63 }
53 64
54 65
55 static LocationSummary* MakeSimpleLocationSummary( 66 LocationSummary* ThrowInstr::MakeLocationSummary() {
56 intptr_t input_count, Location out) { 67 return new LocationSummary(0, 0);
57 LocationSummary* summary = new LocationSummary(input_count, 0);
58 for (intptr_t i = 0; i < input_count; i++) {
59 summary->set_in(i, Location::RequiresRegister());
60 }
61 summary->set_out(out);
62 return summary;
63 } 68 }
64 69
65 70
71 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
72 ASSERT(exception()->IsUse());
73 compiler->GenerateCallRuntime(cid(),
74 token_index(),
75 try_index(),
76 kThrowRuntimeEntry);
77 __ int3();
78 }
79
80
81 LocationSummary* ReThrowInstr::MakeLocationSummary() {
82 return new LocationSummary(0, 0);
83 }
84
85
86 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
87 ASSERT(exception()->IsUse());
88 ASSERT(stack_trace()->IsUse());
89 compiler->GenerateCallRuntime(cid(),
90 token_index(),
91 try_index(),
92 kReThrowRuntimeEntry);
93 __ int3();
94 }
95
96
66 LocationSummary* CurrentContextComp::MakeLocationSummary() const { 97 LocationSummary* CurrentContextComp::MakeLocationSummary() const {
67 return MakeSimpleLocationSummary(0, Location::RequiresRegister()); 98 return MakeSimpleLocationSummary(0, Location::RequiresRegister());
68 } 99 }
69 100
70 101
71 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) { 102 void CurrentContextComp::EmitNativeCode(FlowGraphCompiler* compiler) {
72 __ movq(locs()->out().reg(), CTX); 103 __ movq(locs()->out().reg(), CTX);
73 } 104 }
74 105
75 106
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 if (locs()->out().reg() != RAX) { 996 if (locs()->out().reg() != RAX) {
966 __ movq(locs()->out().reg(), RAX); 997 __ movq(locs()->out().reg(), RAX);
967 } 998 }
968 } 999 }
969 1000
970 } // namespace dart 1001 } // namespace dart
971 1002
972 #undef __ 1003 #undef __
973 1004
974 #endif // defined TARGET_ARCH_X64 1005 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intermediate_language.h ('K') | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698