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

Unified Diff: vm/intermediate_language_x64.cc

Issue 10456012: Change three more instructions on x64 to use location-based codegen templates. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/intermediate_language_x64.cc
===================================================================
--- vm/intermediate_language_x64.cc (revision 8030)
+++ vm/intermediate_language_x64.cc (working copy)
@@ -375,32 +375,92 @@
LocationSummary* StoreIndexedComp::MakeLocationSummary() const {
- return NULL;
+ const intptr_t kNumInputs = 3;
+ return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister());
}
void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register receiver = locs()->in(0).reg();
Vyacheslav Egorov (Google) 2012/05/29 10:29:09 please add TODO to mark these instructions as doin
+ Register index = locs()->in(1).reg();
+ Register value = locs()->in(2).reg();
+ Register result = locs()->out().reg();
srdjan 2012/05/29 15:04:03 We can simplify the code by using (if needed) the
+
+ // Call operator []= but preserve the third argument value under the
+ // arguments as the result of the computation.
+ const String& function_name =
+ String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX)));
+
+ // Insert a copy of the value (third argument) under the arguments.
+ __ pushq(value);
+ __ pushq(receiver);
+ __ pushq(index);
+ __ pushq(value);
+ compiler->EmitInstanceCall(cid(),
+ token_index(),
+ try_index(),
+ function_name,
+ 3,
+ Array::ZoneHandle(),
+ 1);
+ __ popq(result);
}
LocationSummary* InstanceSetterComp::MakeLocationSummary() const {
+ const intptr_t kNumInputs = 2;
+ return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister());
return NULL;
}
void InstanceSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register receiver = locs()->in(0).reg();
+ Register value = locs()->in(1).reg();
+ Register result = locs()->out().reg();
+
+ // Preserve the value (second argument) under the arguments as the result
+ // of the computation, then call the setter.
+ const String& function_name =
+ String::ZoneHandle(Field::SetterSymbol(field_name()));
+
+ // Insert a copy of the second (last) argument under the arguments.
+ __ pushq(value);
+ __ pushq(receiver);
+ __ pushq(value);
+ compiler->EmitInstanceCall(cid(),
+ token_index(),
+ try_index(),
+ function_name,
+ 2,
+ Array::ZoneHandle(),
+ 1);
+ __ popq(result);
}
LocationSummary* StaticSetterComp::MakeLocationSummary() const {
- return NULL;
+ const intptr_t kNumInputs = 1;
+ return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister());
}
void StaticSetterComp::EmitNativeCode(FlowGraphCompiler* compiler) {
- UNIMPLEMENTED();
+ Register value = locs()->in(0).reg();
+ Register result = locs()->out().reg();
+
+ // Preserve the argument as the result of the computation,
+ // then call the setter.
+
+ // Duplicate the argument.
+ __ pushq(value);
+ __ pushq(value);
+ compiler->EmitStaticCall(token_index(),
+ try_index(),
+ setter_function(),
+ 1,
+ Array::ZoneHandle());
+ __ popq(result);
}
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698