| Index: src/ia32/deoptimizer-ia32.cc
|
| diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc
|
| index 8d9c6b25f73a439dc50629a82f5c0a3a4de48f7f..e4377ce6c7fd81ff2fc99549626ee43dcff92496 100644
|
| --- a/src/ia32/deoptimizer-ia32.cc
|
| +++ b/src/ia32/deoptimizer-ia32.cc
|
| @@ -573,13 +573,19 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
| // v +-------------------------+ +-------------------------|
|
| // | COMPILED_STUB marker | | STUB_FAILURE marker |
|
| // +-------------------------+ +-------------------------+
|
| - // | | | stub parameter 1 |
|
| + // | | | caller args.length_ |
|
| // | ... | +-------------------------+
|
| - // | | | ... |
|
| + // | | | caller args.arguments_ |
|
| // |-------------------------|<-esp +-------------------------+
|
| - // | stub parameter n |
|
| - // parameters in registers +-------------------------+<-esp
|
| - // and spilled to stack eax = number of parameters
|
| + // | caller args pointer |
|
| + // +-------------------------+
|
| + // | caller stack param 1 |
|
| + // parameters in registers +-------------------------+
|
| + // and spilled to stack | .... |
|
| + // +-------------------------+
|
| + // | caller stack param n |
|
| + // +-------------------------+<-esp
|
| + // eax = number of parameters
|
| // ebx = failure handler address
|
| // ebp = saved frame
|
| // esi = JSFunction context
|
| @@ -590,9 +596,15 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
| CodeStubInterfaceDescriptor* descriptor =
|
| isolate_->code_stub_interface_descriptor(major_key);
|
|
|
| + // The output frame must have room for all pushed register parameters
|
| + // and the standard stack frame slots.
|
| int output_frame_size = StandardFrameConstants::kFixedFrameSize +
|
| kPointerSize * descriptor->register_param_count_;
|
|
|
| + // Include space for an argument object to the callee and optionally
|
| + // the space to pass the argument object to the stub failure handler.
|
| + output_frame_size += sizeof(Arguments) + kPointerSize;
|
| +
|
| FrameDescription* output_frame =
|
| new(output_frame_size) FrameDescription(output_frame_size, 0);
|
| ASSERT(frame_index == 0);
|
| @@ -604,12 +616,15 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
| reinterpret_cast<intptr_t>(notify_failure->entry()));
|
|
|
| Code* trampoline = NULL;
|
| - StubFailureTrampolineStub().FindCodeInCache(&trampoline, isolate_);
|
| + int extra = descriptor->extra_expression_stack_count_;
|
| + StubFailureTrampolineStub(extra).FindCodeInCache(&trampoline, isolate_);
|
| ASSERT(trampoline != NULL);
|
| output_frame->SetPc(reinterpret_cast<intptr_t>(
|
| trampoline->instruction_start()));
|
| unsigned input_frame_size = input_->GetFrameSize();
|
|
|
| + intptr_t frame_ptr = input_->GetRegister(ebp.code());
|
| +
|
| // JSFunction continuation
|
| intptr_t input_frame_offset = input_frame_size - kPointerSize;
|
| intptr_t output_frame_offset = output_frame_size - kPointerSize;
|
| @@ -635,14 +650,35 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
| Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
|
| output_frame->SetFrameSlot(output_frame_offset, value);
|
|
|
| + int caller_arg_count = 0;
|
| + if (descriptor->stack_parameter_count_ != NULL) {
|
| + caller_arg_count =
|
| + input_->GetRegister(descriptor->stack_parameter_count_->code());
|
| + }
|
| +
|
| + // Build the Arguments object for the caller's parameters and a pointer to it.
|
| + output_frame_offset -= kPointerSize;
|
| + value = frame_ptr + StandardFrameConstants::kCallerSPOffset +
|
| + (caller_arg_count - 1) * kPointerSize;
|
| + output_frame->SetFrameSlot(output_frame_offset, value);
|
| +
|
| + output_frame->SetFrameSlot(output_frame_offset, value);
|
| + output_frame_offset -= kPointerSize;
|
| + output_frame->SetFrameSlot(output_frame_offset, caller_arg_count);
|
| +
|
| + value = frame_ptr - (output_frame_size - output_frame_offset) -
|
| + StandardFrameConstants::kMarkerOffset;
|
| + output_frame_offset -= kPointerSize;
|
| + output_frame->SetFrameSlot(output_frame_offset, value);
|
| +
|
| + // Copy the register parameters to the failure frame.
|
| for (int i = 0; i < descriptor->register_param_count_; ++i) {
|
| output_frame_offset -= kPointerSize;
|
| DoTranslateCommand(iterator, 0, output_frame_offset);
|
| }
|
|
|
| - value = input_->GetRegister(ebp.code());
|
| - output_frame->SetRegister(ebp.code(), value);
|
| - output_frame->SetFp(value);
|
| + output_frame->SetRegister(ebp.code(), frame_ptr);
|
| + output_frame->SetFp(frame_ptr);
|
|
|
| for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
|
| double double_value = input_->GetDoubleRegister(i);
|
| @@ -651,7 +687,11 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
|
|
| intptr_t handler =
|
| reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
|
| - output_frame->SetRegister(eax.code(), descriptor->register_param_count_);
|
| + int params = descriptor->register_param_count_;
|
| + if (descriptor->stack_parameter_count_ != NULL) {
|
| + params++;
|
| + }
|
| + output_frame->SetRegister(eax.code(), params);
|
| output_frame->SetRegister(ebx.code(), handler);
|
| }
|
|
|
|
|