Commit 2c3654c4 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

Revert "[debug] add runtime side effect check for StaCurrentContextSlot"

This reverts commit 0340874b.

Reason for revert: Tentative revert for https://crbug.com/v8/7626

Original change's description:
> [debug] add runtime side effect check for StaCurrentContextSlot
> 
> R=​yangguo@chromium.org
> 
> Bug: v8:7588
> Change-Id: If78f6dd460c7423923800a98d44520c1bf71663c
> Reviewed-on: https://chromium-review.googlesource.com/996236
> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#52398}

TBR=yangguo@chromium.org,kozyatinskiy@chromium.org

Change-Id: I77a679649a6149607aefd44f6b7f3f6dfe548776
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7588
Reviewed-on: https://chromium-review.googlesource.com/998036Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52428}
parent 028d4d81
......@@ -858,7 +858,6 @@ bool BytecodeRequiresRuntimeCheck(interpreter::Bytecode bytecode) {
case Bytecode::kStaKeyedProperty:
case Bytecode::kStaInArrayLiteral:
case Bytecode::kStaDataPropertyInLiteral:
case Bytecode::kStaCurrentContextSlot:
return true;
default:
return false;
......
......@@ -2413,28 +2413,8 @@ bool Debug::PerformSideEffectCheckForCallback(Handle<Object> callback_info) {
return false;
}
bool Debug::PerformSideEffectCheckAtBytecode(InterpretedFrame* frame) {
using interpreter::Bytecode;
bool Debug::PerformSideEffectCheckForObject(Handle<Object> object) {
DCHECK_EQ(isolate_->debug_execution_mode(), DebugInfo::kSideEffects);
SharedFunctionInfo* shared = frame->function()->shared();
BytecodeArray* bytecode_array = shared->bytecode_array();
int offset = frame->GetBytecodeOffset();
interpreter::BytecodeArrayAccessor bytecode_accessor(handle(bytecode_array),
offset);
Bytecode bytecode = bytecode_accessor.current_bytecode();
interpreter::Register reg;
switch (bytecode) {
case Bytecode::kStaCurrentContextSlot:
reg = interpreter::Register::current_context();
break;
default:
reg = bytecode_accessor.GetRegisterOperand(0);
break;
}
Handle<Object> object =
handle(frame->ReadInterpreterRegister(reg.index()), isolate_);
if (object->IsHeapObject()) {
Address address = Handle<HeapObject>::cast(object)->address();
if (temporary_objects_->HasObject(address)) {
......@@ -2442,6 +2422,14 @@ bool Debug::PerformSideEffectCheckAtBytecode(InterpretedFrame* frame) {
}
}
if (FLAG_trace_side_effect_free_debug_evaluate) {
JavaScriptFrameIterator it(isolate_);
InterpretedFrame* interpreted_frame =
reinterpret_cast<InterpretedFrame*>(it.frame());
SharedFunctionInfo* shared = interpreted_frame->function()->shared();
BytecodeArray* bytecode_array = shared->bytecode_array();
int bytecode_offset = interpreted_frame->GetBytecodeOffset();
interpreter::Bytecode bytecode =
interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset));
PrintF("[debug-evaluate] %s failed runtime side effect check.\n",
interpreter::Bytecodes::ToString(bytecode));
}
......
......@@ -347,7 +347,7 @@ class Debug {
bool PerformSideEffectCheck(Handle<JSFunction> function);
bool PerformSideEffectCheckForCallback(Handle<Object> callback_info);
bool PerformSideEffectCheckAtBytecode(InterpretedFrame* frame);
bool PerformSideEffectCheckForObject(Handle<Object> object);
// Flags and states.
DebugScope* debugger_entry() {
......
......@@ -59,8 +59,15 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
bool side_effect_check_failed = false;
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects) {
side_effect_check_failed =
!isolate->debug()->PerformSideEffectCheckAtBytecode(interpreted_frame);
int offset = interpreted_frame->GetBytecodeOffset();
interpreter::BytecodeArrayAccessor bytecode_accessor(handle(bytecode_array),
offset);
interpreter::Register reg = bytecode_accessor.GetRegisterOperand(0);
Handle<Object> first_operand = handle(
interpreted_frame->ReadInterpreterRegister(reg.index()), isolate);
if (!isolate->debug()->PerformSideEffectCheckForObject(first_operand)) {
side_effect_check_failed = true;
}
}
if (Bytecodes::Returns(bytecode)) {
......
......@@ -4,13 +4,6 @@
Debug = debug.Debug;
// StaCurrentContextSlot
success(10, `(function(){
const x = 10;
function f1() {return x;}
return x;
})()`);
// StaNamedProperty
var a = {name: 'foo'};
function set_name(a) {
......
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