Chromium Code Reviews| 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); |
| } |