Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: runtime/vm/flow_graph_compiler_mips.cc

Issue 1921893002: Faster code for megamorphic calls fo get:hashCode for Smi and OneByteString (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8e3bd7b227b2526bf2d3fe8f2cb86c12e1b4c71d..9fa5d9f31afd4d1d932ee5ba1c059f930732ef44 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -1327,7 +1327,28 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
MegamorphicCacheTable::Lookup(isolate(), name, arguments_descriptor));
__ Comment("MegamorphicCall");
+ // Load receiver into T0,
__ lw(T0, Address(SP, (argument_count - 1) * kWordSize));
+ Label done;
+ if (name.raw() == Symbols::hashCode().raw()) {
+ Label try_onebytestring, megamorphic_call;
+ __ Comment("Inlined get:hashCode for Smi and OneByteString");
+ __ andi(CMPRES1, T0, Immediate(kSmiTagMask));
+ __ bne(CMPRES1, ZR, &try_onebytestring); // Not Smi.
+ __ mov(V0, T0);
+ __ b(&done);
+
+ __ Bind(&try_onebytestring);
+ __ LoadClassId(CMPRES1, T0); // Class ID check.
+ __ BranchNotEqual(
+ CMPRES1, Immediate(kOneByteStringCid), &megamorphic_call);
+
+ __ lw(V0, FieldAddress(T0, String::hash_offset()));
+ __ bne(V0, ZR, &done);
+
+ __ Bind(&megamorphic_call);
+ __ Comment("Slow case: megamorphic call");
+ }
__ LoadObject(S5, cache);
if (FLAG_use_megamorphic_stub) {
__ BranchLink(*StubCode::MegamorphicLookup_entry());
@@ -1336,6 +1357,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
}
__ jalr(T1);
+ __ Bind(&done);
RecordSafepoint(locs, slow_path_argument_count);
const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
if (FLAG_precompiled_mode) {
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698