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

Side by Side Diff: vm/intermediate_language_x64.cc

Issue 10392191: Reverting r7833 because of failing compilation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | « vm/intermediate_language.h ('k') | no next file » | 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/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 "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 #include "vm/locations.h" 9 #include "vm/locations.h"
10 #include "vm/stub_code.h"
11 10
12 #define __ compiler->assembler()-> 11 #define __ compiler->assembler()->
13 12
14 namespace dart { 13 namespace dart {
15 14
16 15
17 // True iff. the arguments to a call will be properly pushed and can
18 // be popped after the call.
19 template <typename T> static bool VerifyCallComputation(T* comp) {
20 // Argument values should be consecutive temps.
21 //
22 // TODO(kmillikin): implement stack height tracking so we can also assert
23 // they are on top of the stack.
24 intptr_t previous = -1;
25 for (int i = 0; i < comp->ArgumentCount(); ++i) {
26 Value* val = comp->ArgumentAt(i);
27 if (!val->IsUse()) return false;
28 intptr_t current = val->AsUse()->definition()->temp_index();
29 if (i != 0) {
30 if (current != (previous + 1)) return false;
31 }
32 previous = current;
33 }
34 return true;
35 }
36
37
38 static LocationSummary* MakeSimpleLocationSummary( 16 static LocationSummary* MakeSimpleLocationSummary(
39 intptr_t input_count, Location out) { 17 intptr_t input_count, Location out) {
40 LocationSummary* summary = new LocationSummary(input_count); 18 LocationSummary* summary = new LocationSummary(input_count);
41 for (intptr_t i = 0; i < input_count; i++) { 19 for (intptr_t i = 0; i < input_count; i++) {
42 summary->set_in(i, Location::RequiresRegister()); 20 summary->set_in(i, Location::RequiresRegister());
43 } 21 }
44 summary->set_out(out); 22 summary->set_out(out);
45 return summary; 23 return summary;
46 } 24 }
47 25
(...skipping 19 matching lines...) Expand all
67 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump); 45 __ j(NOT_EQUAL, &load_true, Assembler::kNearJump);
68 } 46 }
69 __ LoadObject(result, bool_false); 47 __ LoadObject(result, bool_false);
70 __ jmp(&done, Assembler::kNearJump); 48 __ jmp(&done, Assembler::kNearJump);
71 __ Bind(&load_true); 49 __ Bind(&load_true);
72 __ LoadObject(result, bool_true); 50 __ LoadObject(result, bool_true);
73 __ Bind(&done); 51 __ Bind(&done);
74 } 52 }
75 53
76 54
77 // Generic summary for call instructions that have all arguments pushed
78 // on the stack and return the result in a fixed register RAX.
79 static LocationSummary* MakeCallSummary() {
80 LocationSummary* result = new LocationSummary(0);
81 result->set_out(Location::RegisterLocation(RAX));
82 return result;
83 }
84
85
86 LocationSummary* ClosureCallComp::MakeLocationSummary() {
87 return MakeCallSummary();
88 }
89
90
91 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
92 ASSERT(VerifyCallComputation(this));
93 // The arguments to the stub include the closure. The arguments
94 // descriptor describes the closure's arguments (and so does not include
95 // the closure).
96 int argument_count = ArgumentCount();
97 const Array& arguments_descriptor =
98 CodeGenerator::ArgumentsDescriptor(argument_count - 1,
99 argument_names());
100 __ LoadObject(R10, arguments_descriptor);
101
102 compiler->GenerateCall(token_index(),
103 try_index(),
104 &StubCode::CallClosureFunctionLabel(),
105 PcDescriptors::kOther);
106 __ Drop(argument_count);
107 }
108
109
110 LocationSummary* InstanceCallComp::MakeLocationSummary() {
111 return MakeCallSummary();
112 }
113
114
115 void InstanceCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
116 ASSERT(VerifyCallComputation(this));
117 compiler->EmitInstanceCall(cid(),
118 token_index(),
119 try_index(),
120 function_name(),
121 ArgumentCount(),
122 argument_names(),
123 checked_argument_count());
124 }
125
126
127 LocationSummary* StaticCallComp::MakeLocationSummary() {
128 return MakeCallSummary();
129 }
130
131
132 void StaticCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
133 ASSERT(VerifyCallComputation(this));
134 compiler->EmitStaticCall(token_index(),
135 try_index(),
136 function(),
137 ArgumentCount(),
138 argument_names());
139 }
140
141
142 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 55 void BindInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
143 computation()->EmitNativeCode(compiler); 56 computation()->EmitNativeCode(compiler);
144 __ pushq(locs()->out().reg()); 57 __ pushq(locs()->out().reg());
145 } 58 }
146 59
147 60
148 } // namespace dart 61 } // namespace dart
149 62
150 #undef __ 63 #undef __
151 64
152 #endif // defined TARGET_ARCH_X64 65 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698