| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 | 438 |
| 439 // Optimize assignable type check by adding inlined tests for: | 439 // Optimize assignable type check by adding inlined tests for: |
| 440 // - NULL -> return NULL. | 440 // - NULL -> return NULL. |
| 441 // - Smi -> compile time subtype check (only if dst class is not parameterized). | 441 // - Smi -> compile time subtype check (only if dst class is not parameterized). |
| 442 // - Class equality (only if class is not parameterized). | 442 // - Class equality (only if class is not parameterized). |
| 443 // Inputs: | 443 // Inputs: |
| 444 // - RAX: object. | 444 // - RAX: object. |
| 445 // - RDX: instantiator type arguments or raw_null. | 445 // - RDX: instantiator type arguments or raw_null. |
| 446 // - RCX: instantiator or raw_null. | 446 // - RCX: instantiator or raw_null. |
| 447 // Destroys RCX and RDX. | |
| 448 // Returns: | 447 // Returns: |
| 449 // - object in RAX for successful assignable check (or throws TypeError). | 448 // - object in RAX for successful assignable check (or throws TypeError). |
| 450 // Performance notes: positive checks must be quick, negative checks can be slow | 449 // Performance notes: positive checks must be quick, negative checks can be slow |
| 451 // as they throw an exception. | 450 // as they throw an exception. |
| 452 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid, | 451 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid, |
| 453 intptr_t token_index, | 452 intptr_t token_index, |
| 454 intptr_t try_index, | 453 intptr_t try_index, |
| 455 const AbstractType& dst_type, | 454 const AbstractType& dst_type, |
| 456 const String& dst_name) { | 455 const String& dst_name) { |
| 457 ASSERT(FLAG_enable_type_checks); | 456 ASSERT(FLAG_enable_type_checks); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 } | 636 } |
| 638 __ jmp(&done, Assembler::kNearJump); | 637 __ jmp(&done, Assembler::kNearJump); |
| 639 | 638 |
| 640 __ Bind(&is_not_instance); | 639 __ Bind(&is_not_instance); |
| 641 __ LoadObject(RAX, negate_result ? bool_true : bool_false); | 640 __ LoadObject(RAX, negate_result ? bool_true : bool_false); |
| 642 __ jmp(&done, Assembler::kNearJump); | 641 __ jmp(&done, Assembler::kNearJump); |
| 643 | 642 |
| 644 __ Bind(&is_instance); | 643 __ Bind(&is_instance); |
| 645 __ LoadObject(RAX, negate_result ? bool_false : bool_true); | 644 __ LoadObject(RAX, negate_result ? bool_false : bool_true); |
| 646 __ Bind(&done); | 645 __ Bind(&done); |
| 647 __ popq(RDX); // Remove pushed instantiator type arguments.. | 646 __ popq(RDX); // Remove pushed instantiator type arguments. |
| 648 __ popq(RCX); // Remove pushed instantiator. | 647 __ popq(RCX); // Remove pushed instantiator. |
| 649 } | 648 } |
| 650 | 649 |
| 651 | 650 |
| 652 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { | 651 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
| 653 LocationSummary* locs = instr->locs(); | 652 LocationSummary* locs = instr->locs(); |
| 654 ASSERT(locs != NULL); | 653 ASSERT(locs != NULL); |
| 655 | 654 |
| 656 locs->AllocateRegisters(); | 655 locs->AllocateRegisters(); |
| 657 | 656 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 __ CallRuntime(entry); | 1033 __ CallRuntime(entry); |
| 1035 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); | 1034 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); |
| 1036 } | 1035 } |
| 1037 | 1036 |
| 1038 | 1037 |
| 1039 #undef __ | 1038 #undef __ |
| 1040 | 1039 |
| 1041 } // namespace dart | 1040 } // namespace dart |
| 1042 | 1041 |
| 1043 #endif // defined TARGET_ARCH_X64 | 1042 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |