| 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 457 |
| 458 | 458 |
| 459 // Optimize assignable type check by adding inlined tests for: | 459 // Optimize assignable type check by adding inlined tests for: |
| 460 // - NULL -> return NULL. | 460 // - NULL -> return NULL. |
| 461 // - Smi -> compile time subtype check (only if dst class is not parameterized). | 461 // - Smi -> compile time subtype check (only if dst class is not parameterized). |
| 462 // - Class equality (only if class is not parameterized). | 462 // - Class equality (only if class is not parameterized). |
| 463 // Inputs: | 463 // Inputs: |
| 464 // - RAX: object. | 464 // - RAX: object. |
| 465 // - RDX: instantiator type arguments or raw_null. | 465 // - RDX: instantiator type arguments or raw_null. |
| 466 // - RCX: instantiator or raw_null. | 466 // - RCX: instantiator or raw_null. |
| 467 // Destroys RCX and RDX. | |
| 468 // Returns: | 467 // Returns: |
| 469 // - object in RAX for successful assignable check (or throws TypeError). | 468 // - object in RAX for successful assignable check (or throws TypeError). |
| 470 // Performance notes: positive checks must be quick, negative checks can be slow | 469 // Performance notes: positive checks must be quick, negative checks can be slow |
| 471 // as they throw an exception. | 470 // as they throw an exception. |
| 472 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid, | 471 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t cid, |
| 473 intptr_t token_index, | 472 intptr_t token_index, |
| 474 intptr_t try_index, | 473 intptr_t try_index, |
| 475 const AbstractType& dst_type, | 474 const AbstractType& dst_type, |
| 476 const String& dst_name) { | 475 const String& dst_name) { |
| 477 ASSERT(FLAG_enable_type_checks); | 476 ASSERT(FLAG_enable_type_checks); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 } | 684 } |
| 686 __ jmp(&done, Assembler::kNearJump); | 685 __ jmp(&done, Assembler::kNearJump); |
| 687 | 686 |
| 688 __ Bind(&is_not_instance); | 687 __ Bind(&is_not_instance); |
| 689 __ LoadObject(RAX, negate_result ? bool_true : bool_false); | 688 __ LoadObject(RAX, negate_result ? bool_true : bool_false); |
| 690 __ jmp(&done, Assembler::kNearJump); | 689 __ jmp(&done, Assembler::kNearJump); |
| 691 | 690 |
| 692 __ Bind(&is_instance); | 691 __ Bind(&is_instance); |
| 693 __ LoadObject(RAX, negate_result ? bool_false : bool_true); | 692 __ LoadObject(RAX, negate_result ? bool_false : bool_true); |
| 694 __ Bind(&done); | 693 __ Bind(&done); |
| 695 __ popq(RDX); // Remove pushed instantiator type arguments.. | 694 __ popq(RDX); // Remove pushed instantiator type arguments. |
| 696 __ popq(RCX); // Remove pushed instantiator. | 695 __ popq(RCX); // Remove pushed instantiator. |
| 697 } | 696 } |
| 698 | 697 |
| 699 | 698 |
| 700 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { | 699 void FlowGraphCompiler::EmitInstructionPrologue(Instruction* instr) { |
| 701 LocationSummary* locs = instr->locs(); | 700 LocationSummary* locs = instr->locs(); |
| 702 ASSERT(locs != NULL); | 701 ASSERT(locs != NULL); |
| 703 | 702 |
| 704 locs->AllocateRegisters(); | 703 locs->AllocateRegisters(); |
| 705 | 704 |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 | 1131 |
| 1133 void FlowGraphCompiler::FinalizeComments(const Code& code) { | 1132 void FlowGraphCompiler::FinalizeComments(const Code& code) { |
| 1134 code.set_comments(assembler()->GetCodeComments()); | 1133 code.set_comments(assembler()->GetCodeComments()); |
| 1135 } | 1134 } |
| 1136 | 1135 |
| 1137 #undef __ | 1136 #undef __ |
| 1138 | 1137 |
| 1139 } // namespace dart | 1138 } // namespace dart |
| 1140 | 1139 |
| 1141 #endif // defined TARGET_ARCH_X64 | 1140 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |