| Index: runtime/vm/code_generator_x64.cc
|
| ===================================================================
|
| --- runtime/vm/code_generator_x64.cc (revision 4638)
|
| +++ runtime/vm/code_generator_x64.cc (working copy)
|
| @@ -699,9 +699,22 @@
|
| }
|
| __ LeaveFrame();
|
| __ ret();
|
| - // TODO(hausner): insert generation of of PcDescriptor::kReturn,
|
| - // analogous to 32bit version.
|
|
|
| + // Generate 8 bytes of NOPs so that the debugger can patch the
|
| + // return pattern with a call to the debug stub.
|
| + __ nop(1);
|
| + __ nop(1);
|
| + __ nop(1);
|
| + __ nop(1);
|
| + __ nop(1);
|
| + __ nop(1);
|
| + __ nop(1);
|
| + __ nop(1);
|
| + AddCurrentDescriptor(PcDescriptors::kReturn,
|
| + node->id(),
|
| + node->token_index());
|
| +
|
| +
|
| #ifdef DEBUG
|
| __ Bind(&wrong_stack);
|
| __ Stop("Exit stack size does not match the entry stack size.");
|
| @@ -807,7 +820,7 @@
|
| const Code& stub = Code::Handle(
|
| StubCode::GetAllocationStubForClosure(function));
|
| const ExternalLabel label(function.ToCString(), stub.EntryPoint());
|
| - GenerateCall(node->token_index(), &label);
|
| + GenerateCall(node->token_index(), &label, PcDescriptors::kOther);
|
| if (requires_type_arguments) {
|
| __ popq(RCX); // Pop type arguments.
|
| }
|
| @@ -848,7 +861,7 @@
|
| __ movq(R10, Immediate(num_context_variables));
|
| const ExternalLabel label("alloc_context",
|
| StubCode::AllocateContextEntryPoint());
|
| - GenerateCall(node_sequence->token_index(), &label);
|
| + GenerateCall(node_sequence->token_index(), &label, PcDescriptors::kOther);
|
|
|
| // Chain the new context in RAX to its parent in CTX.
|
| __ StoreIntoObject(RAX,
|
| @@ -929,7 +942,9 @@
|
| const AbstractTypeArguments& element_type = node->type_arguments();
|
| ASSERT(element_type.IsNull() || element_type.IsInstantiated());
|
| __ LoadObject(RBX, element_type);
|
| - GenerateCall(node->token_index(), &StubCode::AllocateArrayLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::AllocateArrayLabel(),
|
| + PcDescriptors::kOther);
|
|
|
| // Pop the element values from the stack into the array.
|
| __ leaq(RCX, FieldAddress(RAX, Array::data_offset()));
|
| @@ -2124,7 +2139,9 @@
|
| __ LoadObject(RBX, interpol_func);
|
| __ LoadObject(R10, ArgumentsDescriptor(interpol_arg->length(),
|
| interpol_arg->names()));
|
| - GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::CallStaticFunctionLabel(),
|
| + PcDescriptors::kOther);
|
| __ addq(RSP, Immediate(interpol_arg->length() * kWordSize));
|
| // Result is in RAX.
|
| if (IsResultNeeded(node)) {
|
| @@ -2161,7 +2178,9 @@
|
| __ LoadObject(RBX, node->function());
|
| __ LoadObject(R10, ArgumentsDescriptor(node->arguments()->length(),
|
| node->arguments()->names()));
|
| - GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::CallStaticFunctionLabel(),
|
| + PcDescriptors::kFuncCall);
|
| __ addq(RSP, Immediate(node->arguments()->length() * kWordSize));
|
| // Result is in RAX.
|
| if (IsResultNeeded(node)) {
|
| @@ -2186,7 +2205,9 @@
|
| // NOTE: The stub accesses the closure before the parameter list.
|
| __ LoadObject(R10, ArgumentsDescriptor(node->arguments()->length(),
|
| node->arguments()->names()));
|
| - GenerateCall(node->token_index(), &StubCode::CallClosureFunctionLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::CallClosureFunctionLabel(),
|
| + PcDescriptors::kOther);
|
| __ addq(RSP, Immediate((node->arguments()->length() + 1) * kWordSize));
|
| // Restore the context.
|
| __ popq(CTX);
|
| @@ -2331,7 +2352,9 @@
|
| __ LoadObject(RBX, node->constructor());
|
| __ LoadObject(R10, ArgumentsDescriptor(num_args,
|
| node->arguments()->names()));
|
| - GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::CallStaticFunctionLabel(),
|
| + PcDescriptors::kFuncCall);
|
| // Factory constructor returns object in RAX.
|
| __ addq(RSP, Immediate(num_args * kWordSize));
|
| if (IsResultNeeded(node)) {
|
| @@ -2348,7 +2371,7 @@
|
| // type arguments are on the stack.
|
| const Code& stub = Code::Handle(StubCode::GetAllocationStubForClass(cls));
|
| const ExternalLabel label(cls.ToCString(), stub.EntryPoint());
|
| - GenerateCall(node->token_index(), &label);
|
| + GenerateCall(node->token_index(), &label, PcDescriptors::kOther);
|
| if (requires_type_arguments) {
|
| __ popq(RCX); // Pop type arguments.
|
| __ popq(RCX); // Pop instantiator type arguments.
|
| @@ -2373,7 +2396,9 @@
|
| int num_args = node->arguments()->length() + 2;
|
| __ LoadObject(RBX, node->constructor());
|
| __ LoadObject(R10, ArgumentsDescriptor(num_args, node->arguments()->names()));
|
| - GenerateCall(node->token_index(), &StubCode::CallStaticFunctionLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::CallStaticFunctionLabel(),
|
| + PcDescriptors::kFuncCall);
|
| // Constructors do not return any value.
|
|
|
| // Pop out all the other arguments on the stack.
|
| @@ -2467,7 +2492,9 @@
|
| const int kNumberOfArguments = 0;
|
| const Array& kNoArgumentNames = Array::Handle();
|
| __ LoadObject(R10, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames));
|
| - GenerateCall(token_index, &StubCode::CallStaticFunctionLabel());
|
| + GenerateCall(token_index,
|
| + &StubCode::CallStaticFunctionLabel(),
|
| + PcDescriptors::kFuncCall);
|
| // No arguments were pushed, hence nothing to pop.
|
| }
|
|
|
| @@ -2495,7 +2522,9 @@
|
| const int kNumberOfArguments = 1; // value.
|
| const Array& kNoArgumentNames = Array::Handle();
|
| __ LoadObject(R10, ArgumentsDescriptor(kNumberOfArguments, kNoArgumentNames));
|
| - GenerateCall(token_index, &StubCode::CallStaticFunctionLabel());
|
| + GenerateCall(token_index,
|
| + &StubCode::CallStaticFunctionLabel(),
|
| + PcDescriptors::kFuncCall);
|
| __ addq(RSP, Immediate(kNumberOfArguments * kWordSize));
|
| }
|
|
|
| @@ -2528,7 +2557,9 @@
|
| }
|
| __ movq(RBX, Immediate(reinterpret_cast<uword>(node->native_c_function())));
|
| __ movq(R10, Immediate(node->argument_count()));
|
| - GenerateCall(node->token_index(), &StubCode::CallNativeCFunctionLabel());
|
| + GenerateCall(node->token_index(),
|
| + &StubCode::CallNativeCFunctionLabel(),
|
| + PcDescriptors::kOther);
|
| // Result is on the stack.
|
| if (!IsResultNeeded(node)) {
|
| __ popq(RAX);
|
| @@ -2654,9 +2685,10 @@
|
|
|
|
|
| void CodeGenerator::GenerateCall(intptr_t token_index,
|
| - const ExternalLabel* ext_label) {
|
| + const ExternalLabel* ext_label,
|
| + PcDescriptors::Kind desc_kind) {
|
| __ call(ext_label);
|
| - AddCurrentDescriptor(PcDescriptors::kOther, AstNode::kNoId, token_index);
|
| + AddCurrentDescriptor(desc_kind, AstNode::kNoId, token_index);
|
| }
|
|
|
|
|
|
|