Commit 7b8d7604 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [interpreter] Fix self-healing with preserved bytecode.

Port 4598d913

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.

R=mstarzinger@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=chromium:638225
LOG=N

Review-Url: https://codereview.chromium.org/2265193002
Cr-Commit-Position: refs/heads/master@{#38799}
parent 253d4e84
......@@ -1077,11 +1077,14 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex));
__ bind(&array_done);
// Check whether we should continue to use the interpreter.
Label switch_to_different_code_kind;
__ LoadP(r3, FieldMemOperand(r3, SharedFunctionInfo::kCodeOffset));
__ mov(ip, Operand(masm->CodeObject())); // Self-reference to this code.
__ cmp(r3, ip);
__ bne(&switch_to_different_code_kind);
// Check function data field is actually a BytecodeArray object.
Label bytecode_array_not_present;
__ CompareRoot(kInterpreterBytecodeArrayRegister,
Heap::kUndefinedValueRootIndex);
__ beq(&bytecode_array_not_present);
if (FLAG_debug_code) {
__ TestIfSmi(kInterpreterBytecodeArrayRegister, r0);
......@@ -1146,10 +1149,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
LeaveInterpreterFrame(masm, r5);
__ blr();
// 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);
__ LeaveFrame(StackFrame::JAVA_SCRIPT);
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset));
......
......@@ -1081,12 +1081,13 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
FieldMemOperand(debug_info, DebugInfo::kDebugBytecodeArrayIndex));
__ bind(&array_done);
// Check function data field is actually a BytecodeArray object.
Label bytecode_array_not_present;
__ CompareRoot(kInterpreterBytecodeArrayRegister,
Heap::kUndefinedValueRootIndex);
__ beq(&bytecode_array_not_present);
// Check whether we should continue to use the interpreter.
Label switch_to_different_code_kind;
__ LoadP(r2, FieldMemOperand(r2, SharedFunctionInfo::kCodeOffset));
__ CmpP(r2, Operand(masm->CodeObject())); // Self-reference to this code.
__ bne(&switch_to_different_code_kind);
// Check function data field is actually a BytecodeArray object.
if (FLAG_debug_code) {
__ TestIfSmi(kInterpreterBytecodeArrayRegister);
__ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
......@@ -1152,10 +1153,10 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
LeaveInterpreterFrame(masm, r4);
__ Ret();
// 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);
__ LeaveFrame(StackFrame::JAVA_SCRIPT);
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset));
......
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