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

Side by Side Diff: vm/intermediate_language.cc

Issue 10825035: Add an explicit push-argument instruction to the IL. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 intptr_t InstanceCallComp::InputCount() const { 119 intptr_t InstanceCallComp::InputCount() const {
120 return ArgumentCount(); 120 return ArgumentCount();
121 } 121 }
122 122
123 123
124 intptr_t StaticCallComp::InputCount() const { 124 intptr_t StaticCallComp::InputCount() const {
125 return ArgumentCount(); 125 return ArgumentCount();
126 } 126 }
127 127
128 128
129 intptr_t ClosureCallComp::InputCount() const {
130 return ArgumentCount();
131 }
132
133
134 intptr_t AllocateObjectComp::InputCount() const { 129 intptr_t AllocateObjectComp::InputCount() const {
135 return arguments().length(); 130 return arguments().length();
136 } 131 }
137 132
138 133
139 intptr_t AllocateObjectWithBoundsCheckComp::InputCount() const { 134 intptr_t AllocateObjectWithBoundsCheckComp::InputCount() const {
140 return arguments().length(); 135 return arguments().length();
141 } 136 }
142 137
143 138
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 UNREACHABLE(); 256 UNREACHABLE();
262 return NULL; 257 return NULL;
263 } 258 }
264 259
265 260
266 void GotoInstr::SetInputAt(intptr_t i, Value* value) { 261 void GotoInstr::SetInputAt(intptr_t i, Value* value) {
267 UNREACHABLE(); 262 UNREACHABLE();
268 } 263 }
269 264
270 265
266 intptr_t PushArgumentInstr::InputCount() const {
267 return 1;
268 }
269
270
271 Value* PushArgumentInstr::InputAt(intptr_t i) const {
272 if (i == 0) return value();
273 UNREACHABLE();
274 return NULL;
275 }
276
277
278 void PushArgumentInstr::SetInputAt(intptr_t i, Value* value) {
279 if (i == 0) {
280 value_ = value;
281 return;
282 }
283 UNREACHABLE();
284 }
285
286
271 intptr_t ReturnInstr::InputCount() const { 287 intptr_t ReturnInstr::InputCount() const {
272 return 1; 288 return 1;
273 } 289 }
274 290
275 291
276 Value* ReturnInstr::InputAt(intptr_t i) const { 292 Value* ReturnInstr::InputAt(intptr_t i) const {
277 if (i == 0) return value(); 293 if (i == 0) return value();
278 UNREACHABLE(); 294 UNREACHABLE();
279 return NULL; 295 return NULL;
280 } 296 }
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 __ j(true_condition, &load_true, Assembler::kNearJump); 1124 __ j(true_condition, &load_true, Assembler::kNearJump);
1109 __ LoadObject(result, compiler->bool_false()); 1125 __ LoadObject(result, compiler->bool_false());
1110 __ jmp(&done, Assembler::kNearJump); 1126 __ jmp(&done, Assembler::kNearJump);
1111 __ Bind(&load_true); 1127 __ Bind(&load_true);
1112 __ LoadObject(result, compiler->bool_true()); 1128 __ LoadObject(result, compiler->bool_true());
1113 __ Bind(&done); 1129 __ Bind(&done);
1114 } 1130 }
1115 1131
1116 1132
1117 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) { 1133 void ClosureCallComp::EmitNativeCode(FlowGraphCompiler* compiler) {
1118 ASSERT(VerifyCallComputation(this));
1119 // The arguments to the stub include the closure. The arguments 1134 // The arguments to the stub include the closure. The arguments
1120 // descriptor describes the closure's arguments (and so does not include 1135 // descriptor describes the closure's arguments (and so does not include
1121 // the closure). 1136 // the closure).
1122 Register temp_reg = locs()->temp(0).reg(); 1137 Register temp_reg = locs()->temp(0).reg();
1123 int argument_count = ArgumentCount(); 1138 int argument_count = ArgumentCount();
1124 const Array& arguments_descriptor = 1139 const Array& arguments_descriptor =
1125 DartEntry::ArgumentsDescriptor(argument_count - 1, 1140 DartEntry::ArgumentsDescriptor(argument_count - 1,
1126 argument_names()); 1141 argument_names());
1127 __ LoadObject(temp_reg, arguments_descriptor); 1142 __ LoadObject(temp_reg, arguments_descriptor);
1128 1143
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 const Function& closure_function = function(); 1312 const Function& closure_function = function();
1298 const Code& stub = Code::Handle( 1313 const Code& stub = Code::Handle(
1299 StubCode::GetAllocationStubForClosure(closure_function)); 1314 StubCode::GetAllocationStubForClosure(closure_function));
1300 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); 1315 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint());
1301 compiler->GenerateCall(token_pos(), try_index(), &label, 1316 compiler->GenerateCall(token_pos(), try_index(), &label,
1302 PcDescriptors::kOther); 1317 PcDescriptors::kOther);
1303 __ Drop(2); // Discard type arguments and receiver. 1318 __ Drop(2); // Discard type arguments and receiver.
1304 } 1319 }
1305 1320
1306 1321
1322 LocationSummary* PushArgumentInstr::MakeLocationSummary() const {
1323 const intptr_t kNumInputs = 1;
1324 const intptr_t kNumTemps= 0;
1325 LocationSummary* locs = new LocationSummary(kNumInputs, kNumTemps);
1326 // TODO(fschneider): Use Any() once it is supported by all code generators.
1327 locs->set_in(0, Location::RequiresRegister());
1328 return locs;
1329 }
1330
1331
1332 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1333 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode
1334 // where PushArgument is handled in FrameRegisterAllocator::AllocateRegisters.
1335 // Instead of popping the value it is left alone on the simulated frame
1336 // and materialized on the physical stack before the call.
1337 // TODO(fschneider): Avoid special-casing for SSA mode here.
1338 if (compiler->is_ssa()) {
1339 ASSERT(locs()->in(0).IsRegister());
1340 __ PushRegister(locs()->in(0).reg());
1341 }
1342 }
1343
1344
1307 #undef __ 1345 #undef __
1308 1346
1309 } // namespace dart 1347 } // namespace dart
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