Index: runtime/vm/flow_graph_compiler_mips.cc |
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc |
index ded5e74c12e632b663b4cb5ed55dd739b94ddc3d..bf85e36d9fc094c4e9094b533c7432fce886e228 100644 |
--- a/runtime/vm/flow_graph_compiler_mips.cc |
+++ b/runtime/vm/flow_graph_compiler_mips.cc |
@@ -26,6 +26,18 @@ DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
DECLARE_FLAG(bool, use_megamorphic_stub); |
+void MegamorphicSlowPath::EmitNativeCode(FlowGraphCompiler* compiler) { |
+ Assembler* assem = compiler->assembler(); |
+#define __ assem-> |
+ __ Bind(entry_label()); |
+ __ Comment("MegamorphicSlowPath"); |
+ compiler->EmitMegamorphicInstanceCall(ic_data_, argument_count_, deopt_id_, |
+ token_pos_, locs_, try_index_); |
+ __ b(exit_label()); |
+#undef __ |
+} |
+ |
+ |
FlowGraphCompiler::~FlowGraphCompiler() { |
// BlockInfos are zone-allocated, so their destructors are not called. |
// Verify the labels explicitly here. |
@@ -1269,7 +1281,8 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
intptr_t argument_count, |
intptr_t deopt_id, |
intptr_t token_pos, |
- LocationSummary* locs) { |
+ LocationSummary* locs, |
+ intptr_t try_index) { |
const String& name = String::Handle(zone(), ic_data.target_name()); |
const Array& arguments_descriptor = |
Array::ZoneHandle(zone(), ic_data.arguments_descriptor()); |
@@ -1291,7 +1304,18 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
Thread::kNoDeoptId, token_pos); |
RecordSafepoint(locs); |
const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
- if (is_optimizing()) { |
+ if (Compiler::always_optimize()) { |
+ // Megamorphic calls may occur in slow path stubs. |
+ // If valid use try_index argument. |
+ if (try_index == CatchClauseNode::kInvalidTryIndex) { |
+ try_index = CurrentTryIndex(); |
+ } |
+ pc_descriptors_list()->AddDescriptor(RawPcDescriptors::kOther, |
+ assembler()->CodeSize(), |
+ Thread::kNoDeoptId, |
+ token_pos, |
+ try_index); |
+ } else if (is_optimizing()) { |
AddDeoptIndexAtCall(deopt_id_after, token_pos); |
} else { |
// Add deoptimization continuation point after the call and before the |