Chromium Code Reviews| Index: runtime/vm/code_generator_x64.cc |
| =================================================================== |
| --- runtime/vm/code_generator_x64.cc (revision 4191) |
| +++ runtime/vm/code_generator_x64.cc (working copy) |
| @@ -787,9 +787,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); |
|
regis
2012/02/24 23:32:37
Why not __ nop(8)?
Disassembly would be more compa
hausner
2012/02/27 22:03:57
It's simpler to recognize the code pattern when I
|
| + AddCurrentDescriptor(PcDescriptors::kReturn, |
| + node->id(), |
| + node->token_index()); |
| + |
| + |
| #ifdef DEBUG |
| __ Bind(&wrong_stack); |
| __ Stop("Exit stack size does not match the entry stack size."); |
| @@ -895,7 +908,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. |
| } |
| @@ -937,7 +950,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, |
| @@ -1016,7 +1029,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())); |
| @@ -2220,7 +2235,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)) { |
| @@ -2257,7 +2274,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)) { |
| @@ -2282,7 +2301,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); |
| @@ -2427,7 +2448,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)) { |
| @@ -2444,7 +2467,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. |
| @@ -2469,7 +2492,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. |
| @@ -2563,7 +2588,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. |
| } |
| @@ -2591,7 +2618,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)); |
| } |
| @@ -2624,7 +2653,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); |
| @@ -2750,9 +2781,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); |
| } |