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

Unified Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ARM working, x64 cleanup Created 5 years, 3 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
Index: runtime/vm/flow_graph_compiler_x64.cc
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 40143d4ce34c5fbad73c092ca410fbb3dc2480c4..db95c628f21cfad96d0d2c1c745354131b698722 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -187,6 +187,7 @@ void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler,
ASSERT(deopt_env() != NULL);
+ __ pushq(CODE_REG);
__ Call(*StubCode::Deoptimize_entry());
set_pc_offset(assem->CodeSize());
__ int3();
@@ -925,11 +926,8 @@ void FlowGraphCompiler::CopyParameters() {
__ Bind(&wrong_num_arguments);
if (function.IsClosureFunction()) {
- ASSERT(assembler()->constant_pool_allowed());
- __ LeaveDartFrame(); // The arguments are still on the stack.
- ASSERT(!assembler()->constant_pool_allowed());
- __ jmp(*StubCode::CallClosureNoSuchMethod_entry());
- __ set_constant_pool_allowed(true);
+ __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack.
+ __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
// The noSuchMethod call may return to the caller, but not here.
} else if (check_correct_named_args) {
__ Stop("Wrong arguments");
@@ -983,33 +981,24 @@ void FlowGraphCompiler::GenerateInlinedSetter(intptr_t offset) {
}
+static const Register new_pp = R13;
+
+
// NOTE: If the entry code shape changes, ReturnAddressLocator in profiler.cc
// needs to be updated to match.
void FlowGraphCompiler::EmitFrameEntry() {
- ASSERT(Assembler::EntryPointToPcMarkerOffset() == 0);
-
const Function& function = parsed_function().function();
- const Register new_pp = R13;
- const Register new_pc = R12;
-
- // Load PC marker.
- const intptr_t kRIPRelativeLeaqSize = 7;
- const intptr_t entry_to_rip_offset = __ CodeSize() + kRIPRelativeLeaqSize;
- __ leaq(new_pc, Address::AddressRIPRelative(-entry_to_rip_offset));
- ASSERT(__ CodeSize() == entry_to_rip_offset);
-
// Load pool pointer.
- const intptr_t object_pool_pc_dist =
- Instructions::HeaderSize() - Instructions::object_pool_offset();
- __ movq(new_pp, Address(new_pc, -object_pool_pc_dist));
if (flow_graph().IsCompiledForOsr()) {
intptr_t extra_slots = StackSize()
- flow_graph().num_stack_locals()
- flow_graph().num_copied_params();
ASSERT(extra_slots >= 0);
- __ EnterOsrFrame(extra_slots * kWordSize, new_pp, new_pc);
+ __ EnterOsrFrame(extra_slots * kWordSize);
} else {
+ __ LoadPoolPointer(new_pp);
+
if (CanOptimizeFunction() &&
function.IsOptimizable() &&
(!is_optimizing() || may_reoptimize())) {
@@ -1017,9 +1006,6 @@ void FlowGraphCompiler::EmitFrameEntry() {
// Load function object using the callee's pool pointer.
__ LoadFunctionFromCalleePool(function_reg, function, new_pp);
- // Patch point is after the eventually inlined function object.
- entry_patch_pc_offset_ = assembler()->CodeSize();
-
// Reoptimization of an optimized function is triggered by counting in
// IC stubs, but not at the entry of the function.
if (!is_optimizing()) {
@@ -1032,12 +1018,10 @@ void FlowGraphCompiler::EmitFrameEntry() {
__ J(GREATER_EQUAL,
*StubCode::OptimizeFunction_entry(),
new_pp);
- } else {
- entry_patch_pc_offset_ = assembler()->CodeSize();
}
ASSERT(StackSize() >= 0);
__ Comment("Enter frame");
- __ EnterDartFrame(StackSize() * kWordSize, new_pp, new_pc);
+ __ EnterDartFrame(StackSize() * kWordSize, new_pp);
}
}
@@ -1082,11 +1066,8 @@ void FlowGraphCompiler::CompileGraph() {
__ Bind(&wrong_num_arguments);
if (function.IsClosureFunction()) {
- ASSERT(assembler()->constant_pool_allowed());
- __ LeaveDartFrame(); // The arguments are still on the stack.
- ASSERT(!assembler()->constant_pool_allowed());
- __ jmp(*StubCode::CallClosureNoSuchMethod_entry());
- __ set_constant_pool_allowed(true);
+ __ LeaveDartFrame(kKeepCalleePP); // Leave arguments on the stack.
+ __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
// The noSuchMethod call may return to the caller, but not here.
} else {
__ Stop("Wrong number of arguments");
@@ -1150,10 +1131,6 @@ void FlowGraphCompiler::CompileGraph() {
GenerateDeferredCode();
// Emit function patching code. This will be swapped with the first 13 bytes
// at entry point.
- patch_code_pc_offset_ = assembler()->CodeSize();
- // This is patched up to a point in FrameEntry where the PP for the
- // current function is in R13 instead of PP.
- __ JmpPatchable(*StubCode::FixCallersTarget_entry(), R13);
if (is_optimizing()) {
lazy_deopt_pc_offset_ = assembler()->CodeSize();

Powered by Google App Engine
This is Rietveld 408576698