[deoptimizer] Use consistent terms for the bytecode offset
The bytecode offset (previously 'bailout id') was referred to as 'ast id', 'node id', 'bailout id' in different spots. And 'bailout id' was used to refer to deoptimization exits. This CL makes used terms more consistent. Bug: v8:11332 Change-Id: I2b34c7d4ebf465939e18fdfba675d83852f2430a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2639756 Commit-Queue: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Cr-Commit-Position: refs/heads/master@{#72190}
This commit is contained in:
parent
727d22be0c
commit
0bc811e9d0
@ -158,7 +158,7 @@ class CompilerTracer : public AllStatic {
|
|||||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||||
PrintTracePrefix(scope, "found optimized code for", function, code_kind);
|
PrintTracePrefix(scope, "found optimized code for", function, code_kind);
|
||||||
if (!osr_offset.IsNone()) {
|
if (!osr_offset.IsNone()) {
|
||||||
PrintF(scope.file(), " at OSR AST id %d", osr_offset.ToInt());
|
PrintF(scope.file(), " at OSR bytecode offset %d", osr_offset.ToInt());
|
||||||
}
|
}
|
||||||
PrintTraceSuffix(scope);
|
PrintTraceSuffix(scope);
|
||||||
}
|
}
|
||||||
|
@ -194,11 +194,11 @@ Code Deoptimizer::FindDeoptimizingCode(Address addr) {
|
|||||||
// We rely on this function not causing a GC. It is called from generated code
|
// We rely on this function not causing a GC. It is called from generated code
|
||||||
// without having a real stack frame in place.
|
// without having a real stack frame in place.
|
||||||
Deoptimizer* Deoptimizer::New(Address raw_function, DeoptimizeKind kind,
|
Deoptimizer* Deoptimizer::New(Address raw_function, DeoptimizeKind kind,
|
||||||
unsigned bailout_id, Address from,
|
unsigned deopt_exit_index, Address from,
|
||||||
int fp_to_sp_delta, Isolate* isolate) {
|
int fp_to_sp_delta, Isolate* isolate) {
|
||||||
JSFunction function = JSFunction::cast(Object(raw_function));
|
JSFunction function = JSFunction::cast(Object(raw_function));
|
||||||
Deoptimizer* deoptimizer = new Deoptimizer(isolate, function, kind,
|
Deoptimizer* deoptimizer = new Deoptimizer(
|
||||||
bailout_id, from, fp_to_sp_delta);
|
isolate, function, kind, deopt_exit_index, from, fp_to_sp_delta);
|
||||||
isolate->set_current_deoptimizer(deoptimizer);
|
isolate->set_current_deoptimizer(deoptimizer);
|
||||||
return deoptimizer;
|
return deoptimizer;
|
||||||
}
|
}
|
||||||
@ -506,11 +506,11 @@ base::Optional<wasm::ValueType::Kind> DecodeWasmReturnType(int code) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
|
Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
|
||||||
DeoptimizeKind kind, unsigned bailout_id, Address from,
|
DeoptimizeKind kind, unsigned deopt_exit_index,
|
||||||
int fp_to_sp_delta)
|
Address from, int fp_to_sp_delta)
|
||||||
: isolate_(isolate),
|
: isolate_(isolate),
|
||||||
function_(function),
|
function_(function),
|
||||||
bailout_id_(bailout_id),
|
deopt_exit_index_(deopt_exit_index),
|
||||||
deopt_kind_(kind),
|
deopt_kind_(kind),
|
||||||
from_(from),
|
from_(from),
|
||||||
fp_to_sp_delta_(fp_to_sp_delta),
|
fp_to_sp_delta_(fp_to_sp_delta),
|
||||||
@ -536,8 +536,8 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
|
|||||||
deoptimizing_throw_ = true;
|
deoptimizing_throw_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(bailout_id_ == kFixedExitSizeMarker ||
|
DCHECK(deopt_exit_index_ == kFixedExitSizeMarker ||
|
||||||
bailout_id_ < kMaxNumberOfEntries);
|
deopt_exit_index_ < kMaxNumberOfEntries);
|
||||||
|
|
||||||
DCHECK_NE(from, kNullAddress);
|
DCHECK_NE(from, kNullAddress);
|
||||||
compiled_code_ = FindOptimizedCode();
|
compiled_code_ = FindOptimizedCode();
|
||||||
@ -566,8 +566,8 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
|
|||||||
input_ = new (size) FrameDescription(size, parameter_count);
|
input_ = new (size) FrameDescription(size, parameter_count);
|
||||||
|
|
||||||
if (kSupportsFixedDeoptExitSizes) {
|
if (kSupportsFixedDeoptExitSizes) {
|
||||||
DCHECK_EQ(bailout_id_, kFixedExitSizeMarker);
|
DCHECK_EQ(deopt_exit_index_, kFixedExitSizeMarker);
|
||||||
// Calculate bailout id from return address.
|
// Calculate the deopt exit index from return address.
|
||||||
DCHECK_GT(kNonLazyDeoptExitSize, 0);
|
DCHECK_GT(kNonLazyDeoptExitSize, 0);
|
||||||
DCHECK_GT(kLazyDeoptExitSize, 0);
|
DCHECK_GT(kLazyDeoptExitSize, 0);
|
||||||
DeoptimizationData deopt_data =
|
DeoptimizationData deopt_data =
|
||||||
@ -597,19 +597,20 @@ Deoptimizer::Deoptimizer(Isolate* isolate, JSFunction function,
|
|||||||
int offset =
|
int offset =
|
||||||
static_cast<int>(from_ - kNonLazyDeoptExitSize - deopt_start);
|
static_cast<int>(from_ - kNonLazyDeoptExitSize - deopt_start);
|
||||||
DCHECK_EQ(0, offset % kNonLazyDeoptExitSize);
|
DCHECK_EQ(0, offset % kNonLazyDeoptExitSize);
|
||||||
bailout_id_ = offset / kNonLazyDeoptExitSize;
|
deopt_exit_index_ = offset / kNonLazyDeoptExitSize;
|
||||||
} else if (from_ <= eager_with_resume_deopt_start) {
|
} else if (from_ <= eager_with_resume_deopt_start) {
|
||||||
int offset =
|
int offset =
|
||||||
static_cast<int>(from_ - kLazyDeoptExitSize - lazy_deopt_start);
|
static_cast<int>(from_ - kLazyDeoptExitSize - lazy_deopt_start);
|
||||||
DCHECK_EQ(0, offset % kLazyDeoptExitSize);
|
DCHECK_EQ(0, offset % kLazyDeoptExitSize);
|
||||||
bailout_id_ =
|
deopt_exit_index_ =
|
||||||
eager_soft_and_bailout_deopt_count + (offset / kLazyDeoptExitSize);
|
eager_soft_and_bailout_deopt_count + (offset / kLazyDeoptExitSize);
|
||||||
} else {
|
} else {
|
||||||
int offset = static_cast<int>(from_ - kNonLazyDeoptExitSize -
|
int offset = static_cast<int>(from_ - kNonLazyDeoptExitSize -
|
||||||
eager_with_resume_deopt_start);
|
eager_with_resume_deopt_start);
|
||||||
DCHECK_EQ(0, offset % kEagerWithResumeDeoptExitSize);
|
DCHECK_EQ(0, offset % kEagerWithResumeDeoptExitSize);
|
||||||
bailout_id_ = eager_soft_and_bailout_deopt_count + lazy_deopt_count +
|
deopt_exit_index_ = eager_soft_and_bailout_deopt_count +
|
||||||
(offset / kEagerWithResumeDeoptExitSize);
|
lazy_deopt_count +
|
||||||
|
(offset / kEagerWithResumeDeoptExitSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -733,7 +734,7 @@ int LookupCatchHandler(Isolate* isolate, TranslatedFrame* translated_frame,
|
|||||||
int* data_out) {
|
int* data_out) {
|
||||||
switch (translated_frame->kind()) {
|
switch (translated_frame->kind()) {
|
||||||
case TranslatedFrame::kInterpretedFunction: {
|
case TranslatedFrame::kInterpretedFunction: {
|
||||||
int bytecode_offset = translated_frame->node_id().ToInt();
|
int bytecode_offset = translated_frame->bytecode_offset().ToInt();
|
||||||
HandlerTable table(
|
HandlerTable table(
|
||||||
translated_frame->raw_shared_info().GetBytecodeArray(isolate));
|
translated_frame->raw_shared_info().GetBytecodeArray(isolate));
|
||||||
return table.LookupRange(bytecode_offset, data_out, nullptr);
|
return table.LookupRange(bytecode_offset, data_out, nullptr);
|
||||||
@ -749,7 +750,8 @@ int LookupCatchHandler(Isolate* isolate, TranslatedFrame* translated_frame,
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void Deoptimizer::TraceDeoptBegin(int optimization_id, int node_id) {
|
void Deoptimizer::TraceDeoptBegin(int optimization_id,
|
||||||
|
BytecodeOffset bytecode_offset) {
|
||||||
DCHECK(tracing_enabled());
|
DCHECK(tracing_enabled());
|
||||||
FILE* file = trace_scope()->file();
|
FILE* file = trace_scope()->file();
|
||||||
Deoptimizer::DeoptInfo info =
|
Deoptimizer::DeoptInfo info =
|
||||||
@ -763,10 +765,11 @@ void Deoptimizer::TraceDeoptBegin(int optimization_id, int node_id) {
|
|||||||
PrintF(file, "%s", CodeKindToString(compiled_code_.kind()));
|
PrintF(file, "%s", CodeKindToString(compiled_code_.kind()));
|
||||||
}
|
}
|
||||||
PrintF(file,
|
PrintF(file,
|
||||||
", opt id %d, node id %d, bailout id %d, FP to SP delta %d, "
|
", opt id %d, bytecode offset %d, deopt exit %d, FP to SP delta %d, "
|
||||||
"caller SP " V8PRIxPTR_FMT ", pc " V8PRIxPTR_FMT "]\n",
|
"caller SP " V8PRIxPTR_FMT ", pc " V8PRIxPTR_FMT "]\n",
|
||||||
optimization_id, node_id, bailout_id_, fp_to_sp_delta_,
|
optimization_id, bytecode_offset.ToInt(), deopt_exit_index_,
|
||||||
caller_frame_top_, PointerAuthentication::StripPAC(from_));
|
fp_to_sp_delta_, caller_frame_top_,
|
||||||
|
PointerAuthentication::StripPAC(from_));
|
||||||
if (verbose_tracing_enabled() && deopt_kind_ != DeoptimizeKind::kLazy) {
|
if (verbose_tracing_enabled() && deopt_kind_ != DeoptimizeKind::kLazy) {
|
||||||
PrintF(file, " ;;; deoptimize at ");
|
PrintF(file, " ;;; deoptimize at ");
|
||||||
OFStream outstr(file);
|
OFStream outstr(file);
|
||||||
@ -896,13 +899,15 @@ void Deoptimizer::DoComputeOutputFrames() {
|
|||||||
CHECK_GT(static_cast<uintptr_t>(caller_frame_top_),
|
CHECK_GT(static_cast<uintptr_t>(caller_frame_top_),
|
||||||
stack_guard->real_jslimit());
|
stack_guard->real_jslimit());
|
||||||
|
|
||||||
BytecodeOffset node_id = input_data.GetBytecodeOffset(bailout_id_);
|
BytecodeOffset bytecode_offset =
|
||||||
|
input_data.GetBytecodeOffset(deopt_exit_index_);
|
||||||
ByteArray translations = input_data.TranslationByteArray();
|
ByteArray translations = input_data.TranslationByteArray();
|
||||||
unsigned translation_index = input_data.TranslationIndex(bailout_id_).value();
|
unsigned translation_index =
|
||||||
|
input_data.TranslationIndex(deopt_exit_index_).value();
|
||||||
|
|
||||||
if (tracing_enabled()) {
|
if (tracing_enabled()) {
|
||||||
timer.Start();
|
timer.Start();
|
||||||
TraceDeoptBegin(input_data.OptimizationId().value(), node_id.ToInt());
|
TraceDeoptBegin(input_data.OptimizationId().value(), bytecode_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* trace_file =
|
FILE* trace_file =
|
||||||
@ -942,12 +947,11 @@ void Deoptimizer::DoComputeOutputFrames() {
|
|||||||
output_count_ = static_cast<int>(count);
|
output_count_ = static_cast<int>(count);
|
||||||
|
|
||||||
// Translate each output frame.
|
// Translate each output frame.
|
||||||
int frame_index = 0; // output_frame_index
|
int frame_index = 0;
|
||||||
size_t total_output_frame_size = 0;
|
size_t total_output_frame_size = 0;
|
||||||
for (size_t i = 0; i < count; ++i, ++frame_index) {
|
for (size_t i = 0; i < count; ++i, ++frame_index) {
|
||||||
// Read the ast node id, function, and frame height for this output frame.
|
|
||||||
TranslatedFrame* translated_frame = &(translated_state_.frames()[i]);
|
TranslatedFrame* translated_frame = &(translated_state_.frames()[i]);
|
||||||
bool handle_exception = deoptimizing_throw_ && i == count - 1;
|
const bool handle_exception = deoptimizing_throw_ && i == count - 1;
|
||||||
switch (translated_frame->kind()) {
|
switch (translated_frame->kind()) {
|
||||||
case TranslatedFrame::kInterpretedFunction:
|
case TranslatedFrame::kInterpretedFunction:
|
||||||
DoComputeInterpretedFrame(translated_frame, frame_index,
|
DoComputeInterpretedFrame(translated_frame, frame_index,
|
||||||
@ -1014,7 +1018,7 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame,
|
|||||||
const bool is_bottommost = (0 == frame_index);
|
const bool is_bottommost = (0 == frame_index);
|
||||||
const bool is_topmost = (output_count_ - 1 == frame_index);
|
const bool is_topmost = (output_count_ - 1 == frame_index);
|
||||||
|
|
||||||
const int real_bytecode_offset = translated_frame->node_id().ToInt();
|
const int real_bytecode_offset = translated_frame->bytecode_offset().ToInt();
|
||||||
const int bytecode_offset =
|
const int bytecode_offset =
|
||||||
goto_catch_handler ? catch_handler_pc_offset_ : real_bytecode_offset;
|
goto_catch_handler ? catch_handler_pc_offset_ : real_bytecode_offset;
|
||||||
|
|
||||||
@ -1087,9 +1091,9 @@ void Deoptimizer::DoComputeInterpretedFrame(TranslatedFrame* translated_frame,
|
|||||||
// explicitly.
|
// explicitly.
|
||||||
//
|
//
|
||||||
// The caller's pc for the bottommost output frame is the same as in the
|
// The caller's pc for the bottommost output frame is the same as in the
|
||||||
// input frame. For all subsequent output frames, it can be read from the
|
// input frame. For all subsequent output frames, it can be read from the
|
||||||
// previous one. This frame's pc can be computed from the non-optimized
|
// previous one. This frame's pc can be computed from the non-optimized
|
||||||
// function code and AST id of the bailout.
|
// function code and bytecode offset of the bailout.
|
||||||
if (is_bottommost) {
|
if (is_bottommost) {
|
||||||
frame_writer.PushBottommostCallerPc(caller_pc_);
|
frame_writer.PushBottommostCallerPc(caller_pc_);
|
||||||
} else {
|
} else {
|
||||||
@ -1373,7 +1377,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
|
|||||||
|
|
||||||
Builtins* builtins = isolate_->builtins();
|
Builtins* builtins = isolate_->builtins();
|
||||||
Code construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
|
Code construct_stub = builtins->builtin(Builtins::kJSConstructStubGeneric);
|
||||||
BytecodeOffset bailout_id = translated_frame->node_id();
|
BytecodeOffset bytecode_offset = translated_frame->bytecode_offset();
|
||||||
|
|
||||||
const int parameters_count = translated_frame->height();
|
const int parameters_count = translated_frame->height();
|
||||||
ConstructStubFrameInfo frame_info =
|
ConstructStubFrameInfo frame_info =
|
||||||
@ -1383,11 +1387,11 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
|
|||||||
TranslatedFrame::iterator function_iterator = value_iterator++;
|
TranslatedFrame::iterator function_iterator = value_iterator++;
|
||||||
if (verbose_tracing_enabled()) {
|
if (verbose_tracing_enabled()) {
|
||||||
PrintF(trace_scope()->file(),
|
PrintF(trace_scope()->file(),
|
||||||
" translating construct stub => bailout_id=%d (%s), "
|
" translating construct stub => bytecode_offset=%d (%s), "
|
||||||
"variable_frame_size=%d, frame_size=%d\n",
|
"variable_frame_size=%d, frame_size=%d\n",
|
||||||
bailout_id.ToInt(),
|
bytecode_offset.ToInt(),
|
||||||
bailout_id == BytecodeOffset::ConstructStubCreate() ? "create"
|
bytecode_offset == BytecodeOffset::ConstructStubCreate() ? "create"
|
||||||
: "invoke",
|
: "invoke",
|
||||||
frame_info.frame_size_in_bytes_without_fixed(), output_frame_size);
|
frame_info.frame_size_in_bytes_without_fixed(), output_frame_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1465,11 +1469,12 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
|
|||||||
|
|
||||||
frame_writer.PushRawObject(roots.the_hole_value(), "padding\n");
|
frame_writer.PushRawObject(roots.the_hole_value(), "padding\n");
|
||||||
|
|
||||||
CHECK(bailout_id == BytecodeOffset::ConstructStubCreate() ||
|
CHECK(bytecode_offset == BytecodeOffset::ConstructStubCreate() ||
|
||||||
bailout_id == BytecodeOffset::ConstructStubInvoke());
|
bytecode_offset == BytecodeOffset::ConstructStubInvoke());
|
||||||
const char* debug_hint = bailout_id == BytecodeOffset::ConstructStubCreate()
|
const char* debug_hint =
|
||||||
? "new target\n"
|
bytecode_offset == BytecodeOffset::ConstructStubCreate()
|
||||||
: "allocated receiver\n";
|
? "new target\n"
|
||||||
|
: "allocated receiver\n";
|
||||||
frame_writer.PushTranslatedValue(receiver_iterator, debug_hint);
|
frame_writer.PushTranslatedValue(receiver_iterator, debug_hint);
|
||||||
|
|
||||||
if (is_topmost) {
|
if (is_topmost) {
|
||||||
@ -1486,10 +1491,10 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslatedFrame* translated_frame,
|
|||||||
CHECK_EQ(0u, frame_writer.top_offset());
|
CHECK_EQ(0u, frame_writer.top_offset());
|
||||||
|
|
||||||
// Compute this frame's PC.
|
// Compute this frame's PC.
|
||||||
DCHECK(bailout_id.IsValidForConstructStub());
|
DCHECK(bytecode_offset.IsValidForConstructStub());
|
||||||
Address start = construct_stub.InstructionStart();
|
Address start = construct_stub.InstructionStart();
|
||||||
const int pc_offset =
|
const int pc_offset =
|
||||||
bailout_id == BytecodeOffset::ConstructStubCreate()
|
bytecode_offset == BytecodeOffset::ConstructStubCreate()
|
||||||
? isolate_->heap()->construct_stub_create_deopt_pc_offset().value()
|
? isolate_->heap()->construct_stub_create_deopt_pc_offset().value()
|
||||||
: isolate_->heap()->construct_stub_invoke_deopt_pc_offset().value();
|
: isolate_->heap()->construct_stub_invoke_deopt_pc_offset().value();
|
||||||
intptr_t pc_value = static_cast<intptr_t>(start + pc_offset);
|
intptr_t pc_value = static_cast<intptr_t>(start + pc_offset);
|
||||||
@ -1688,9 +1693,9 @@ void Deoptimizer::DoComputeBuiltinContinuation(
|
|||||||
|
|
||||||
TranslatedFrame::iterator value_iterator = translated_frame->begin();
|
TranslatedFrame::iterator value_iterator = translated_frame->begin();
|
||||||
|
|
||||||
const BytecodeOffset bailout_id = translated_frame->node_id();
|
const BytecodeOffset bytecode_offset = translated_frame->bytecode_offset();
|
||||||
Builtins::Name builtin_name =
|
Builtins::Name builtin_name =
|
||||||
Builtins::GetBuiltinFromBytecodeOffset(bailout_id);
|
Builtins::GetBuiltinFromBytecodeOffset(bytecode_offset);
|
||||||
CallInterfaceDescriptor continuation_descriptor =
|
CallInterfaceDescriptor continuation_descriptor =
|
||||||
Builtins::CallInterfaceDescriptorFor(builtin_name);
|
Builtins::CallInterfaceDescriptorFor(builtin_name);
|
||||||
|
|
||||||
@ -2034,7 +2039,6 @@ unsigned Deoptimizer::ComputeInputFrameSize() const {
|
|||||||
DCHECK(CodeKindCanDeoptimize(compiled_code_.kind()));
|
DCHECK(CodeKindCanDeoptimize(compiled_code_.kind()));
|
||||||
unsigned stack_slots = compiled_code_.stack_slots();
|
unsigned stack_slots = compiled_code_.stack_slots();
|
||||||
unsigned outgoing_size = 0;
|
unsigned outgoing_size = 0;
|
||||||
// ComputeOutgoingArgumentSize(compiled_code_, bailout_id_);
|
|
||||||
CHECK_EQ(fixed_size_above_fp + (stack_slots * kSystemPointerSize) -
|
CHECK_EQ(fixed_size_above_fp + (stack_slots * kSystemPointerSize) -
|
||||||
CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size,
|
CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size,
|
||||||
result);
|
result);
|
||||||
@ -2123,45 +2127,45 @@ Handle<ByteArray> TranslationBuffer::CreateByteArray(Factory* factory) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translation::BeginBuiltinContinuationFrame(BytecodeOffset bailout_id,
|
void Translation::BeginBuiltinContinuationFrame(BytecodeOffset bytecode_offset,
|
||||||
int literal_id,
|
int literal_id,
|
||||||
unsigned height) {
|
unsigned height) {
|
||||||
buffer_->Add(BUILTIN_CONTINUATION_FRAME);
|
buffer_->Add(BUILTIN_CONTINUATION_FRAME);
|
||||||
buffer_->Add(bailout_id.ToInt());
|
buffer_->Add(bytecode_offset.ToInt());
|
||||||
buffer_->Add(literal_id);
|
buffer_->Add(literal_id);
|
||||||
buffer_->Add(height);
|
buffer_->Add(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translation::BeginJSToWasmBuiltinContinuationFrame(
|
void Translation::BeginJSToWasmBuiltinContinuationFrame(
|
||||||
BytecodeOffset bailout_id, int literal_id, unsigned height,
|
BytecodeOffset bytecode_offset, int literal_id, unsigned height,
|
||||||
base::Optional<wasm::ValueType::Kind> return_type) {
|
base::Optional<wasm::ValueType::Kind> return_type) {
|
||||||
buffer_->Add(JS_TO_WASM_BUILTIN_CONTINUATION_FRAME);
|
buffer_->Add(JS_TO_WASM_BUILTIN_CONTINUATION_FRAME);
|
||||||
buffer_->Add(bailout_id.ToInt());
|
buffer_->Add(bytecode_offset.ToInt());
|
||||||
buffer_->Add(literal_id);
|
buffer_->Add(literal_id);
|
||||||
buffer_->Add(height);
|
buffer_->Add(height);
|
||||||
buffer_->Add(EncodeWasmReturnType(return_type));
|
buffer_->Add(EncodeWasmReturnType(return_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translation::BeginJavaScriptBuiltinContinuationFrame(
|
void Translation::BeginJavaScriptBuiltinContinuationFrame(
|
||||||
BytecodeOffset bailout_id, int literal_id, unsigned height) {
|
BytecodeOffset bytecode_offset, int literal_id, unsigned height) {
|
||||||
buffer_->Add(JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME);
|
buffer_->Add(JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME);
|
||||||
buffer_->Add(bailout_id.ToInt());
|
buffer_->Add(bytecode_offset.ToInt());
|
||||||
buffer_->Add(literal_id);
|
buffer_->Add(literal_id);
|
||||||
buffer_->Add(height);
|
buffer_->Add(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translation::BeginJavaScriptBuiltinContinuationWithCatchFrame(
|
void Translation::BeginJavaScriptBuiltinContinuationWithCatchFrame(
|
||||||
BytecodeOffset bailout_id, int literal_id, unsigned height) {
|
BytecodeOffset bytecode_offset, int literal_id, unsigned height) {
|
||||||
buffer_->Add(JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME);
|
buffer_->Add(JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME);
|
||||||
buffer_->Add(bailout_id.ToInt());
|
buffer_->Add(bytecode_offset.ToInt());
|
||||||
buffer_->Add(literal_id);
|
buffer_->Add(literal_id);
|
||||||
buffer_->Add(height);
|
buffer_->Add(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Translation::BeginConstructStubFrame(BytecodeOffset bailout_id,
|
void Translation::BeginConstructStubFrame(BytecodeOffset bytecode_offset,
|
||||||
int literal_id, unsigned height) {
|
int literal_id, unsigned height) {
|
||||||
buffer_->Add(CONSTRUCT_STUB_FRAME);
|
buffer_->Add(CONSTRUCT_STUB_FRAME);
|
||||||
buffer_->Add(bailout_id.ToInt());
|
buffer_->Add(bytecode_offset.ToInt());
|
||||||
buffer_->Add(literal_id);
|
buffer_->Add(literal_id);
|
||||||
buffer_->Add(height);
|
buffer_->Add(height);
|
||||||
}
|
}
|
||||||
@ -2446,7 +2450,7 @@ DeoptimizedFrameInfo::DeoptimizedFrameInfo(TranslatedState* state,
|
|||||||
|
|
||||||
DCHECK_EQ(TranslatedFrame::kInterpretedFunction, frame_it->kind());
|
DCHECK_EQ(TranslatedFrame::kInterpretedFunction, frame_it->kind());
|
||||||
source_position_ = Deoptimizer::ComputeSourcePositionFromBytecodeArray(
|
source_position_ = Deoptimizer::ComputeSourcePositionFromBytecodeArray(
|
||||||
isolate, *frame_it->shared_info(), frame_it->node_id());
|
isolate, *frame_it->shared_info(), frame_it->bytecode_offset());
|
||||||
|
|
||||||
DCHECK_EQ(parameter_count,
|
DCHECK_EQ(parameter_count,
|
||||||
function_->shared().internal_formal_parameter_count());
|
function_->shared().internal_formal_parameter_count());
|
||||||
@ -2508,10 +2512,11 @@ Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code code, Address pc) {
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
int Deoptimizer::ComputeSourcePositionFromBytecodeArray(
|
int Deoptimizer::ComputeSourcePositionFromBytecodeArray(
|
||||||
Isolate* isolate, SharedFunctionInfo shared, BytecodeOffset node_id) {
|
Isolate* isolate, SharedFunctionInfo shared,
|
||||||
|
BytecodeOffset bytecode_offset) {
|
||||||
DCHECK(shared.HasBytecodeArray());
|
DCHECK(shared.HasBytecodeArray());
|
||||||
return AbstractCode::cast(shared.GetBytecodeArray(isolate))
|
return AbstractCode::cast(shared.GetBytecodeArray(isolate))
|
||||||
.SourcePosition(node_id.ToInt());
|
.SourcePosition(bytecode_offset.ToInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@ -2867,7 +2872,7 @@ TranslatedFrame TranslatedFrame::InterpretedFrame(
|
|||||||
int return_value_offset, int return_value_count) {
|
int return_value_offset, int return_value_count) {
|
||||||
TranslatedFrame frame(kInterpretedFunction, shared_info, height,
|
TranslatedFrame frame(kInterpretedFunction, shared_info, height,
|
||||||
return_value_offset, return_value_count);
|
return_value_offset, return_value_count);
|
||||||
frame.node_id_ = bytecode_offset;
|
frame.bytecode_offset_ = bytecode_offset;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2877,40 +2882,44 @@ TranslatedFrame TranslatedFrame::ArgumentsAdaptorFrame(
|
|||||||
}
|
}
|
||||||
|
|
||||||
TranslatedFrame TranslatedFrame::ConstructStubFrame(
|
TranslatedFrame TranslatedFrame::ConstructStubFrame(
|
||||||
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
|
BytecodeOffset bytecode_offset, SharedFunctionInfo shared_info,
|
||||||
|
int height) {
|
||||||
TranslatedFrame frame(kConstructStub, shared_info, height);
|
TranslatedFrame frame(kConstructStub, shared_info, height);
|
||||||
frame.node_id_ = bailout_id;
|
frame.bytecode_offset_ = bytecode_offset;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslatedFrame TranslatedFrame::BuiltinContinuationFrame(
|
TranslatedFrame TranslatedFrame::BuiltinContinuationFrame(
|
||||||
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
|
BytecodeOffset bytecode_offset, SharedFunctionInfo shared_info,
|
||||||
|
int height) {
|
||||||
TranslatedFrame frame(kBuiltinContinuation, shared_info, height);
|
TranslatedFrame frame(kBuiltinContinuation, shared_info, height);
|
||||||
frame.node_id_ = bailout_id;
|
frame.bytecode_offset_ = bytecode_offset;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslatedFrame TranslatedFrame::JSToWasmBuiltinContinuationFrame(
|
TranslatedFrame TranslatedFrame::JSToWasmBuiltinContinuationFrame(
|
||||||
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height,
|
BytecodeOffset bytecode_offset, SharedFunctionInfo shared_info, int height,
|
||||||
base::Optional<wasm::ValueType::Kind> return_type) {
|
base::Optional<wasm::ValueType::Kind> return_type) {
|
||||||
TranslatedFrame frame(kJSToWasmBuiltinContinuation, shared_info, height);
|
TranslatedFrame frame(kJSToWasmBuiltinContinuation, shared_info, height);
|
||||||
frame.node_id_ = bailout_id;
|
frame.bytecode_offset_ = bytecode_offset;
|
||||||
frame.return_type_ = return_type;
|
frame.return_type_ = return_type;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationFrame(
|
TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationFrame(
|
||||||
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
|
BytecodeOffset bytecode_offset, SharedFunctionInfo shared_info,
|
||||||
|
int height) {
|
||||||
TranslatedFrame frame(kJavaScriptBuiltinContinuation, shared_info, height);
|
TranslatedFrame frame(kJavaScriptBuiltinContinuation, shared_info, height);
|
||||||
frame.node_id_ = bailout_id;
|
frame.bytecode_offset_ = bytecode_offset;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationWithCatchFrame(
|
TranslatedFrame TranslatedFrame::JavaScriptBuiltinContinuationWithCatchFrame(
|
||||||
BytecodeOffset bailout_id, SharedFunctionInfo shared_info, int height) {
|
BytecodeOffset bytecode_offset, SharedFunctionInfo shared_info,
|
||||||
|
int height) {
|
||||||
TranslatedFrame frame(kJavaScriptBuiltinContinuationWithCatch, shared_info,
|
TranslatedFrame frame(kJavaScriptBuiltinContinuationWithCatch, shared_info,
|
||||||
height);
|
height);
|
||||||
frame.node_id_ = bailout_id;
|
frame.bytecode_offset_ = bytecode_offset;
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2999,22 +3008,22 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Translation::CONSTRUCT_STUB_FRAME: {
|
case Translation::CONSTRUCT_STUB_FRAME: {
|
||||||
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
|
BytecodeOffset bytecode_offset = BytecodeOffset(iterator->Next());
|
||||||
SharedFunctionInfo shared_info =
|
SharedFunctionInfo shared_info =
|
||||||
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
||||||
int height = iterator->Next();
|
int height = iterator->Next();
|
||||||
if (trace_file != nullptr) {
|
if (trace_file != nullptr) {
|
||||||
std::unique_ptr<char[]> name = shared_info.DebugNameCStr();
|
std::unique_ptr<char[]> name = shared_info.DebugNameCStr();
|
||||||
PrintF(trace_file, " reading construct stub frame %s", name.get());
|
PrintF(trace_file, " reading construct stub frame %s", name.get());
|
||||||
PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n",
|
PrintF(trace_file, " => bytecode_offset=%d, height=%d; inputs:\n",
|
||||||
bailout_id.ToInt(), height);
|
bytecode_offset.ToInt(), height);
|
||||||
}
|
}
|
||||||
return TranslatedFrame::ConstructStubFrame(bailout_id, shared_info,
|
return TranslatedFrame::ConstructStubFrame(bytecode_offset, shared_info,
|
||||||
height);
|
height);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Translation::BUILTIN_CONTINUATION_FRAME: {
|
case Translation::BUILTIN_CONTINUATION_FRAME: {
|
||||||
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
|
BytecodeOffset bytecode_offset = BytecodeOffset(iterator->Next());
|
||||||
SharedFunctionInfo shared_info =
|
SharedFunctionInfo shared_info =
|
||||||
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
||||||
int height = iterator->Next();
|
int height = iterator->Next();
|
||||||
@ -3022,15 +3031,15 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
|
|||||||
std::unique_ptr<char[]> name = shared_info.DebugNameCStr();
|
std::unique_ptr<char[]> name = shared_info.DebugNameCStr();
|
||||||
PrintF(trace_file, " reading builtin continuation frame %s",
|
PrintF(trace_file, " reading builtin continuation frame %s",
|
||||||
name.get());
|
name.get());
|
||||||
PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n",
|
PrintF(trace_file, " => bytecode_offset=%d, height=%d; inputs:\n",
|
||||||
bailout_id.ToInt(), height);
|
bytecode_offset.ToInt(), height);
|
||||||
}
|
}
|
||||||
return TranslatedFrame::BuiltinContinuationFrame(bailout_id, shared_info,
|
return TranslatedFrame::BuiltinContinuationFrame(bytecode_offset,
|
||||||
height);
|
shared_info, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Translation::JS_TO_WASM_BUILTIN_CONTINUATION_FRAME: {
|
case Translation::JS_TO_WASM_BUILTIN_CONTINUATION_FRAME: {
|
||||||
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
|
BytecodeOffset bytecode_offset = BytecodeOffset(iterator->Next());
|
||||||
SharedFunctionInfo shared_info =
|
SharedFunctionInfo shared_info =
|
||||||
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
||||||
int height = iterator->Next();
|
int height = iterator->Next();
|
||||||
@ -3041,16 +3050,16 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
|
|||||||
PrintF(trace_file, " reading JS to Wasm builtin continuation frame %s",
|
PrintF(trace_file, " reading JS to Wasm builtin continuation frame %s",
|
||||||
name.get());
|
name.get());
|
||||||
PrintF(trace_file,
|
PrintF(trace_file,
|
||||||
" => bailout_id=%d, height=%d return_type=%d; inputs:\n",
|
" => bytecode_offset=%d, height=%d return_type=%d; inputs:\n",
|
||||||
bailout_id.ToInt(), height,
|
bytecode_offset.ToInt(), height,
|
||||||
return_type.has_value() ? return_type.value() : -1);
|
return_type.has_value() ? return_type.value() : -1);
|
||||||
}
|
}
|
||||||
return TranslatedFrame::JSToWasmBuiltinContinuationFrame(
|
return TranslatedFrame::JSToWasmBuiltinContinuationFrame(
|
||||||
bailout_id, shared_info, height, return_type);
|
bytecode_offset, shared_info, height, return_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
case Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME: {
|
case Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_FRAME: {
|
||||||
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
|
BytecodeOffset bytecode_offset = BytecodeOffset(iterator->Next());
|
||||||
SharedFunctionInfo shared_info =
|
SharedFunctionInfo shared_info =
|
||||||
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
||||||
int height = iterator->Next();
|
int height = iterator->Next();
|
||||||
@ -3058,14 +3067,14 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
|
|||||||
std::unique_ptr<char[]> name = shared_info.DebugNameCStr();
|
std::unique_ptr<char[]> name = shared_info.DebugNameCStr();
|
||||||
PrintF(trace_file, " reading JavaScript builtin continuation frame %s",
|
PrintF(trace_file, " reading JavaScript builtin continuation frame %s",
|
||||||
name.get());
|
name.get());
|
||||||
PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n",
|
PrintF(trace_file, " => bytecode_offset=%d, height=%d; inputs:\n",
|
||||||
bailout_id.ToInt(), height);
|
bytecode_offset.ToInt(), height);
|
||||||
}
|
}
|
||||||
return TranslatedFrame::JavaScriptBuiltinContinuationFrame(
|
return TranslatedFrame::JavaScriptBuiltinContinuationFrame(
|
||||||
bailout_id, shared_info, height);
|
bytecode_offset, shared_info, height);
|
||||||
}
|
}
|
||||||
case Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME: {
|
case Translation::JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH_FRAME: {
|
||||||
BytecodeOffset bailout_id = BytecodeOffset(iterator->Next());
|
BytecodeOffset bytecode_offset = BytecodeOffset(iterator->Next());
|
||||||
SharedFunctionInfo shared_info =
|
SharedFunctionInfo shared_info =
|
||||||
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
SharedFunctionInfo::cast(literal_array.get(iterator->Next()));
|
||||||
int height = iterator->Next();
|
int height = iterator->Next();
|
||||||
@ -3074,11 +3083,11 @@ TranslatedFrame TranslatedState::CreateNextTranslatedFrame(
|
|||||||
PrintF(trace_file,
|
PrintF(trace_file,
|
||||||
" reading JavaScript builtin continuation frame with catch %s",
|
" reading JavaScript builtin continuation frame with catch %s",
|
||||||
name.get());
|
name.get());
|
||||||
PrintF(trace_file, " => bailout_id=%d, height=%d; inputs:\n",
|
PrintF(trace_file, " => bytecode_offset=%d, height=%d; inputs:\n",
|
||||||
bailout_id.ToInt(), height);
|
bytecode_offset.ToInt(), height);
|
||||||
}
|
}
|
||||||
return TranslatedFrame::JavaScriptBuiltinContinuationWithCatchFrame(
|
return TranslatedFrame::JavaScriptBuiltinContinuationWithCatchFrame(
|
||||||
bailout_id, shared_info, height);
|
bytecode_offset, shared_info, height);
|
||||||
}
|
}
|
||||||
case Translation::UPDATE_FEEDBACK:
|
case Translation::UPDATE_FEEDBACK:
|
||||||
case Translation::BEGIN:
|
case Translation::BEGIN:
|
||||||
|
@ -185,7 +185,7 @@ class TranslatedFrame {
|
|||||||
int GetValueCount();
|
int GetValueCount();
|
||||||
|
|
||||||
Kind kind() const { return kind_; }
|
Kind kind() const { return kind_; }
|
||||||
BytecodeOffset node_id() const { return node_id_; }
|
BytecodeOffset bytecode_offset() const { return bytecode_offset_; }
|
||||||
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
|
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
|
||||||
|
|
||||||
// TODO(jgruber): Simplify/clarify the semantics of this field. The name
|
// TODO(jgruber): Simplify/clarify the semantics of this field. The name
|
||||||
@ -293,7 +293,7 @@ class TranslatedFrame {
|
|||||||
int height = 0, int return_value_offset = 0,
|
int height = 0, int return_value_offset = 0,
|
||||||
int return_value_count = 0)
|
int return_value_count = 0)
|
||||||
: kind_(kind),
|
: kind_(kind),
|
||||||
node_id_(BytecodeOffset::None()),
|
bytecode_offset_(BytecodeOffset::None()),
|
||||||
raw_shared_info_(shared_info),
|
raw_shared_info_(shared_info),
|
||||||
height_(height),
|
height_(height),
|
||||||
return_value_offset_(return_value_offset),
|
return_value_offset_(return_value_offset),
|
||||||
@ -304,7 +304,7 @@ class TranslatedFrame {
|
|||||||
void Handlify();
|
void Handlify();
|
||||||
|
|
||||||
Kind kind_;
|
Kind kind_;
|
||||||
BytecodeOffset node_id_;
|
BytecodeOffset bytecode_offset_;
|
||||||
SharedFunctionInfo raw_shared_info_;
|
SharedFunctionInfo raw_shared_info_;
|
||||||
Handle<SharedFunctionInfo> shared_info_;
|
Handle<SharedFunctionInfo> shared_info_;
|
||||||
int height_;
|
int height_;
|
||||||
@ -442,12 +442,6 @@ class TranslatedState {
|
|||||||
FeedbackSlot feedback_slot_;
|
FeedbackSlot feedback_slot_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OptimizedFunctionVisitor {
|
|
||||||
public:
|
|
||||||
virtual ~OptimizedFunctionVisitor() = default;
|
|
||||||
virtual void VisitFunction(JSFunction function) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class Deoptimizer : public Malloced {
|
class Deoptimizer : public Malloced {
|
||||||
public:
|
public:
|
||||||
struct DeoptInfo {
|
struct DeoptInfo {
|
||||||
@ -464,9 +458,9 @@ class Deoptimizer : public Malloced {
|
|||||||
|
|
||||||
static DeoptInfo GetDeoptInfo(Code code, Address from);
|
static DeoptInfo GetDeoptInfo(Code code, Address from);
|
||||||
|
|
||||||
static int ComputeSourcePositionFromBytecodeArray(Isolate* isolate,
|
static int ComputeSourcePositionFromBytecodeArray(
|
||||||
SharedFunctionInfo shared,
|
Isolate* isolate, SharedFunctionInfo shared,
|
||||||
BytecodeOffset node_id);
|
BytecodeOffset bytecode_offset);
|
||||||
|
|
||||||
static const char* MessageFor(DeoptimizeKind kind, bool reuse_code);
|
static const char* MessageFor(DeoptimizeKind kind, bool reuse_code);
|
||||||
|
|
||||||
@ -482,8 +476,8 @@ class Deoptimizer : public Malloced {
|
|||||||
bool should_reuse_code() const;
|
bool should_reuse_code() const;
|
||||||
|
|
||||||
static Deoptimizer* New(Address raw_function, DeoptimizeKind kind,
|
static Deoptimizer* New(Address raw_function, DeoptimizeKind kind,
|
||||||
unsigned bailout_id, Address from, int fp_to_sp_delta,
|
unsigned deopt_exit_index, Address from,
|
||||||
Isolate* isolate);
|
int fp_to_sp_delta, Isolate* isolate);
|
||||||
static Deoptimizer* Grab(Isolate* isolate);
|
static Deoptimizer* Grab(Isolate* isolate);
|
||||||
|
|
||||||
// The returned object with information on the optimized frame needs to be
|
// The returned object with information on the optimized frame needs to be
|
||||||
@ -549,9 +543,10 @@ class Deoptimizer : public Malloced {
|
|||||||
|
|
||||||
static constexpr int kMaxNumberOfEntries = 16384;
|
static constexpr int kMaxNumberOfEntries = 16384;
|
||||||
|
|
||||||
// This marker is passed to Deoptimizer::New as {bailout_id} on platforms
|
// This marker is passed to Deoptimizer::New as {deopt_exit_index} on
|
||||||
// that have fixed deopt sizes (see also kSupportsFixedDeoptExitSizes). The
|
// platforms that have fixed deopt sizes (see also
|
||||||
// actual deoptimization id is then calculated from the return address.
|
// kSupportsFixedDeoptExitSizes). The actual deoptimization id is then
|
||||||
|
// calculated from the return address.
|
||||||
static constexpr unsigned kFixedExitSizeMarker = kMaxUInt32;
|
static constexpr unsigned kFixedExitSizeMarker = kMaxUInt32;
|
||||||
|
|
||||||
// Set to true when the architecture supports deoptimization exit sequences
|
// Set to true when the architecture supports deoptimization exit sequences
|
||||||
@ -581,7 +576,7 @@ class Deoptimizer : public Malloced {
|
|||||||
const TranslatedFrame::iterator& iterator);
|
const TranslatedFrame::iterator& iterator);
|
||||||
|
|
||||||
Deoptimizer(Isolate* isolate, JSFunction function, DeoptimizeKind kind,
|
Deoptimizer(Isolate* isolate, JSFunction function, DeoptimizeKind kind,
|
||||||
unsigned bailout_id, Address from, int fp_to_sp_delta);
|
unsigned deopt_exit_index, Address from, int fp_to_sp_delta);
|
||||||
Code FindOptimizedCode();
|
Code FindOptimizedCode();
|
||||||
void DeleteFrameDescriptions();
|
void DeleteFrameDescriptions();
|
||||||
|
|
||||||
@ -607,7 +602,6 @@ class Deoptimizer : public Malloced {
|
|||||||
unsigned ComputeInputFrameSize() const;
|
unsigned ComputeInputFrameSize() const;
|
||||||
|
|
||||||
static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo shared);
|
static unsigned ComputeIncomingArgumentSize(SharedFunctionInfo shared);
|
||||||
static unsigned ComputeOutgoingArgumentSize(Code code, unsigned bailout_id);
|
|
||||||
|
|
||||||
static void MarkAllCodeForContext(NativeContext native_context);
|
static void MarkAllCodeForContext(NativeContext native_context);
|
||||||
static void DeoptimizeMarkedCodeForContext(NativeContext native_context);
|
static void DeoptimizeMarkedCodeForContext(NativeContext native_context);
|
||||||
@ -625,7 +619,7 @@ class Deoptimizer : public Malloced {
|
|||||||
CodeTracer::Scope* verbose_trace_scope() const {
|
CodeTracer::Scope* verbose_trace_scope() const {
|
||||||
return FLAG_trace_deopt_verbose ? trace_scope() : nullptr;
|
return FLAG_trace_deopt_verbose ? trace_scope() : nullptr;
|
||||||
}
|
}
|
||||||
void TraceDeoptBegin(int optimization_id, int node_id);
|
void TraceDeoptBegin(int optimization_id, BytecodeOffset bytecode_offset);
|
||||||
void TraceDeoptEnd(double deopt_duration);
|
void TraceDeoptEnd(double deopt_duration);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static void TraceFoundActivation(Isolate* isolate, JSFunction function);
|
static void TraceFoundActivation(Isolate* isolate, JSFunction function);
|
||||||
@ -636,7 +630,7 @@ class Deoptimizer : public Malloced {
|
|||||||
Isolate* isolate_;
|
Isolate* isolate_;
|
||||||
JSFunction function_;
|
JSFunction function_;
|
||||||
Code compiled_code_;
|
Code compiled_code_;
|
||||||
unsigned bailout_id_;
|
unsigned deopt_exit_index_;
|
||||||
DeoptimizeKind deopt_kind_;
|
DeoptimizeKind deopt_kind_;
|
||||||
Address from_;
|
Address from_;
|
||||||
int fp_to_sp_delta_;
|
int fp_to_sp_delta_;
|
||||||
|
@ -1551,13 +1551,13 @@ void OptimizedFrame::Summarize(std::vector<FrameSummary>* frames) const {
|
|||||||
it->kind() ==
|
it->kind() ==
|
||||||
TranslatedFrame::kJavaScriptBuiltinContinuationWithCatch) {
|
TranslatedFrame::kJavaScriptBuiltinContinuationWithCatch) {
|
||||||
code_offset = 0;
|
code_offset = 0;
|
||||||
abstract_code =
|
abstract_code = handle(
|
||||||
handle(AbstractCode::cast(isolate()->builtins()->builtin(
|
AbstractCode::cast(isolate()->builtins()->builtin(
|
||||||
Builtins::GetBuiltinFromBytecodeOffset(it->node_id()))),
|
Builtins::GetBuiltinFromBytecodeOffset(it->bytecode_offset()))),
|
||||||
isolate());
|
isolate());
|
||||||
} else {
|
} else {
|
||||||
DCHECK_EQ(it->kind(), TranslatedFrame::kInterpretedFunction);
|
DCHECK_EQ(it->kind(), TranslatedFrame::kInterpretedFunction);
|
||||||
code_offset = it->node_id().ToInt(); // Points to current bytecode.
|
code_offset = it->bytecode_offset().ToInt();
|
||||||
abstract_code =
|
abstract_code =
|
||||||
handle(shared_info->abstract_code(isolate()), isolate());
|
handle(shared_info->abstract_code(isolate()), isolate());
|
||||||
}
|
}
|
||||||
|
@ -322,8 +322,8 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
|||||||
|
|
||||||
// Determine the entry point for which this OSR request has been fired and
|
// Determine the entry point for which this OSR request has been fired and
|
||||||
// also disarm all back edges in the calling code to stop new requests.
|
// also disarm all back edges in the calling code to stop new requests.
|
||||||
BytecodeOffset ast_id = DetermineEntryAndDisarmOSRForInterpreter(frame);
|
BytecodeOffset osr_offset = DetermineEntryAndDisarmOSRForInterpreter(frame);
|
||||||
DCHECK(!ast_id.IsNone());
|
DCHECK(!osr_offset.IsNone());
|
||||||
|
|
||||||
MaybeHandle<Code> maybe_result;
|
MaybeHandle<Code> maybe_result;
|
||||||
Handle<JSFunction> function(frame->function(), isolate);
|
Handle<JSFunction> function(frame->function(), isolate);
|
||||||
@ -332,9 +332,10 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
|||||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||||
PrintF(scope.file(), "[OSR - Compiling: ");
|
PrintF(scope.file(), "[OSR - Compiling: ");
|
||||||
function->PrintName(scope.file());
|
function->PrintName(scope.file());
|
||||||
PrintF(scope.file(), " at AST id %d]\n", ast_id.ToInt());
|
PrintF(scope.file(), " at OSR bytecode offset %d]\n", osr_offset.ToInt());
|
||||||
}
|
}
|
||||||
maybe_result = Compiler::GetOptimizedCodeForOSR(function, ast_id, frame);
|
maybe_result =
|
||||||
|
Compiler::GetOptimizedCodeForOSR(function, osr_offset, frame);
|
||||||
|
|
||||||
// Possibly compile for NCI caching.
|
// Possibly compile for NCI caching.
|
||||||
if (!MaybeSpawnNativeContextIndependentCompilationJob(
|
if (!MaybeSpawnNativeContextIndependentCompilationJob(
|
||||||
@ -353,12 +354,13 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
|||||||
DeoptimizationData::cast(result->deoptimization_data());
|
DeoptimizationData::cast(result->deoptimization_data());
|
||||||
|
|
||||||
if (data.OsrPcOffset().value() >= 0) {
|
if (data.OsrPcOffset().value() >= 0) {
|
||||||
DCHECK(BytecodeOffset(data.OsrBytecodeOffset().value()) == ast_id);
|
DCHECK(BytecodeOffset(data.OsrBytecodeOffset().value()) == osr_offset);
|
||||||
if (FLAG_trace_osr) {
|
if (FLAG_trace_osr) {
|
||||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||||
PrintF(scope.file(),
|
PrintF(scope.file(),
|
||||||
"[OSR - Entry at AST id %d, offset %d in optimized code]\n",
|
"[OSR - Entry at OSR bytecode offset %d, offset %d in optimized "
|
||||||
ast_id.ToInt(), data.OsrPcOffset().value());
|
"code]\n",
|
||||||
|
osr_offset.ToInt(), data.OsrPcOffset().value());
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(result->is_turbofanned());
|
DCHECK(result->is_turbofanned());
|
||||||
@ -402,7 +404,7 @@ RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
|
|||||||
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
CodeTracer::Scope scope(isolate->GetCodeTracer());
|
||||||
PrintF(scope.file(), "[OSR - Failed: ");
|
PrintF(scope.file(), "[OSR - Failed: ");
|
||||||
function->PrintName(scope.file());
|
function->PrintName(scope.file());
|
||||||
PrintF(scope.file(), " at AST id %d]\n", ast_id.ToInt());
|
PrintF(scope.file(), " at OSR bytecode offset %d]\n", osr_offset.ToInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!function->HasAttachedOptimizedCode()) {
|
if (!function->HasAttachedOptimizedCode()) {
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// This tests that we do not share optimized code across closures that
|
// This tests that we do not share optimized code across closures that were
|
||||||
// were optimized using OSR (for a particular OSR entry AST id) even if
|
// optimized using OSR (for a particular OSR entry bytecode offset) even if
|
||||||
// caching of optimized code kicks in.
|
// caching of optimized code kicks in.
|
||||||
|
|
||||||
function makeClosure() {
|
function makeClosure() {
|
||||||
|
Loading…
Reference in New Issue
Block a user