Commit 8cb01d3d authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: Reland "[debug] introduced runtime side effect check"

Port 71018812

Original Commit Message:

    This is a reland of 7a2c3713

    Original change's description:
    > [debug] introduced runtime side effect check
    >
    > This CL demonstrates minimum valuable addition to existing debug evaluate
    > without side effects mechanism.
    > With this CL user can evaluate expressions like:
    > [a,b] // create any kind of temporary array literals
    > [a,b].reduce((x,y) => x + y, 0); // use reduce method
    > [1,2,3].fill(2); // change temporary arrays
    >
    > The core idea: any change of the object created during evaluation without
    > side effects is side effect free. As soon as we try to store this temporary
    > object to object existed before evaluation we will terminate execution.
    >
    > Implementation:
    > - track all objects allocated during evaluation and mark them as temporary,
    > - patch all bytecodes which change objects.
    >
    > A little more details (including performance analysis): [1].
    >
    > [1] https://docs.google.com/document/d/10qqAtZADspPnpYa6SEdYRxrddfKIZJIzbLtGpsZQkRo/edit#
    >
    > Bug: v8:7588
    > Change-Id: I69f7b96e1ebd7ad0022219e8213211c7be72a111
    > Reviewed-on: https://chromium-review.googlesource.com/972615
    > Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
    > Reviewed-by: Yang Guo <yangguo@chromium.org>
    > Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#52370}

R=kozyatinskiy@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I8706efa53d0bbf7d12e48f4f0c4ac387b5faa97b
Reviewed-on: https://chromium-review.googlesource.com/998180Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#52411}
parent 4bc00abf
......@@ -1050,15 +1050,28 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load debug copy of the bytecode array if it exists.
// kInterpreterBytecodeArrayRegister is already loaded with
// SharedFunctionInfo::kFunctionDataOffset.
Label done;
__ bind(&maybe_load_debug_bytecode_array);
__ LoadP(ip, FieldMemOperand(r7, DebugInfo::kDebugBytecodeArrayOffset));
__ JumpIfRoot(ip, Heap::kUndefinedValueRootIndex, &bytecode_array_loaded);
__ mr(kInterpreterBytecodeArrayRegister, ip);
__ LoadP(ip, FieldMemOperand(r7, DebugInfo::kFlagsOffset));
__ SmiUntag(ip);
__ andi(r0, ip, Operand(DebugInfo::kHasBreakInfo));
__ beq(&done, cr0);
__ LoadP(kInterpreterBytecodeArrayRegister,
FieldMemOperand(r7, DebugInfo::kDebugBytecodeArrayOffset));
__ bind(&done);
__ andi(ip, ip, Operand(DebugInfo::kDebugExecutionMode));
ExternalReference debug_execution_mode =
ExternalReference::debug_execution_mode_address(masm->isolate());
__ mov(r7, Operand(debug_execution_mode));
__ lbz(r7, MemOperand(r7));
__ extsb(r7, r7);
STATIC_ASSERT(static_cast<int>(DebugInfo::kDebugExecutionMode) ==
static_cast<int>(DebugInfo::kSideEffects));
__ cmp(r7, ip);
__ beq(&bytecode_array_loaded);
__ Push(closure, feedback_vector, kInterpreterBytecodeArrayRegister, closure);
__ CallRuntime(Runtime::kDebugApplyInstrumentation);
__ Pop(closure, feedback_vector, kInterpreterBytecodeArrayRegister);
__ b(&bytecode_array_loaded);
}
......
......@@ -1057,15 +1057,27 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
// Load debug copy of the bytecode array if it exists.
// kInterpreterBytecodeArrayRegister is already loaded with
// SharedFunctionInfo::kFunctionDataOffset.
Label done;
__ bind(&maybe_load_debug_bytecode_array);
__ LoadP(ip, FieldMemOperand(r6, DebugInfo::kDebugBytecodeArrayOffset));
__ JumpIfRoot(ip, Heap::kUndefinedValueRootIndex, &bytecode_array_loaded);
__ LoadRR(kInterpreterBytecodeArrayRegister, ip);
__ LoadP(ip, FieldMemOperand(r6, DebugInfo::kFlagsOffset));
__ SmiUntag(ip);
__ tmll(ip, Operand(DebugInfo::kHasBreakInfo));
__ beq(&done);
__ LoadP(kInterpreterBytecodeArrayRegister,
FieldMemOperand(r6, DebugInfo::kDebugBytecodeArrayOffset));
__ bind(&done);
__ AndP(ip, ip, Operand(DebugInfo::kDebugExecutionMode));
ExternalReference debug_execution_mode =
ExternalReference::debug_execution_mode_address(masm->isolate());
__ mov(r6, Operand(debug_execution_mode));
__ LoadB(r6, MemOperand(r6));
STATIC_ASSERT(static_cast<int>(DebugInfo::kDebugExecutionMode) ==
static_cast<int>(DebugInfo::kSideEffects));
__ CmpP(r6, ip);
__ beq(&bytecode_array_loaded);
__ Push(closure, feedback_vector, kInterpreterBytecodeArrayRegister, closure);
__ CallRuntime(Runtime::kDebugApplyInstrumentation);
__ Pop(closure, feedback_vector, kInterpreterBytecodeArrayRegister);
__ b(&bytecode_array_loaded);
}
......
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