Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: src/deoptimizer.cc

Issue 1696043002: [runtime] Unify and simplify how frames are marked (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: All platforms Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/deoptimizer.cc
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index 942b5284a377a811c367ce76618e3765bbc1197e..c3d80a51b75f2dcedc4a6edd0b2c55b8b9545822 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -1333,7 +1333,7 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(int frame_index) {
" translating arguments adaptor => height=%d\n", height_in_bytes);
}
- unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize;
+ unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFixedFrameSize;
unsigned output_frame_size = height_in_bytes + fixed_frame_size;
// Allocate and store the output frame description.
@@ -1441,7 +1441,7 @@ void Deoptimizer::DoComputeConstructStubFrame(int frame_index) {
" translating construct stub => height=%d\n", height_in_bytes);
}
- unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize;
+ unsigned fixed_frame_size = ConstructFrameConstants::kFixedFrameSize;
unsigned output_frame_size = height_in_bytes + fixed_frame_size;
// Allocate and store the output frame description.
@@ -1496,24 +1496,18 @@ void Deoptimizer::DoComputeConstructStubFrame(int frame_index) {
"caller's constant_pool\n");
}
- // The context can be gotten from the previous frame.
- output_offset -= kPointerSize;
- value = output_[frame_index - 1]->GetContext();
- output_frame->SetFrameSlot(output_offset, value);
- DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
-
- // A marker value is used in place of the function.
+ // A marker value is used to mark the frame.
output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT));
output_frame->SetFrameSlot(output_offset, value);
DebugPrintOutputSlot(value, frame_index, output_offset,
- "function (construct sentinel)\n");
+ "typed frame marker\n");
- // The output frame reflects a JSConstructStubGeneric frame.
+ // The context can be gotten from the previous frame.
output_offset -= kPointerSize;
- value = reinterpret_cast<intptr_t>(construct_stub);
+ value = output_[frame_index - 1]->GetContext();
output_frame->SetFrameSlot(output_offset, value);
- DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n");
+ DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
// The allocation site.
output_offset -= kPointerSize;
@@ -1574,7 +1568,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(int frame_index,
}
// We need 1 stack entry for the return address and enough entries for the
- // StackFrame::INTERNAL (FP, context, frame type, code object and constant
+ // StackFrame::INTERNAL (FP, frame type, context, code object and constant
// pool (if enabled)- see MacroAssembler::EnterFrame).
// For a setter stub frame we need one additional entry for the implicit
// return value, see StoreStubCompiler::CompileStoreViaSetter.
@@ -1624,17 +1618,11 @@ void Deoptimizer::DoComputeAccessorStubFrame(int frame_index,
"caller's constant_pool\n");
}
- // The context can be gotten from the previous frame.
- output_offset -= kPointerSize;
- value = output_[frame_index - 1]->GetContext();
- output_frame->SetFrameSlot(output_offset, value);
- DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
-
- // A marker value is used in place of the function.
+ // Set the frame type.
output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
output_frame->SetFrameSlot(output_offset, value);
- DebugPrintOutputSlot(value, frame_index, output_offset, "function ");
+ DebugPrintOutputSlot(value, frame_index, output_offset, "frame type ");
if (trace_scope_ != nullptr) {
PrintF(trace_scope_->file(), "(%s sentinel)\n", kind);
}
@@ -1649,6 +1637,12 @@ void Deoptimizer::DoComputeAccessorStubFrame(int frame_index,
output_frame->SetFrameSlot(output_offset, value);
DebugPrintOutputSlot(value, frame_index, output_offset, "code object\n");
+ // The context can be gotten from the previous frame.
+ output_offset -= kPointerSize;
+ value = output_[frame_index - 1]->GetContext();
+ output_frame->SetFrameSlot(output_offset, value);
+ DebugPrintOutputSlot(value, frame_index, output_offset, "context\n");
+
// Skip receiver.
value_iterator++;
input_index++;
@@ -1733,9 +1727,8 @@ void Deoptimizer::DoComputeCompiledStubFrame(int frame_index) {
CHECK_EQ(translated_frame->height(), param_count + 1);
CHECK_GE(param_count, 0);
- int height_in_bytes = kPointerSize * (param_count + stack_param_count) +
- sizeof(Arguments) + kPointerSize;
- int fixed_frame_size = StandardFrameConstants::kFixedFrameSize;
+ int height_in_bytes = kPointerSize * (param_count + stack_param_count);
+ int fixed_frame_size = StubFailureTrampolineFrameConstants::kFixedFrameSize;
int input_frame_size = input_->GetFrameSize();
int output_frame_size = height_in_bytes + fixed_frame_size;
if (trace_scope_ != NULL) {
@@ -1756,8 +1749,10 @@ void Deoptimizer::DoComputeCompiledStubFrame(int frame_index) {
// frame pointer and the output frame's height. Subtract space for the
// context and function slots.
Register fp_reg = StubFailureTrampolineFrame::fp_register();
- intptr_t top_address = input_->GetRegister(fp_reg.code()) -
- StandardFrameConstants::kFixedFrameSizeFromFp - height_in_bytes;
+ intptr_t top_address =
+ input_->GetRegister(fp_reg.code()) -
+ StubFailureTrampolineFrameConstants::kFixedFrameSizeFromFp -
+ height_in_bytes;
output_frame->SetTop(top_address);
// Read caller's PC (JSFunction continuation) from the input frame.
@@ -1770,13 +1765,13 @@ void Deoptimizer::DoComputeCompiledStubFrame(int frame_index) {
// Read caller's FP from the input frame, and set this frame's FP.
input_frame_offset -= kFPOnStackSize;
- value = input_->GetFrameSlot(input_frame_offset);
output_frame_offset -= kFPOnStackSize;
- output_frame->SetCallerFp(output_frame_offset, value);
+ intptr_t parent_frame_ptr = input_->GetFrameSlot(input_frame_offset);
+ output_frame->SetCallerFp(output_frame_offset, parent_frame_ptr);
intptr_t frame_ptr = input_->GetRegister(fp_reg.code());
output_frame->SetRegister(fp_reg.code(), frame_ptr);
output_frame->SetFp(frame_ptr);
- DebugPrintOutputSlot(value, frame_index, output_frame_offset,
+ DebugPrintOutputSlot(frame_ptr, frame_index, output_frame_offset,
"caller's fp\n");
if (FLAG_enable_embedded_constant_pool) {
@@ -1789,12 +1784,7 @@ void Deoptimizer::DoComputeCompiledStubFrame(int frame_index) {
"caller's constant_pool\n");
}
- // Remember where the context will need to be written back from the deopt
- // translation.
- output_frame_offset -= kPointerSize;
- unsigned context_frame_offset = output_frame_offset;
-
- // A marker value is used in place of the function.
+ // The marker for the typed stack frame
output_frame_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(
Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
@@ -1855,8 +1845,6 @@ void Deoptimizer::DoComputeCompiledStubFrame(int frame_index) {
Register context_reg = StubFailureTrampolineFrame::context_register();
value = reinterpret_cast<intptr_t>(maybe_context);
output_frame->SetRegister(context_reg.code(), value);
- output_frame->SetFrameSlot(context_frame_offset, value);
- DebugPrintOutputSlot(value, frame_index, context_frame_offset, "context\n");
++value_iterator;
// Copy constant stack parameters to the failure frame. If the number of stack
@@ -2008,16 +1996,15 @@ void Deoptimizer::DebugPrintOutputSlot(intptr_t value, int frame_index,
unsigned Deoptimizer::ComputeInputFrameSize() const {
- unsigned fixed_size = StandardFrameConstants::kFixedFrameSize;
- if (!function_->IsSmi()) {
- fixed_size += ComputeIncomingArgumentSize(function_->shared());
- } else {
- CHECK_EQ(Smi::cast(function_), Smi::FromInt(StackFrame::STUB));
- }
+ unsigned fixed_size = (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION)
+ ? ComputeJavascriptFixedSize(function_->shared())
+ : TypedFrameConstants::kFixedFrameSize;
// The fp-to-sp delta already takes the context, constant pool pointer and the
// function into account so we have to avoid double counting them.
unsigned result = fixed_size + fp_to_sp_delta_ -
- StandardFrameConstants::kFixedFrameSizeFromFp;
+ ((compiled_code_->kind() == Code::OPTIMIZED_FUNCTION)
+ ? StandardFrameConstants::kFixedFrameSizeFromFp
+ : TypedFrameConstants::kFixedFrameSizeFromFp);
if (compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
unsigned stack_slots = compiled_code_->stack_slots();
unsigned outgoing_size =
@@ -2344,7 +2331,7 @@ void Translation::StoreArgumentsObject(bool args_known,
void Translation::StoreJSFrameFunction() {
StoreStackSlot((StandardFrameConstants::kCallerPCOffset -
- StandardFrameConstants::kMarkerOffset) /
+ StandardFrameConstants::kFunctionOffset) /
kPointerSize);
}

Powered by Google App Engine
This is Rietveld 408576698