Chromium Code Reviews| Index: src/ia32/deoptimizer-ia32.cc |
| diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc |
| index fc324d2f8650e5b83a396600792daaa411454af8..c0e8a9e4a3b6305ddd26985d3002a208257402f3 100644 |
| --- a/src/ia32/deoptimizer-ia32.cc |
| +++ b/src/ia32/deoptimizer-ia32.cc |
| @@ -694,6 +694,114 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, |
| } |
| +void Deoptimizer::DoComputeSetterStubFrame(TranslationIterator* iterator, |
| + int frame_index) { |
| + JSFunction* setter = JSFunction::cast(ComputeLiteral(iterator->Next())); |
| + // The receiver and RHS are expected in registers by the IC, so they don't |
|
Michael Starzinger
2012/08/16 17:20:04
s/IC/StoreIC/
Sven Panne
2012/08/17 07:27:26
Done here and on other platforms.
|
| + // belong to the output stack frame. This means that we have to use a height |
| + // of 0 instead of 2. |
|
Michael Starzinger
2012/08/16 17:20:04
Drop the "instead of 2" part.
Sven Panne
2012/08/17 07:27:26
... it's cleaner! ;-) Done here and on other platf
|
| + unsigned height = 0; |
| + unsigned height_in_bytes = height * kPointerSize; |
| + if (FLAG_trace_deopt) { |
| + PrintF(" translating setter stub => height=%u\n", height_in_bytes); |
| + } |
| + |
| + // 1 stack entry for the return address + 4 stack entries from |
|
Michael Starzinger
2012/08/16 17:20:04
Can we start this sentence with a word, not a numb
Sven Panne
2012/08/17 07:27:26
Done here and on other platforms.
|
| + // StackFrame::INTERNAL (FP, context, frame type, code object, see |
| + // MacroAssembler::EnterFrame) + 1 stack entry from setter stub (RHS, see |
| + // StoreStubCompiler::CompileStoreViaSetter). |
| + unsigned fixed_frame_size = (1 + 4 + 1) * kPointerSize; |
| + unsigned output_frame_size = height_in_bytes + fixed_frame_size; |
| + |
| + // Allocate and store the output frame description. |
| + FrameDescription* output_frame = |
| + new(output_frame_size) FrameDescription(output_frame_size, setter); |
| + output_frame->SetFrameType(StackFrame::INTERNAL); |
| + |
| + // A frame for a setter stub can not be the topmost or bottommost one. |
| + ASSERT(frame_index > 0 && frame_index < output_count_ - 1); |
| + ASSERT(output_[frame_index] == NULL); |
| + output_[frame_index] = output_frame; |
| + |
| + // The top address of the frame is computed from the previous frame's top and |
| + // this frame's size. |
| + intptr_t top_address = output_[frame_index - 1]->GetTop() - output_frame_size; |
| + output_frame->SetTop(top_address); |
| + |
| + unsigned output_offset = output_frame_size; |
| + |
| + // Read caller's PC from the previous frame. |
| + output_offset -= kPointerSize; |
| + intptr_t callers_pc = output_[frame_index - 1]->GetPc(); |
| + output_frame->SetFrameSlot(output_offset, callers_pc); |
| + if (FLAG_trace_deopt) { |
| + PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
| + " ; caller's pc\n", |
| + top_address + output_offset, output_offset, callers_pc); |
| + } |
| + |
| + // Read caller's FP from the previous frame, and set this frame's FP. |
| + output_offset -= kPointerSize; |
| + intptr_t value = output_[frame_index - 1]->GetFp(); |
| + output_frame->SetFrameSlot(output_offset, value); |
| + intptr_t fp_value = top_address + output_offset; |
| + output_frame->SetFp(fp_value); |
| + if (FLAG_trace_deopt) { |
| + PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
| + " ; caller's fp\n", |
| + fp_value, output_offset, value); |
| + } |
| + |
| + // The context can be gotten from the previous frame. |
| + output_offset -= kPointerSize; |
| + value = output_[frame_index - 1]->GetContext(); |
| + output_frame->SetFrameSlot(output_offset, value); |
| + if (FLAG_trace_deopt) { |
| + PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
| + " ; context\n", |
| + top_address + output_offset, output_offset, value); |
| + } |
| + |
| + // A marker value is used in place of the function. |
| + output_offset -= kPointerSize; |
| + value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); |
| + output_frame->SetFrameSlot(output_offset, value); |
| + if (FLAG_trace_deopt) { |
| + PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
| + " ; function (setter sentinel)\n", |
| + top_address + output_offset, output_offset, value); |
| + } |
| + |
| + // Get Code object from setter function. |
| + output_offset -= kPointerSize; |
| + value = reinterpret_cast<intptr_t>(setter->code()); |
|
Michael Starzinger
2012/08/16 17:20:04
I don't think this is quite right. What you want h
Sven Panne
2012/08/17 07:27:26
Good catch. Done here and on other platforms.
|
| + output_frame->SetFrameSlot(output_offset, value); |
| + if (FLAG_trace_deopt) { |
| + PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR |
| + " ; code object\n", |
| + top_address + output_offset, output_offset, value); |
| + } |
| + |
| + // Skip receiver. |
| + Translation::Opcode opcode = |
| + static_cast<Translation::Opcode>(iterator->Next()); |
| + iterator->Skip(Translation::NumberOfOperandsFor(opcode)); |
| + |
| + // The RHS was part of the artificial setter stub environment. |
|
Michael Starzinger
2012/08/16 17:20:04
I would use "implicit return value" or "passed val
Sven Panne
2012/08/17 07:27:26
Done here and on other platforms.
|
| + output_offset -= kPointerSize; |
| + DoTranslateCommand(iterator, frame_index, output_offset); |
| + |
| + ASSERT(0 == output_offset); |
| + |
| + Code* setter_stub = |
|
Michael Starzinger
2012/08/16 17:20:04
Move this up, you already need if for the code obj
Sven Panne
2012/08/17 07:27:26
Done here and on other platforms.
|
| + isolate_->builtins()->builtin(Builtins::kSetterStubForDeopt); |
| + intptr_t pc = reinterpret_cast<intptr_t>( |
| + setter_stub->instruction_start() + |
| + isolate_->heap()->setter_stub_deopt_pc_offset()->value()); |
| + output_frame->SetPc(pc); |
| +} |
| + |
| + |
| void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, |
| int frame_index) { |
| BailoutId node_id = BailoutId(iterator->Next()); |