Commit 32eade63 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Fix deopting from inline functions.

Rename IntepreterExceptionEntryHandler builtin to InterpreterEnterBytecodeDispatch
and use it as the return address when building interpreter frames during deopt.
This ensures that we restart execution of the outer frame at the correct
bytecode.

BUG=v8:4280,v8:4678
LOG=N

Review URL: https://codereview.chromium.org/1633633002

Cr-Commit-Position: refs/heads/master@{#33512}
parent 4e234f27
......@@ -1145,8 +1145,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -1104,8 +1104,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -209,7 +209,7 @@ inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) {
V(InterpreterNotifyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
V(InterpreterNotifySoftDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
V(InterpreterNotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, kNoExtraICState) \
V(InterpreterEnterExceptionHandler, BUILTIN, UNINITIALIZED, kNoExtraICState) \
V(InterpreterEnterBytecodeDispatch, BUILTIN, UNINITIALIZED, kNoExtraICState) \
\
V(LoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
V(KeyedLoadIC_Miss, BUILTIN, UNINITIALIZED, kNoExtraICState) \
......@@ -565,7 +565,7 @@ class Builtins {
static void Generate_InterpreterNotifyDeoptimized(MacroAssembler* masm);
static void Generate_InterpreterNotifySoftDeoptimized(MacroAssembler* masm);
static void Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm);
static void Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm);
static void Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm);
#define DECLARE_CODE_AGE_BUILTIN_GENERATOR(C) \
static void Generate_Make##C##CodeYoungAgainEvenMarking( \
......
......@@ -1211,14 +1211,15 @@ void Deoptimizer::DoComputeInterpretedFrame(int frame_index) {
value_iterator++;
Builtins* builtins = isolate_->builtins();
Code* trampoline = builtins->builtin(Builtins::kInterpreterEntryTrampoline);
output_frame->SetPc(reinterpret_cast<intptr_t>(trampoline->entry()));
Code* dispatch_builtin =
builtins->builtin(Builtins::kInterpreterEnterBytecodeDispatch);
output_frame->SetPc(reinterpret_cast<intptr_t>(dispatch_builtin->entry()));
output_frame->SetState(0);
// Update constant pool.
if (FLAG_enable_embedded_constant_pool) {
intptr_t constant_pool_value =
reinterpret_cast<intptr_t>(trampoline->constant_pool());
reinterpret_cast<intptr_t>(dispatch_builtin->constant_pool());
output_frame->SetConstantPool(constant_pool_value);
if (is_topmost) {
Register constant_pool_reg =
......
......@@ -446,7 +446,8 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
return ARGUMENTS_ADAPTOR;
} else {
// The interpreter entry trampoline has a non-SMI marker.
DCHECK(code_obj->is_interpreter_entry_trampoline());
DCHECK(code_obj->is_interpreter_entry_trampoline() ||
code_obj->is_interpreter_enter_bytecode_dispatch());
return INTERPRETED;
}
}
......
......@@ -853,8 +853,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -1129,7 +1129,7 @@ Object* Isolate::UnwindAndFindHandler() {
offset = 0;
// Gather information from the frame.
code = *builtins()->InterpreterEnterExceptionHandler();
code = *builtins()->InterpreterEnterBytecodeDispatch();
handler_sp = frame->sp();
handler_fp = frame->fp();
break;
......
......@@ -1136,8 +1136,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -1127,8 +1127,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -4901,6 +4901,13 @@ inline bool Code::is_interpreter_entry_trampoline() {
return interpreter_entry.location() != nullptr && *interpreter_entry == this;
}
inline bool Code::is_interpreter_enter_bytecode_dispatch() {
Handle<Code> interpreter_handler =
GetIsolate()->builtins()->InterpreterEnterBytecodeDispatch();
return interpreter_handler.location() != nullptr &&
*interpreter_handler == this;
}
inline void Code::set_is_crankshafted(bool value) {
int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset);
int updated = IsCrankshaftedField::update(previous, value);
......
......@@ -4946,7 +4946,6 @@ class Code: public HeapObject {
inline bool is_to_boolean_ic_stub();
inline bool is_keyed_stub();
inline bool is_optimized_code();
inline bool is_interpreter_entry_trampoline();
inline bool embeds_maps_weakly();
inline bool IsCodeStubOrIC();
......@@ -4955,6 +4954,10 @@ class Code: public HeapObject {
inline void set_raw_kind_specific_flags1(int value);
inline void set_raw_kind_specific_flags2(int value);
// Testers for interpreter builtins.
inline bool is_interpreter_entry_trampoline();
inline bool is_interpreter_enter_bytecode_dispatch();
// [is_crankshafted]: For kind STUB or ICs, tells whether or not a code
// object was generated by either the hydrogen or the TurboFan optimizing
// compiler (but it may not be an optimized function).
......
......@@ -1132,8 +1132,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -901,8 +901,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -854,8 +854,7 @@ void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
}
void Builtins::Generate_InterpreterEnterExceptionHandler(MacroAssembler* masm) {
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the address of the interpreter entry trampoline as a return address.
// This simulates the initial call to bytecode handlers in interpreter entry
// trampoline. The return will never actually be taken, but our stack walker
......
......@@ -772,17 +772,11 @@
'array-literal-transitions': [SKIP],
'break': [SKIP],
'call-runtime-tail': [SKIP],
'compiler/compare-map-elim2': [SKIP],
'compiler/deopt-inlined-smi': [SKIP],
'compiler/deopt-tonumber-compare': [SKIP],
'compiler/expression-trees': [SKIP],
'compiler/inline-arguments': [SKIP],
'compiler/inline-arity-mismatch': [SKIP],
'compiler/inline-construct': [SKIP],
'compiler/lazy-deopt-in-literal': [SKIP],
'compiler/optimized-for-in': [SKIP],
'compiler/opt-next-call-turbo': [SKIP],
'compiler/property-refs': [SKIP],
'compiler/regress-3786': [SKIP],
'compiler/regress-446647': [SKIP],
'compiler/regress-447567': [SKIP],
......@@ -790,7 +784,6 @@
'compiler/regress-const': [SKIP],
'compiler/regress-funarguments': [SKIP],
'compiler/regress-stacktrace-methods': [SKIP],
'compiler/regress-variable-liveness': [SKIP],
'compiler/rotate': [SKIP],
'compiler/strict-recompile': [SKIP],
'compiler/try-binop': [SKIP],
......@@ -862,10 +855,8 @@
'regress/regress-2825': [SKIP],
'regress/regress-3138': [SKIP],
'regress/regress-318420': [SKIP],
'regress/regress-351261': [SKIP],
'regress/regress-353551': [SKIP],
'regress/regress-354357': [SKIP],
'regress/regress-359441': [SKIP],
'regress/regress-3926': [SKIP],
'regress/regress-3960': [SKIP],
'regress/regress-3969': [SKIP],
......@@ -910,12 +901,10 @@
'regress/regress-998565': [SKIP],
'regress/regress-arg-materialize-store': [SKIP],
'regress/regress-assignment-in-test-context': [SKIP],
'regress/regress-bce-underflow': [SKIP],
'regress/regress-conditional-position': [SKIP],
'regress/regress-crbug-109362': [SKIP],
'regress/regress-crbug-119800': [SKIP],
'regress/regress-crbug-135008': [SKIP],
'regress/regress-crbug-163530': [SKIP],
'regress/regress-crbug-259300': [SKIP],
'regress/regress-crbug-352058': [SKIP],
'regress/regress-crbug-357137': [SKIP],
......@@ -962,7 +951,6 @@
'regress/regress-osr-in-case-label': [SKIP],
'regress/regress-osr-in-literal': [SKIP],
'regress/regress-prepare-break-while-recompile': [SKIP],
'regress/regress-store-heapobject': [SKIP],
'regress/regress-typedarray-length': [SKIP],
'scope-calls-eval': [SKIP],
'shift-for-integer-div': [SKIP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment