Chromium Code Reviews| Index: runtime/vm/flow_graph_compiler_arm.cc |
| diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc |
| index 787b5139a7dfc4e8770a729a4800949564330b3b..54b395da8601e5e907bad9c08d80dba114501d41 100644 |
| --- a/runtime/vm/flow_graph_compiler_arm.cc |
| +++ b/runtime/vm/flow_graph_compiler_arm.cc |
| @@ -1319,7 +1319,28 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor)); |
| __ Comment("MegamorphicCall"); |
| + // Load receiver into R0. |
| __ LoadFromOffset(kWord, R0, SP, (argument_count - 1) * kWordSize); |
| + Label done; |
| + if (name.raw() == Symbols::hashCode().raw()) { |
| + Label megamorphic_call; |
| + __ Comment("Inlined get:hashCode for Smi and OneByteString"); |
| + __ tst(R0, Operand(kSmiTagMask)); |
| + __ b(&done, EQ); // Is Smi. |
|
rmacnak
2016/04/25 22:47:10
// Is Smi (result is receiver).
srdjan
2016/04/25 23:44:49
Done.
|
| + |
| + // Use R9 (cache for megamorphic call) as scratch. |
| + __ CompareClassId(R0, kOneByteStringCid, R9); |
| + __ b(&megamorphic_call, NE); |
| + |
| + __ mov(R9, Operand(R0)); // Preserve receiver in R9. |
| + __ ldr(R0, FieldAddress(R0, String::hash_offset())); |
| + __ cmp(R0, Operand(0)); |
|
rmacnak
2016/04/25 22:47:10
ASSERT(Smi::New(0) == 0);
srdjan
2016/04/25 23:44:49
Done.
|
| + __ b(&done, NE); // Return if already computed. |
| + __ mov(R0, Operand(R9)); // Restore receiver in R0. |
| + |
| + __ Bind(&megamorphic_call); |
| + __ Comment("Slow case: megamorphic call"); |
| + } |
| __ LoadObject(R9, cache); |
| if (FLAG_use_megamorphic_stub) { |
| __ BranchLink(*StubCode::MegamorphicLookup_entry()); |
| @@ -1328,6 +1349,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall( |
| } |
| __ blx(R1); |
| + __ Bind(&done); |
| RecordSafepoint(locs, slow_path_argument_count); |
| const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id); |
| if (FLAG_precompiled_mode) { |