| 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 a34bd263096b7ebfaa9f4ddb33060a5c8268261d..f9dea83f77303fabced6fc42b6ffbc5a8adf75d7 100644
|
| --- a/runtime/vm/flow_graph_compiler_mips.cc
|
| +++ b/runtime/vm/flow_graph_compiler_mips.cc
|
| @@ -96,11 +96,13 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
|
|
| Zone* zone = compiler->zone();
|
|
|
| + // Current PP, FP, and PC.
|
| builder->AddPp(current->function(), slot_ix++);
|
| - builder->AddPcMarker(Function::Handle(zone), slot_ix++);
|
| builder->AddCallerFp(slot_ix++);
|
| builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++);
|
|
|
| + // Callee's PC marker is not used anymore. Pass Code::null() to set to 0.
|
| + builder->AddPcMarker(Function::Handle(zone), slot_ix++);
|
|
|
| // Emit all values that are needed for materialization as a part of the
|
| // expression stack for the bottom-most frame. This guarantees that GC
|
| @@ -117,8 +119,8 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| Environment* previous = current;
|
| current = current->outer();
|
| while (current != NULL) {
|
| + // PP, FP, and PC.
|
| builder->AddPp(current->function(), slot_ix++);
|
| - builder->AddPcMarker(previous->function(), slot_ix++);
|
| builder->AddCallerFp(slot_ix++);
|
|
|
| // For any outer environment the deopt id is that of the call instruction
|
| @@ -128,6 +130,9 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| Isolate::ToDeoptAfter(current->deopt_id()),
|
| slot_ix++);
|
|
|
| + // PC marker.
|
| + builder->AddPcMarker(previous->function(), slot_ix++);
|
| +
|
| // The values of outgoing arguments can be changed from the inlined call so
|
| // we must read them from the previous environment.
|
| for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
|
| @@ -152,12 +157,14 @@ RawTypedData* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler,
|
| // The previous pointer is now the outermost environment.
|
| ASSERT(previous != NULL);
|
|
|
| - // Set slots for the outermost environment.
|
| + // For the outermost environment, set caller PC, caller PP, and caller FP.
|
| builder->AddCallerPp(slot_ix++);
|
| - builder->AddPcMarker(previous->function(), slot_ix++);
|
| builder->AddCallerFp(slot_ix++);
|
| builder->AddCallerPc(slot_ix++);
|
|
|
| + // PC marker.
|
| + builder->AddPcMarker(previous->function(), slot_ix++);
|
| +
|
| // For the outermost environment, set the incoming arguments.
|
| for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
|
| builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++);
|
| @@ -180,7 +187,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
|
| }
|
|
|
| ASSERT(deopt_env() != NULL);
|
| - __ Push(CODE_REG);
|
| +
|
| __ BranchLink(*StubCode::Deoptimize_entry());
|
| set_pc_offset(assem->CodeSize());
|
| #undef __
|
| @@ -921,7 +928,7 @@ void FlowGraphCompiler::CopyParameters() {
|
|
|
| __ Bind(&wrong_num_arguments);
|
| if (function.IsClosureFunction()) {
|
| - __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
|
| + __ LeaveDartFrame(); // The arguments are still on the stack.
|
| __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
|
| // The noSuchMethod call may return to the caller, but not here.
|
| } else if (check_correct_named_args) {
|
| @@ -979,9 +986,6 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) {
|
| }
|
|
|
|
|
| -static const Register new_pp = T7;
|
| -
|
| -
|
| void FlowGraphCompiler::EmitFrameEntry() {
|
| const Function& function = parsed_function().function();
|
| if (CanOptimizeFunction() &&
|
| @@ -989,10 +993,24 @@ void FlowGraphCompiler::EmitFrameEntry() {
|
| (!is_optimizing() || may_reoptimize())) {
|
| const Register function_reg = T0;
|
|
|
| + __ GetNextPC(T2, TMP);
|
| +
|
| + // Calculate offset of pool pointer from the PC.
|
| + const intptr_t object_pool_pc_dist =
|
| + Instructions::HeaderSize() - Instructions::object_pool_offset() +
|
| + assembler()->CodeSize() - 1 * Instr::kInstrSize;
|
| +
|
| + // Preserve PP of caller.
|
| + __ mov(T1, PP);
|
| // Temporarily setup pool pointer for this dart function.
|
| - __ LoadPoolPointer(new_pp);
|
| + __ lw(PP, Address(T2, -object_pool_pc_dist));
|
| // Load function object from object pool.
|
| - __ LoadFunctionFromCalleePool(function_reg, function, new_pp);
|
| + __ LoadObject(function_reg, function); // Uses PP.
|
| + // Restore PP of caller.
|
| + __ mov(PP, T1);
|
| +
|
| + // Patch point is after the eventually inlined function object.
|
| + entry_patch_pc_offset_ = assembler()->CodeSize();
|
|
|
| __ lw(T1, FieldAddress(function_reg, Function::usage_counter_offset()));
|
| // Reoptimization of an optimized function is triggered by counting in
|
| @@ -1008,9 +1026,12 @@ void FlowGraphCompiler::EmitFrameEntry() {
|
| T1, Immediate(GetOptimizationThreshold()), &dont_branch);
|
|
|
| ASSERT(function_reg == T0);
|
| - __ Branch(*StubCode::OptimizeFunction_entry(), new_pp);
|
| + __ Branch(*StubCode::OptimizeFunction_entry());
|
|
|
| __ Bind(&dont_branch);
|
| +
|
| + } else if (!flow_graph().IsCompiledForOsr()) {
|
| + entry_patch_pc_offset_ = assembler()->CodeSize();
|
| }
|
| __ Comment("Enter frame");
|
| if (flow_graph().IsCompiledForOsr()) {
|
| @@ -1071,7 +1092,7 @@ void FlowGraphCompiler::CompileGraph() {
|
| __ beq(T0, T1, &correct_num_arguments);
|
| __ Bind(&wrong_num_arguments);
|
| if (function.IsClosureFunction()) {
|
| - __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
|
| + __ LeaveDartFrame(); // The arguments are still on the stack.
|
| __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
|
| // The noSuchMethod call may return to the caller, but not here.
|
| } else {
|
| @@ -1124,6 +1145,10 @@ void FlowGraphCompiler::CompileGraph() {
|
|
|
| __ break_(0);
|
| GenerateDeferredCode();
|
| + // Emit function patching code. This will be swapped with the first 5 bytes
|
| + // at entry point.
|
| + patch_code_pc_offset_ = assembler()->CodeSize();
|
| + __ BranchPatchable(*StubCode::FixCallersTarget_entry());
|
|
|
| if (is_optimizing()) {
|
| lazy_deopt_pc_offset_ = assembler()->CodeSize();
|
|
|