 Chromium Code Reviews
 Chromium Code Reviews Issue 188063002:
  Fix deoptimization for out-of-line constant pool.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 188063002:
  Fix deoptimization for out-of-line constant pool.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/deoptimizer.cc | 
| diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc | 
| index 1b78bae30573e12b385cfbb24720aaef89561faf..9f186b17eea9046fb37b394d8499989a8f96a889 100644 | 
| --- a/src/deoptimizer.cc | 
| +++ b/src/deoptimizer.cc | 
| @@ -968,24 +968,19 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 
| if (FLAG_enable_ool_constant_pool) { | 
| // For the bottommost output frame the constant pool pointer can be gotten | 
| - // from the input frame. For subsequent output frames, it can be gotten from | 
| - // the function's code. | 
| - Register constant_pool_reg = | 
| - JavaScriptFrame::constant_pool_pointer_register(); | 
| + // from the input frame. For subsequent output frames, it can be read from | 
| + // the previous frame. | 
| output_offset -= kPointerSize; | 
| input_offset -= kPointerSize; | 
| if (is_bottommost) { | 
| value = input_->GetFrameSlot(input_offset); | 
| } else { | 
| - value = reinterpret_cast<intptr_t>( | 
| - function->shared()->code()->constant_pool()); | 
| + value = output_[frame_index - 1]->GetConstantPool(); | 
| } | 
| - output_frame->SetFrameSlot(output_offset, value); | 
| - output_frame->SetConstantPool(value); | 
| - if (is_topmost) output_frame->SetRegister(constant_pool_reg.code(), value); | 
| + output_frame->SetCallerConstantPool(output_offset, value); | 
| if (trace_scope_) { | 
| PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 
| - V8PRIxPTR "; constant_pool\n", | 
| + V8PRIxPTR "; caller's constant_pool\n", | 
| top_address + output_offset, output_offset, value); | 
| } | 
| } | 
| @@ -1043,6 +1038,18 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, | 
| intptr_t pc_value = reinterpret_cast<intptr_t>(start + pc_offset); | 
| output_frame->SetPc(pc_value); | 
| + // Update constant pool. | 
| + if (FLAG_enable_ool_constant_pool) { | 
| + intptr_t constant_pool_value = | 
| + reinterpret_cast<intptr_t>(non_optimized_code->constant_pool()); | 
| + output_frame->SetConstantPool(constant_pool_value); | 
| + if (is_topmost) { | 
| + Register constant_pool_reg = | 
| + JavaScriptFrame::constant_pool_pointer_register(); | 
| + output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | 
| + } | 
| + } | 
| + | 
| FullCodeGenerator::State state = | 
| FullCodeGenerator::StateField::decode(pc_and_state); | 
| output_frame->SetState(Smi::FromInt(state)); | 
| @@ -1126,15 +1133,16 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, | 
| } | 
| if (FLAG_enable_ool_constant_pool) { | 
| - // A marker value is used in place of the constant pool. | 
| + // Our constant pool is the same as our caller's, get it from the previous | 
| 
ulan
2014/03/13 13:35:22
Why ArgumentsAdaptorTrampoline and other stubs bel
 
rmcilroy
2014/03/14 12:35:57
You are right - originally stubs didn't load the c
 | 
| + // frame's constant pool. | 
| output_offset -= kPointerSize; | 
| - intptr_t constant_pool = reinterpret_cast<intptr_t>( | 
| - Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 
| - output_frame->SetFrameSlot(output_offset, constant_pool); | 
| + value = output_[frame_index - 1]->GetConstantPool(); | 
| + output_frame->SetCallerConstantPool(output_offset, value); | 
| + output_frame->SetConstantPool(value); | 
| if (trace_scope_) { | 
| PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 
| - V8PRIxPTR " ; constant_pool (adaptor sentinel)\n", | 
| - top_address + output_offset, output_offset, constant_pool); | 
| + V8PRIxPTR "; caller's constant_pool\n", | 
| + top_address + output_offset, output_offset, value); | 
| } | 
| } | 
| @@ -1259,10 +1267,11 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, | 
| // The constant pool pointer can be gotten from the previous frame. | 
| output_offset -= kPointerSize; | 
| value = output_[frame_index - 1]->GetConstantPool(); | 
| - output_frame->SetFrameSlot(output_offset, value); | 
| + output_frame->SetConstantPool(value); | 
| + output_frame->SetCallerConstantPool(output_offset, value); | 
| if (trace_scope_) { | 
| PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 
| - V8PRIxPTR " ; constant pool\n", | 
| + V8PRIxPTR " ; caller's constant pool\n", | 
| top_address + output_offset, output_offset, value); | 
| } | 
| } | 
| @@ -1417,10 +1426,11 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, | 
| // The constant pool pointer can be gotten from the previous frame. | 
| output_offset -= kPointerSize; | 
| value = output_[frame_index - 1]->GetConstantPool(); | 
| - output_frame->SetFrameSlot(output_offset, value); | 
| + output_frame->SetConstantPool(value); | 
| + output_frame->SetCallerConstantPool(output_offset, value); | 
| if (trace_scope_) { | 
| PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 
| - V8PRIxPTR " ; constant pool\n", | 
| + V8PRIxPTR " ; caller's constant pool\n", | 
| top_address + output_offset, output_offset, value); | 
| } | 
| } | 
| @@ -1585,17 +1595,14 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, | 
| } | 
| if (FLAG_enable_ool_constant_pool) { | 
| - // The constant pool pointer can be gotten from the input frame. | 
| - Register constant_pool_pointer_register = | 
| - StubFailureTrampolineFrame::constant_pool_pointer_register(); | 
| + // Read the caller's constant pool from the input frame. | 
| input_frame_offset -= kPointerSize; | 
| value = input_->GetFrameSlot(input_frame_offset); | 
| - output_frame->SetRegister(constant_pool_pointer_register.code(), value); | 
| output_frame_offset -= kPointerSize; | 
| - output_frame->SetFrameSlot(output_frame_offset, value); | 
| + output_frame->SetCallerConstantPool(output_frame_offset, value); | 
| if (trace_scope_) { | 
| PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" | 
| - V8PRIxPTR " ; constant_pool_pointer\n", | 
| + V8PRIxPTR " ; caller's constant_pool\n", | 
| top_address + output_frame_offset, output_frame_offset, value); | 
| } | 
| } | 
| @@ -1729,6 +1736,14 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator, | 
| ASSERT(trampoline != NULL); | 
| output_frame->SetPc(reinterpret_cast<intptr_t>( | 
| trampoline->instruction_start())); | 
| + if (FLAG_enable_ool_constant_pool) { | 
| + Register constant_pool_reg = | 
| + StubFailureTrampolineFrame::constant_pool_pointer_register(); | 
| + intptr_t constant_pool_value = | 
| + reinterpret_cast<intptr_t>(trampoline->constant_pool()); | 
| + output_frame->SetConstantPool(constant_pool_value); | 
| + output_frame->SetRegister(constant_pool_reg.code(), constant_pool_value); | 
| + } | 
| output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS)); | 
| Code* notify_failure = NotifyStubFailureBuiltin(); | 
| output_frame->SetContinuation( |