| 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 "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 // Fall through if bool_register contains null. | 55 // Fall through if bool_register contains null. |
| 56 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, | 56 void FlowGraphCompiler::GenerateBoolToJump(Register bool_register, |
| 57 Label* is_true, | 57 Label* is_true, |
| 58 Label* is_false) { | 58 Label* is_false) { |
| 59 const Immediate raw_null = | 59 const Immediate raw_null = |
| 60 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 60 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 61 Label fall_through; | 61 Label fall_through; |
| 62 __ cmpq(bool_register, raw_null); | 62 __ cmpq(bool_register, raw_null); |
| 63 __ j(EQUAL, &fall_through, Assembler::kNearJump); | 63 __ j(EQUAL, &fall_through, Assembler::kNearJump); |
| 64 __ CompareObject(bool_register, bool_true()); | 64 __ CompareObject(bool_register, Bool::True()); |
| 65 __ j(EQUAL, is_true); | 65 __ j(EQUAL, is_true); |
| 66 __ jmp(is_false); | 66 __ jmp(is_false); |
| 67 __ Bind(&fall_through); | 67 __ Bind(&fall_through); |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 // Clobbers RCX. | 71 // Clobbers RCX. |
| 72 RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( | 72 RawSubtypeTestCache* FlowGraphCompiler::GenerateCallSubtypeTestStub( |
| 73 TypeTestStubKind test_kind, | 73 TypeTestStubKind test_kind, |
| 74 Register instance_reg, | 74 Register instance_reg, |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 __ pushq(RCX); // TODO(srdjan): Pass instantiator instead of null. | 489 __ pushq(RCX); // TODO(srdjan): Pass instantiator instead of null. |
| 490 __ pushq(RDX); // Instantiator type arguments. | 490 __ pushq(RDX); // Instantiator type arguments. |
| 491 __ LoadObject(RAX, test_cache); | 491 __ LoadObject(RAX, test_cache); |
| 492 __ pushq(RAX); | 492 __ pushq(RAX); |
| 493 GenerateCallRuntime(token_pos, kInstanceofRuntimeEntry, locs); | 493 GenerateCallRuntime(token_pos, kInstanceofRuntimeEntry, locs); |
| 494 // Pop the parameters supplied to the runtime entry. The result of the | 494 // Pop the parameters supplied to the runtime entry. The result of the |
| 495 // instanceof runtime call will be left as the result of the operation. | 495 // instanceof runtime call will be left as the result of the operation. |
| 496 __ Drop(5); | 496 __ Drop(5); |
| 497 if (negate_result) { | 497 if (negate_result) { |
| 498 __ popq(RDX); | 498 __ popq(RDX); |
| 499 __ LoadObject(RAX, bool_true()); | 499 __ LoadObject(RAX, Bool::True()); |
| 500 __ cmpq(RDX, RAX); | 500 __ cmpq(RDX, RAX); |
| 501 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 501 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 502 __ LoadObject(RAX, bool_false()); | 502 __ LoadObject(RAX, Bool::False()); |
| 503 } else { | 503 } else { |
| 504 __ popq(RAX); | 504 __ popq(RAX); |
| 505 } | 505 } |
| 506 __ jmp(&done, Assembler::kNearJump); | 506 __ jmp(&done, Assembler::kNearJump); |
| 507 } | 507 } |
| 508 __ Bind(&is_not_instance); | 508 __ Bind(&is_not_instance); |
| 509 __ LoadObject(RAX, negate_result ? bool_true() : bool_false()); | 509 __ LoadObject(RAX, negate_result ? Bool::True() : Bool::False()); |
| 510 __ jmp(&done, Assembler::kNearJump); | 510 __ jmp(&done, Assembler::kNearJump); |
| 511 | 511 |
| 512 __ Bind(&is_instance); | 512 __ Bind(&is_instance); |
| 513 __ LoadObject(RAX, negate_result ? bool_false() : bool_true()); | 513 __ LoadObject(RAX, negate_result ? Bool::False() : Bool::True()); |
| 514 __ Bind(&done); | 514 __ Bind(&done); |
| 515 __ popq(RDX); // Remove pushed instantiator type arguments. | 515 __ popq(RDX); // Remove pushed instantiator type arguments. |
| 516 __ popq(RCX); // Remove pushed instantiator. | 516 __ popq(RCX); // Remove pushed instantiator. |
| 517 } | 517 } |
| 518 | 518 |
| 519 | 519 |
| 520 // Optimize assignable type check by adding inlined tests for: | 520 // Optimize assignable type check by adding inlined tests for: |
| 521 // - NULL -> return NULL. | 521 // - NULL -> return NULL. |
| 522 // - Smi -> compile time subtype check (only if dst class is not parameterized). | 522 // - Smi -> compile time subtype check (only if dst class is not parameterized). |
| 523 // - Class equality (only if class is not parameterized). | 523 // - Class equality (only if class is not parameterized). |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 __ cmpq(Address(RSP, 0 * kWordSize), raw_null); | 1243 __ cmpq(Address(RSP, 0 * kWordSize), raw_null); |
| 1244 __ j(EQUAL, &check_identity, Assembler::kNearJump); | 1244 __ j(EQUAL, &check_identity, Assembler::kNearJump); |
| 1245 __ cmpq(Address(RSP, 1 * kWordSize), raw_null); | 1245 __ cmpq(Address(RSP, 1 * kWordSize), raw_null); |
| 1246 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); | 1246 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); |
| 1247 | 1247 |
| 1248 __ Bind(&check_identity); | 1248 __ Bind(&check_identity); |
| 1249 __ popq(result); | 1249 __ popq(result); |
| 1250 __ cmpq(result, Address(RSP, 0 * kWordSize)); | 1250 __ cmpq(result, Address(RSP, 0 * kWordSize)); |
| 1251 Label is_false; | 1251 Label is_false; |
| 1252 __ j(NOT_EQUAL, &is_false, Assembler::kNearJump); | 1252 __ j(NOT_EQUAL, &is_false, Assembler::kNearJump); |
| 1253 __ LoadObject(result, bool_true()); | 1253 __ LoadObject(result, Bool::True()); |
| 1254 __ Drop(1); | 1254 __ Drop(1); |
| 1255 __ jmp(skip_call); | 1255 __ jmp(skip_call); |
| 1256 __ Bind(&is_false); | 1256 __ Bind(&is_false); |
| 1257 __ LoadObject(result, bool_false()); | 1257 __ LoadObject(result, Bool::False()); |
| 1258 __ Drop(1); | 1258 __ Drop(1); |
| 1259 __ jmp(skip_call); | 1259 __ jmp(skip_call); |
| 1260 __ Bind(&fall_through); | 1260 __ Bind(&fall_through); |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 | 1263 |
| 1264 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, | 1264 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, |
| 1265 Register reg, | 1265 Register reg, |
| 1266 Register temp, | 1266 Register temp, |
| 1267 Label* not_double_or_smi) { | 1267 Label* not_double_or_smi) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { | 1477 void ParallelMoveResolver::Exchange(const Address& mem1, const Address& mem2) { |
| 1478 __ Exchange(mem1, mem2); | 1478 __ Exchange(mem1, mem2); |
| 1479 } | 1479 } |
| 1480 | 1480 |
| 1481 | 1481 |
| 1482 #undef __ | 1482 #undef __ |
| 1483 | 1483 |
| 1484 } // namespace dart | 1484 } // namespace dart |
| 1485 | 1485 |
| 1486 #endif // defined TARGET_ARCH_X64 | 1486 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |