| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| 11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
| 14 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
| 15 #include "vm/instructions.h" | 15 #include "vm/instructions.h" |
| 16 #include "vm/locations.h" | 16 #include "vm/locations.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 19 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
| 20 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 26 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 26 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
| 27 DECLARE_FLAG(bool, enable_simd_inline); | 27 DECLARE_FLAG(bool, enable_simd_inline); |
| 28 DECLARE_FLAG(bool, use_megamorphic_stub); | 28 |
| 29 | 29 |
| 30 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 30 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 31 Assembler* assembler = compiler->assembler(); | 31 Assembler* assembler = compiler->assembler(); |
| 32 #define __ assembler-> | 32 #define __ assembler-> |
| 33 __ Bind(entry_label()); | 33 __ Bind(entry_label()); |
| 34 __ Comment("MegamorphicSlowPath"); | 34 __ Comment("MegamorphicSlowPath"); |
| 35 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 35 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 36 token_pos_, locs_, try_index_); | 36 token_pos_, locs_, try_index_); |
| 37 __ jmp(exit_label()); | 37 __ jmp(exit_label()); |
| 38 #undef __ | 38 #undef __ |
| (...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 __ CompareClassId(RDI, kOneByteStringCid); | 1341 __ CompareClassId(RDI, kOneByteStringCid); |
| 1342 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump); | 1342 __ j(NOT_EQUAL, &megamorphic_call, Assembler::kNearJump); |
| 1343 __ movq(RAX, FieldAddress(RDI, String::hash_offset())); | 1343 __ movq(RAX, FieldAddress(RDI, String::hash_offset())); |
| 1344 __ cmpq(RAX, Immediate(0)); | 1344 __ cmpq(RAX, Immediate(0)); |
| 1345 __ j(NOT_EQUAL, &done, Assembler::kNearJump); | 1345 __ j(NOT_EQUAL, &done, Assembler::kNearJump); |
| 1346 | 1346 |
| 1347 __ Bind(&megamorphic_call); | 1347 __ Bind(&megamorphic_call); |
| 1348 __ Comment("Slow case: megamorphic call"); | 1348 __ Comment("Slow case: megamorphic call"); |
| 1349 } | 1349 } |
| 1350 __ LoadObject(RBX, cache); | 1350 __ LoadObject(RBX, cache); |
| 1351 if (FLAG_use_megamorphic_stub) { | 1351 __ call(Address(THR, Thread::megamorphic_lookup_entry_point_offset())); |
| 1352 __ call(Address(THR, Thread::megamorphic_lookup_entry_point_offset())); | |
| 1353 } else { | |
| 1354 StubCode::EmitMegamorphicLookup(assembler()); | |
| 1355 } | |
| 1356 __ call(RCX); | 1352 __ call(RCX); |
| 1357 | 1353 |
| 1358 __ Bind(&done); | 1354 __ Bind(&done); |
| 1359 RecordSafepoint(locs, slow_path_argument_count); | 1355 RecordSafepoint(locs, slow_path_argument_count); |
| 1360 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1356 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1361 if (FLAG_precompiled_mode) { | 1357 if (FLAG_precompiled_mode) { |
| 1362 // Megamorphic calls may occur in slow path stubs. | 1358 // Megamorphic calls may occur in slow path stubs. |
| 1363 // If valid use try_index argument. | 1359 // If valid use try_index argument. |
| 1364 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1360 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1365 try_index = CurrentTryIndex(); | 1361 try_index = CurrentTryIndex(); |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 __ movups(reg, Address(RSP, 0)); | 1863 __ movups(reg, Address(RSP, 0)); |
| 1868 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1864 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
| 1869 } | 1865 } |
| 1870 | 1866 |
| 1871 | 1867 |
| 1872 #undef __ | 1868 #undef __ |
| 1873 | 1869 |
| 1874 } // namespace dart | 1870 } // namespace dart |
| 1875 | 1871 |
| 1876 #endif // defined TARGET_ARCH_X64 | 1872 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |