| OLD | NEW |
| 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" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 compiler->GenerateCall(token_index(), | 369 compiler->GenerateCall(token_index(), |
| 370 try_index(), | 370 try_index(), |
| 371 &StubCode::CallNativeCFunctionLabel(), | 371 &StubCode::CallNativeCFunctionLabel(), |
| 372 PcDescriptors::kOther); | 372 PcDescriptors::kOther); |
| 373 __ popq(RAX); | 373 __ popq(RAX); |
| 374 } | 374 } |
| 375 | 375 |
| 376 | 376 |
| 377 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { | 377 LocationSummary* StoreIndexedComp::MakeLocationSummary() const { |
| 378 const intptr_t kNumInputs = 3; | 378 const intptr_t kNumInputs = 3; |
| 379 return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister()); | 379 return MakeSimpleLocationSummary(kNumInputs, Location::NoLocation()); |
| 380 } | 380 } |
| 381 | 381 |
| 382 | 382 |
| 383 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { | 383 void StoreIndexedComp::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 384 Register receiver = locs()->in(0).reg(); | 384 Register receiver = locs()->in(0).reg(); |
| 385 Register index = locs()->in(1).reg(); | 385 Register index = locs()->in(1).reg(); |
| 386 Register value = locs()->in(2).reg(); | 386 Register value = locs()->in(2).reg(); |
| 387 Register result = locs()->out().reg(); | |
| 388 | 387 |
| 389 // Call operator []= but preserve the third argument value under the | |
| 390 // arguments as the result of the computation. | |
| 391 const String& function_name = | 388 const String& function_name = |
| 392 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX))); | 389 String::ZoneHandle(String::NewSymbol(Token::Str(Token::kASSIGN_INDEX))); |
| 393 | 390 |
| 394 // Insert a copy of the value (third argument) under the arguments. | |
| 395 // TODO(fschneider): Avoid preserving the value if the result is not used. | |
| 396 __ pushq(value); | |
| 397 __ pushq(receiver); | 391 __ pushq(receiver); |
| 398 __ pushq(index); | 392 __ pushq(index); |
| 399 __ pushq(value); | 393 __ pushq(value); |
| 394 const intptr_t kNumArguments = 3; |
| 395 const intptr_t kNumArgsChecked = 1; // Type-feedback. |
| 400 compiler->EmitInstanceCall(cid(), | 396 compiler->EmitInstanceCall(cid(), |
| 401 token_index(), | 397 token_index(), |
| 402 try_index(), | 398 try_index(), |
| 403 function_name, | 399 function_name, |
| 404 3, | 400 kNumArguments, |
| 405 Array::ZoneHandle(), | 401 Array::ZoneHandle(), // No optional arguments. |
| 406 1); | 402 kNumArgsChecked); |
| 407 __ popq(result); | |
| 408 } | 403 } |
| 409 | 404 |
| 410 | 405 |
| 411 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { | 406 LocationSummary* InstanceSetterComp::MakeLocationSummary() const { |
| 412 const intptr_t kNumInputs = 2; | 407 const intptr_t kNumInputs = 2; |
| 413 return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister()); | 408 return MakeSimpleLocationSummary(kNumInputs, Location::RequiresRegister()); |
| 414 return NULL; | 409 return NULL; |
| 415 } | 410 } |
| 416 | 411 |
| 417 | 412 |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 if (locs()->out().reg() != RAX) { | 1063 if (locs()->out().reg() != RAX) { |
| 1069 __ movq(locs()->out().reg(), RAX); | 1064 __ movq(locs()->out().reg(), RAX); |
| 1070 } | 1065 } |
| 1071 } | 1066 } |
| 1072 | 1067 |
| 1073 } // namespace dart | 1068 } // namespace dart |
| 1074 | 1069 |
| 1075 #undef __ | 1070 #undef __ |
| 1076 | 1071 |
| 1077 #endif // defined TARGET_ARCH_X64 | 1072 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |