| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 DECLARE_FLAG(bool, use_megamorphic_stub); | |
| 27 | 26 |
| 28 | 27 |
| 29 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { | 28 void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 30 Assembler* assembler = compiler->assembler(); | 29 Assembler* assembler = compiler->assembler(); |
| 31 #define __ assembler-> | 30 #define __ assembler-> |
| 32 __ Bind(entry_label()); | 31 __ Bind(entry_label()); |
| 33 __ Comment("MegamorphicSlowPath"); | 32 __ Comment("MegamorphicSlowPath"); |
| 34 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, | 33 compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
| 35 token_pos_, locs_, try_index_); | 34 token_pos_, locs_, try_index_); |
| 36 __ b(exit_label()); | 35 __ b(exit_label()); |
| (...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 __ BranchNotEqual( | 1341 __ BranchNotEqual( |
| 1343 CMPRES1, Immediate(kOneByteStringCid), &megamorphic_call); | 1342 CMPRES1, Immediate(kOneByteStringCid), &megamorphic_call); |
| 1344 | 1343 |
| 1345 __ lw(V0, FieldAddress(T0, String::hash_offset())); | 1344 __ lw(V0, FieldAddress(T0, String::hash_offset())); |
| 1346 __ bne(V0, ZR, &done); | 1345 __ bne(V0, ZR, &done); |
| 1347 | 1346 |
| 1348 __ Bind(&megamorphic_call); | 1347 __ Bind(&megamorphic_call); |
| 1349 __ Comment("Slow case: megamorphic call"); | 1348 __ Comment("Slow case: megamorphic call"); |
| 1350 } | 1349 } |
| 1351 __ LoadObject(S5, cache); | 1350 __ LoadObject(S5, cache); |
| 1352 if (FLAG_use_megamorphic_stub) { | 1351 __ lw(T9, Address(THR, Thread::megamorphic_lookup_entry_point_offset())); |
| 1353 __ lw(T9, Address(THR, Thread::megamorphic_lookup_entry_point_offset())); | 1352 __ jalr(T9); |
| 1354 __ jalr(T9); | |
| 1355 } else { | |
| 1356 StubCode::EmitMegamorphicLookup(assembler()); | |
| 1357 } | |
| 1358 __ jalr(T1); | 1353 __ jalr(T1); |
| 1359 | 1354 |
| 1360 __ Bind(&done); | 1355 __ Bind(&done); |
| 1361 RecordSafepoint(locs, slow_path_argument_count); | 1356 RecordSafepoint(locs, slow_path_argument_count); |
| 1362 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); | 1357 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| 1363 if (FLAG_precompiled_mode) { | 1358 if (FLAG_precompiled_mode) { |
| 1364 // Megamorphic calls may occur in slow path stubs. | 1359 // Megamorphic calls may occur in slow path stubs. |
| 1365 // If valid use try_index argument. | 1360 // If valid use try_index argument. |
| 1366 if (try_index == CatchClauseNode::kInvalidTryIndex) { | 1361 if (try_index == CatchClauseNode::kInvalidTryIndex) { |
| 1367 try_index = CurrentTryIndex(); | 1362 try_index = CurrentTryIndex(); |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1962 __ AddImmediate(SP, kDoubleSize); | 1957 __ AddImmediate(SP, kDoubleSize); |
| 1963 } | 1958 } |
| 1964 | 1959 |
| 1965 | 1960 |
| 1966 #undef __ | 1961 #undef __ |
| 1967 | 1962 |
| 1968 | 1963 |
| 1969 } // namespace dart | 1964 } // namespace dart |
| 1970 | 1965 |
| 1971 #endif // defined TARGET_ARCH_MIPS | 1966 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |