Commit 845c27cd authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[interpreter] remove self-healing for LiveEdit.

R=rmcilroy@chromium.org

Bug: v8:6409
Change-Id: I8205ca3e9587f4cb1d35d7edc1aa320814020ac4
Reviewed-on: https://chromium-review.googlesource.com/616665Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47387}
parent 38f4749c
......@@ -1139,14 +1139,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ b(ne, &maybe_load_debug_bytecode_array);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
Label switch_to_different_code_kind;
__ ldr(r0, FieldMemOperand(r0, SharedFunctionInfo::kCodeOffset));
__ cmp(r0, Operand(masm->CodeObject())); // Self-reference to this code.
__ b(ne, &switch_to_different_code_kind);
// Increment invocation count for the function.
__ ldr(r9, FieldMemOperand(feedback_vector,
FeedbackVector::kInvocationCountOffset));
......@@ -1241,21 +1233,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ ldr(kInterpreterBytecodeArrayRegister,
FieldMemOperand(r4, DebugInfo::kDebugBytecodeArrayOffset), ne);
__ b(&bytecode_array_loaded);
// 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);
__ ldr(r4, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
__ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCodeOffset));
__ str(r4, FieldMemOperand(closure, JSFunction::kCodeOffset));
__ mov(r9, r4); // Write barrier clobbers r9 below.
__ RecordWriteField(closure, JSFunction::kCodeOffset, r9, r5,
kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(r4);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -1156,14 +1156,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ JumpIfNotSmi(x11, &maybe_load_debug_bytecode_array);
__ Bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
Label switch_to_different_code_kind;
__ Ldr(x0, FieldMemOperand(x0, SharedFunctionInfo::kCodeOffset));
__ Cmp(x0, Operand(masm->CodeObject())); // Self-reference to this code.
__ B(ne, &switch_to_different_code_kind);
// Increment invocation count for the function.
__ Ldr(x11, FieldMemOperand(closure, JSFunction::kFeedbackVectorOffset));
__ Ldr(x11, FieldMemOperand(x11, Cell::kValueOffset));
......@@ -1259,21 +1251,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Ldr(kInterpreterBytecodeArrayRegister,
FieldMemOperand(x11, DebugInfo::kDebugBytecodeArrayOffset));
__ B(&bytecode_array_loaded);
// 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);
__ Ldr(x7, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
__ Ldr(x7, FieldMemOperand(x7, SharedFunctionInfo::kCodeOffset));
__ Str(x7, FieldMemOperand(closure, JSFunction::kCodeOffset));
__ mov(x10, x7); // Write barrier clobbers x10 below.
__ RecordWriteField(closure, JSFunction::kCodeOffset, x10, x5,
kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ Add(x7, x7, Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(x7);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -794,15 +794,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
&maybe_load_debug_bytecode_array);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
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);
// Increment invocation count for the function.
__ inc(FieldOperand(feedback_vector, FeedbackVector::kInvocationCountOffset));
// Check function data field is actually a BytecodeArray object.
......@@ -899,22 +890,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ mov(kInterpreterBytecodeArrayRegister,
FieldOperand(ecx, DebugInfo::kDebugBytecodeArrayOffset));
__ jmp(&bytecode_array_loaded);
// 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(edi); // Callee's JS function.
__ pop(esi); // Callee's context.
__ leave(); // Leave the frame so we can tail call.
__ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
__ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kCodeOffset));
__ mov(FieldOperand(edi, JSFunction::kCodeOffset), ecx);
__ mov(eax, ecx); // Write barrier clobbers eax below.
__ RecordWriteField(edi, JSFunction::kCodeOffset, eax, ebx, kDontSaveFPRegs,
OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
__ lea(ecx, FieldOperand(ecx, Code::kHeaderSize));
__ jmp(ecx);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -1119,14 +1119,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ JumpIfNotSmi(t0, &maybe_load_debug_bytecode_array);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
Label switch_to_different_code_kind;
__ lw(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset));
__ Branch(&switch_to_different_code_kind, ne, a0,
Operand(masm->CodeObject())); // Self-reference to this code.
// Increment invocation count for the function.
__ lw(t0, FieldMemOperand(feedback_vector,
FeedbackVector::kInvocationCountOffset));
......@@ -1227,20 +1219,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ lw(kInterpreterBytecodeArrayRegister,
FieldMemOperand(t0, DebugInfo::kDebugBytecodeArrayOffset));
__ Branch(&bytecode_array_loaded);
// 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);
__ lw(t0, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
__ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kCodeOffset));
__ sw(t0, FieldMemOperand(closure, JSFunction::kCodeOffset));
__ mov(t3, t0); // Write barrier clobbers t3 below.
__ RecordWriteField(closure, JSFunction::kCodeOffset, t3, t1,
kRAHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ Jump(t0, Code::kHeaderSize - kHeapObjectTag);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -1123,14 +1123,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ JumpIfNotSmi(a4, &maybe_load_debug_bytecode_array);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
Label switch_to_different_code_kind;
__ Ld(a0, FieldMemOperand(a0, SharedFunctionInfo::kCodeOffset));
__ Branch(&switch_to_different_code_kind, ne, a0,
Operand(masm->CodeObject())); // Self-reference to this code.
// Increment invocation count for the function.
__ Lw(a4, FieldMemOperand(feedback_vector,
FeedbackVector::kInvocationCountOffset));
......@@ -1231,21 +1223,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ Ld(kInterpreterBytecodeArrayRegister,
FieldMemOperand(a4, DebugInfo::kDebugBytecodeArrayOffset));
__ Branch(&bytecode_array_loaded);
// 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);
__ Ld(a4, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
__ Ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kCodeOffset));
__ Sd(a4, FieldMemOperand(closure, JSFunction::kCodeOffset));
__ mov(t3, a4); // Write barrier clobbers t3 below.
__ RecordWriteField(closure, JSFunction::kCodeOffset, t3, a5,
kRAHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ Daddu(a4, a4, Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(a4);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -1158,15 +1158,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bne(&maybe_load_debug_bytecode_array, cr0);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
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);
// Increment invocation count for the function.
__ LoadP(r8, FieldMemOperand(feedback_vector,
FeedbackVector::kInvocationCountOffset));
......@@ -1273,23 +1264,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
FieldMemOperand(r7, DebugInfo::kDebugBytecodeArrayOffset));
__ bind(&done);
__ b(&bytecode_array_loaded);
// 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(closure, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset));
__ StoreP(r7, FieldMemOperand(closure, JSFunction::kCodeOffset), r0);
__ mr(r9, r7); // Write barrier clobbers r9 below.
__ RecordWriteField(closure, JSFunction::kCodeOffset, r9, r8,
kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag));
__ JumpToJSEntry(r7);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -1156,14 +1156,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bne(&maybe_load_debug_bytecode_array);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
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);
// Increment invocation count for the function.
__ LoadP(r1, FieldMemOperand(feedback_vector,
FeedbackVector::kInvocationCountOffset));
......@@ -1268,21 +1260,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
FieldMemOperand(r6, DebugInfo::kDebugBytecodeArrayOffset));
__ bind(&done);
__ b(&bytecode_array_loaded);
// 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(closure, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset));
__ StoreP(r6, FieldMemOperand(closure, JSFunction::kCodeOffset), r0);
__ LoadRR(r8, r6); // Write barrier clobbers r8 below.
__ RecordWriteField(closure, JSFunction::kCodeOffset, r8, r7,
kLRHasNotBeenSaved, kDontSaveFPRegs, OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
__ AddP(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
__ JumpToJSEntry(r6);
}
static void Generate_StackOverflowCheck(MacroAssembler* masm, Register num_args,
......
......@@ -872,14 +872,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
&maybe_load_debug_bytecode_array);
__ bind(&bytecode_array_loaded);
// Check whether we should continue to use the interpreter.
// TODO(rmcilroy) Remove self healing once liveedit only has to deal with
// Ignition bytecode.
Label switch_to_different_code_kind;
__ Move(rcx, masm->CodeObject()); // Self-reference to this code.
__ cmpp(rcx, FieldOperand(rax, SharedFunctionInfo::kCodeOffset));
__ j(not_equal, &switch_to_different_code_kind);
// Increment invocation count for the function.
__ incl(
FieldOperand(feedback_vector, FeedbackVector::kInvocationCountOffset));
......@@ -977,20 +969,6 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ movp(kInterpreterBytecodeArrayRegister,
FieldOperand(rcx, DebugInfo::kDebugBytecodeArrayOffset));
__ jmp(&bytecode_array_loaded);
// 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);
__ leave(); // Leave the frame so we can tail call.
__ movp(rcx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
__ movp(rcx, FieldOperand(rcx, SharedFunctionInfo::kCodeOffset));
__ movp(FieldOperand(rdi, JSFunction::kCodeOffset), rcx);
__ movp(r14, rcx); // Write barrier clobbers r14 below.
__ RecordWriteField(rdi, JSFunction::kCodeOffset, r14, r15, kDontSaveFPRegs,
OMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
__ leap(rcx, FieldOperand(rcx, Code::kHeaderSize));
__ jmp(rcx);
}
static void Generate_StackOverflowCheck(
......
......@@ -5369,28 +5369,6 @@ TEST(CanonicalSharedFunctionInfo) {
"check(g1, g2);");
}
TEST(RemoveCodeFromSharedFunctionInfoButNotFromClosure) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
global->Set(isolate, "check", v8::FunctionTemplate::New(
isolate, CheckEqualSharedFunctionInfos));
global->Set(isolate, "remove",
v8::FunctionTemplate::New(isolate, RemoveCodeAndGC));
v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global);
v8::Context::Scope cscope(context);
CompileRun(
"function f() { return function g() {}; }"
"var g1 = f();"
"var g2 = f();"
"check(g1, g2);"
"g1();"
"g2();"
"remove(g1);"
"g2();"
"check(g1, g2);");
}
TEST(ScriptIterator) {
CcTest::InitializeVM();
......
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