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

Unified Diff: runtime/vm/stub_code_mips.cc

Issue 1191813002: Port "Add flag to disable lazy compilation of invocation dispatchers." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_mips.cc
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index 80a336cc1b56abff633991638ab651ead10dad39..a65cb5b7b3b7267543ff933b434a72930d62fdf4 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -27,6 +27,7 @@ DEFINE_FLAG(bool, use_slow_path, false,
DECLARE_FLAG(bool, trace_optimized_ic_calls);
DECLARE_FLAG(int, optimization_counter_threshold);
DECLARE_FLAG(bool, support_debugger);
+DECLARE_FLAG(bool, lazy_dispatchers);
// Input parameters:
// RA : return address.
@@ -600,6 +601,41 @@ void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
}
+static void GenerateDispatcherCode(Assembler* assembler,
+ Label* call_target_function) {
+ __ Comment("NoSuchMethodDispatch");
+ // When lazily generated invocation dispatchers are disabled, the
+ // miss-handler may return null.
+ __ BranchNotEqual(T0, Object::null_object(), call_target_function);
+ __ EnterStubFrame();
+ // Load the receiver.
+ __ lw(A1, FieldAddress(S4, ArgumentsDescriptor::count_offset()));
+ __ sll(TMP, A1, 1); // A1 is a Smi.
+ __ addu(TMP, FP, TMP);
+ __ lw(T6, Address(TMP, kParamEndSlotFromFp * kWordSize));
+
+ // Push space for the return value.
+ // Push the receiver.
+ // Push IC data object.
+ // Push arguments descriptor array.
+ // Push original arguments array.
+ __ addiu(SP, SP, Immediate(-4 * kWordSize));
+ __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null()));
+ __ sw(TMP, Address(SP, 3 * kWordSize));
+ __ sw(T6, Address(SP, 2 * kWordSize));
+ __ sw(S5, Address(SP, 1 * kWordSize));
+ __ sw(S4, Address(SP, 0 * kWordSize));
+ // A1: Smi-tagged arguments array length.
+ PushArgumentsArray(assembler);
+ const intptr_t kNumArgs = 4;
+ __ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
+ __ lw(V0, Address(SP, 4 * kWordSize)); // Return value.
+ __ addiu(SP, SP, Immediate(5 * kWordSize));
+ __ LeaveStubFrame();
+ __ Ret();
+}
+
+
void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
__ EnterStubFrame();
@@ -633,6 +669,12 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
__ LeaveStubFrame();
+ if (!FLAG_lazy_dispatchers) {
+ Label call_target_function;
+ GenerateDispatcherCode(assembler, &call_target_function);
+ __ Bind(&call_target_function);
+ }
+
__ lw(T2, FieldAddress(T0, Function::instructions_offset()));
__ AddImmediate(T2, Instructions::HeaderSize() - kHeapObjectTag);
__ jr(T2);
@@ -1568,7 +1610,12 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(
__ LeaveStubFrame();
Label call_target_function;
- __ b(&call_target_function);
+ if (!FLAG_lazy_dispatchers) {
+ __ mov(T0, T3);
+ GenerateDispatcherCode(assembler, &call_target_function);
+ } else {
+ __ b(&call_target_function);
+ }
__ Bind(&found);
__ Comment("Update caller's counter");
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698