Commit 60908503 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [interpreter] Fix self-healing with preserved bytecode.

  port 4598d913 (r38747)

  original commit message:
  This fixes the self-healing mechanism for closures in the interpreter
  entry trampoline not that bytecode can be preserved even when baseline
  code is already available.

BUG=

Review-Url: https://codereview.chromium.org/2273503003
Cr-Commit-Position: refs/heads/master@{#38856}
parent 3a9c7b55
......@@ -585,11 +585,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
FieldOperand(eax, SharedFunctionInfo::kFunctionDataOffset));
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
Label switch_to_different_code_kind;
__ Move(ecx, masm->CodeObject()); // Self-reference to this code.
__ cmp(ecx, FieldOperand(eax, SharedFunctionInfo::kCodeOffset));
__ j(not_equal, &switch_to_different_code_kind);
// Check function data field is actually a BytecodeArray object.
Label bytecode_array_not_present;
__ CompareRoot(kInterpreterBytecodeArrayRegister,
Heap::kUndefinedValueRootIndex);
__ j(equal, &bytecode_array_not_present);
if (FLAG_debug_code) {
__ AssertNotSmi(kInterpreterBytecodeArrayRegister);
__ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
......@@ -661,10 +663,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
FieldOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex));
__ jmp(&bytecode_array_loaded);
// If the bytecode array is no longer present, then the underlying function
// has been switched to a different kind of code and we heal the closure by
// switching the code entry field over to the new code object as well.
__ bind(&bytecode_array_not_present);
// If the shared code is no longer this entry trampoline, then the underlying
// function has been switched to a different kind of code and we heal the
// closure by switching the code entry field over to the new code as well.
__ bind(&switch_to_different_code_kind);
__ pop(edx); // Callee's new target.
__ pop(edi); // Callee's JS function.
__ pop(esi); // Callee's context.
......
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