[debugger] remove debugger statement support from FCG/CS.

R=mstarzinger@chromium.org

Review-Url: https://codereview.chromium.org/2650193002
Cr-Commit-Position: refs/heads/master@{#42892}
This commit is contained in:
yangguo 2017-02-02 06:21:03 -08:00 committed by Commit bot
parent d0edd08eb5
commit eef855a1dc
24 changed files with 40 additions and 139 deletions

View File

@ -1919,16 +1919,6 @@ void MacroAssembler::IsObjectNameType(Register object,
b(hi, fail);
}
void MacroAssembler::DebugBreak() {
mov(r0, Operand::Zero());
mov(r1,
Operand(ExternalReference(Runtime::kHandleDebuggerStatement, isolate())));
CEntryStub ces(isolate(), 1);
DCHECK(AllowThisStubCall(&ces));
Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT);
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
ExternalReference restart_fp =

View File

@ -714,13 +714,9 @@ class MacroAssembler: public Assembler {
Register scratch,
Label* fail);
// ---------------------------------------------------------------------------
// Debugger Support
void DebugBreak();
// Frame restart support
void MaybeDropFrames();
// ---------------------------------------------------------------------------
// Exception handling
// Push a new stack handler and link into stack handler chain.

View File

@ -2888,15 +2888,6 @@ void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
}
}
void MacroAssembler::DebugBreak() {
Mov(x0, 0);
Mov(x1, ExternalReference(Runtime::kHandleDebuggerStatement, isolate()));
CEntryStub ces(isolate(), 1);
DCHECK(AllowThisStubCall(&ces));
Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT);
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
ExternalReference restart_fp =

View File

@ -1300,13 +1300,9 @@ class MacroAssembler : public Assembler {
MacroAssembler* masm_;
};
// ---------------------------------------------------------------------------
// Debugger Support
void DebugBreak();
// Frame restart support
void MaybeDropFrames();
// ---------------------------------------------------------------------------
// Exception handling
// Push a new stack handler and link into stack handler chain.

View File

@ -725,8 +725,6 @@ const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
return "no reloc 64";
case EMBEDDED_OBJECT:
return "embedded object";
case DEBUGGER_STATEMENT:
return "debugger statement";
case CODE_TARGET:
return "code target";
case CODE_TARGET_WITH_ID:
@ -834,7 +832,6 @@ void RelocInfo::Verify(Isolate* isolate) {
case CELL:
Object::VerifyPointer(target_cell());
break;
case DEBUGGER_STATEMENT:
case CODE_TARGET_WITH_ID:
case CODE_TARGET: {
// convert inline target address to code object

View File

@ -317,7 +317,6 @@ class RelocInfo {
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
CODE_TARGET, // Code target which is not any of the above.
CODE_TARGET_WITH_ID,
DEBUGGER_STATEMENT, // Code target for the debugger statement.
EMBEDDED_OBJECT,
// To relocate pointers into the wasm memory embedded in wasm code
WASM_MEMORY_REFERENCE,
@ -366,7 +365,7 @@ class RelocInfo {
FIRST_REAL_RELOC_MODE = CODE_TARGET,
LAST_REAL_RELOC_MODE = VENEER_POOL,
LAST_CODE_ENUM = DEBUGGER_STATEMENT,
LAST_CODE_ENUM = CODE_TARGET_WITH_ID,
LAST_GCED_ENUM = WASM_FUNCTION_TABLE_SIZE_REFERENCE,
FIRST_SHAREABLE_RELOC_MODE = CELL,
};
@ -442,9 +441,6 @@ class RelocInfo {
static inline bool IsDebugBreakSlotAtTailCall(Mode mode) {
return mode == DEBUG_BREAK_SLOT_AT_TAIL_CALL;
}
static inline bool IsDebuggerStatement(Mode mode) {
return mode == DEBUGGER_STATEMENT;
}
static inline bool IsNone(Mode mode) {
return mode == NONE32 || mode == NONE64;
}

View File

@ -119,8 +119,7 @@ void AstNumberingVisitor::VisitBreakStatement(BreakStatement* node) {
void AstNumberingVisitor::VisitDebuggerStatement(DebuggerStatement* node) {
IncrementNodeCount();
DisableOptimization(kDebuggerStatement);
node->set_base_id(ReserveIdRange(DebuggerStatement::num_ids()));
DisableFullCodegenAndCrankshaft(kDebuggerStatement);
}

View File

@ -1146,26 +1146,10 @@ class TryFinallyStatement final : public TryStatement {
class DebuggerStatement final : public Statement {
public:
void set_base_id(int id) { base_id_ = id; }
static int num_ids() { return parent_num_ids() + 1; }
BailoutId DebugBreakId() const { return BailoutId(local_id(0)); }
private:
friend class AstNodeFactory;
explicit DebuggerStatement(int pos)
: Statement(pos, kDebuggerStatement),
base_id_(BailoutId::None().ToInt()) {}
static int parent_num_ids() { return 0; }
int base_id() const {
DCHECK(!BailoutId(base_id_).IsNone());
return base_id_;
}
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
int base_id_;
explicit DebuggerStatement(int pos) : Statement(pos, kDebuggerStatement) {}
};

View File

@ -1286,9 +1286,8 @@ void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) {
Node* node = NewNode(javascript()->Debugger());
PrepareFrameState(node, stmt->DebugBreakId());
environment()->MarkAllLocalsLive();
// Debugger statement is supported only by going through Ignition first.
UNREACHABLE();
}

View File

@ -186,7 +186,6 @@ int CodeBreakIterator::GetModeMask() {
mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_CALL);
mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL);
mask |= RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION);
mask |= RelocInfo::ModeMask(RelocInfo::DEBUGGER_STATEMENT);
return mask;
}
@ -211,8 +210,7 @@ void CodeBreakIterator::Next() {
source_position_iterator_.Advance();
}
DCHECK(RelocInfo::IsDebugBreakSlot(rmode()) ||
RelocInfo::IsDebuggerStatement(rmode()));
DCHECK(RelocInfo::IsDebugBreakSlot(rmode()));
break_index_++;
}
@ -225,8 +223,6 @@ DebugBreakType CodeBreakIterator::GetDebugBreakType() {
return isolate()->is_tail_call_elimination_enabled()
? DEBUG_BREAK_SLOT_AT_TAIL_CALL
: DEBUG_BREAK_SLOT_AT_CALL;
} else if (RelocInfo::IsDebuggerStatement(rmode())) {
return DEBUGGER_STATEMENT;
} else if (RelocInfo::IsDebugBreakSlot(rmode())) {
return DEBUG_BREAK_SLOT;
} else {
@ -242,7 +238,6 @@ void CodeBreakIterator::SkipToPosition(int position,
void CodeBreakIterator::SetDebugBreak() {
DebugBreakType debug_break_type = GetDebugBreakType();
if (debug_break_type == DEBUGGER_STATEMENT) return;
DCHECK(debug_break_type >= DEBUG_BREAK_SLOT);
Builtins* builtins = isolate()->builtins();
Handle<Code> target = debug_break_type == DEBUG_BREAK_SLOT_AT_RETURN
@ -252,16 +247,12 @@ void CodeBreakIterator::SetDebugBreak() {
}
void CodeBreakIterator::ClearDebugBreak() {
DebugBreakType debug_break_type = GetDebugBreakType();
if (debug_break_type == DEBUGGER_STATEMENT) return;
DCHECK(debug_break_type >= DEBUG_BREAK_SLOT);
DCHECK(GetDebugBreakType() >= DEBUG_BREAK_SLOT);
DebugCodegen::ClearDebugBreakSlot(isolate(), rinfo()->pc());
}
bool CodeBreakIterator::IsDebugBreak() {
DebugBreakType debug_break_type = GetDebugBreakType();
if (debug_break_type == DEBUGGER_STATEMENT) return false;
DCHECK(debug_break_type >= DEBUG_BREAK_SLOT);
DCHECK(GetDebugBreakType() >= DEBUG_BREAK_SLOT);
return DebugCodegen::DebugBreakSlotIsPatched(rinfo()->pc());
}

View File

@ -1228,13 +1228,8 @@ void FullCodeGenerator::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
void FullCodeGenerator::VisitDebuggerStatement(DebuggerStatement* stmt) {
Comment cmnt(masm_, "[ DebuggerStatement");
SetStatementPosition(stmt);
__ DebugBreak();
__ MaybeDropFrames();
PrepareForBailoutForId(stmt->DebugBreakId(), BailoutState::NO_REGISTERS);
// Debugger statement is not supported.
UNREACHABLE();
}

View File

@ -673,14 +673,6 @@ void MacroAssembler::RecordWriteCodeEntryField(Register js_function,
bind(&done);
}
void MacroAssembler::DebugBreak() {
Move(eax, Immediate(0));
mov(ebx, Immediate(ExternalReference(Runtime::kHandleDebuggerStatement,
isolate())));
CEntryStub ces(isolate(), 1);
call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT);
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
ExternalReference restart_fp =

View File

@ -228,10 +228,7 @@ class MacroAssembler: public Assembler {
void RecordWriteForMap(Register object, Handle<Map> map, Register scratch1,
Register scratch2, SaveFPRegsMode save_fp);
// ---------------------------------------------------------------------------
// Debugger Support
void DebugBreak();
// Frame restart support
void MaybeDropFrames();
// Generates function and stub prologue code.

View File

@ -3885,16 +3885,6 @@ void MacroAssembler::Push(Handle<Object> handle) {
push(at);
}
void MacroAssembler::DebugBreak() {
PrepareCEntryArgs(0);
PrepareCEntryFunction(
ExternalReference(Runtime::kHandleDebuggerStatement, isolate()));
CEntryStub ces(isolate(), 1);
DCHECK(AllowThisStubCall(&ces));
Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT);
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
ExternalReference restart_fp =

View File

@ -1080,13 +1080,9 @@ class MacroAssembler: public Assembler {
Register scratch,
Label* fail);
// -------------------------------------------------------------------------
// Debugger Support.
void DebugBreak();
// Frame restart support.
void MaybeDropFrames();
// -------------------------------------------------------------------------
// Exception handling.
// Push a new stack handler and link into stack handler chain.

View File

@ -4040,16 +4040,6 @@ void MacroAssembler::PopRegisterAsTwoSmis(Register dst, Register scratch) {
or_(dst, dst, scratch);
}
void MacroAssembler::DebugBreak() {
PrepareCEntryArgs(0);
PrepareCEntryFunction(
ExternalReference(Runtime::kHandleDebuggerStatement, isolate()));
CEntryStub ces(isolate(), 1);
DCHECK(AllowThisStubCall(&ces));
Call(ces.GetCode(), RelocInfo::DEBUGGER_STATEMENT);
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
ExternalReference restart_fp =

View File

@ -1134,13 +1134,9 @@ class MacroAssembler: public Assembler {
Register scratch,
Label* fail);
// -------------------------------------------------------------------------
// Debugger Support.
void DebugBreak();
// Frame restart support.
void MaybeDropFrames();
// -------------------------------------------------------------------------
// Exception handling.
// Push a new stack handler and link into stack handler chain.

View File

@ -4088,11 +4088,6 @@ void MacroAssembler::DecrementCounter(StatsCounter* counter, int value) {
}
}
void MacroAssembler::DebugBreak() {
Call(isolate()->builtins()->HandleDebuggerStatement(),
RelocInfo::DEBUGGER_STATEMENT);
}
void MacroAssembler::MaybeDropFrames() {
// Check whether we need to drop frames to restart a function on the stack.
ExternalReference restart_fp =

View File

@ -323,10 +323,7 @@ class MacroAssembler: public Assembler {
PointersToHereCheck pointers_to_here_check_for_value =
kPointersToHereMaybeInteresting);
// ---------------------------------------------------------------------------
// Debugger Support
void DebugBreak();
// Frame restart support.
void MaybeDropFrames();
// Generates function and stub prologue code.

View File

@ -697,6 +697,8 @@ TEST(LineNumber) {
}
TEST(BailoutReason) {
i::FLAG_allow_natives_syntax = true;
i::FLAG_always_opt = false;
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
v8::Context::Scope context_scope(env);
@ -704,14 +706,21 @@ TEST(BailoutReason) {
i::ProfilerExtension::set_profiler(iprofiler.get());
CHECK_EQ(0, iprofiler->GetProfilesCount());
v8::Local<v8::Script> script =
v8_compile(v8_str("function Debugger() {\n"
" debugger;\n"
" startProfiling();\n"
"}\n"
"Debugger();\n"
"stopProfiling();"));
script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()).ToLocalChecked();
v8::Local<v8::Function> function = CompileRun(
"function Debugger() {\n"
" startProfiling();\n"
"}"
"Debugger")
.As<v8::Function>();
i::Handle<i::JSFunction> i_function =
i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*function));
// Set a high opt count to trigger bail out.
i_function->shared()->set_opt_count(10000);
CompileRun(
"%OptimizeFunctionOnNextCall(Debugger);"
"Debugger();"
"stopProfiling()");
CHECK_EQ(1, iprofiler->GetProfilesCount());
const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
CHECK(profile);
@ -721,11 +730,11 @@ TEST(BailoutReason) {
// The tree should look like this:
// (root)
// ""
// kDebuggerStatement
// kFunctionBeingDebugged
current = PickChild(current, "");
CHECK(const_cast<v8::CpuProfileNode*>(current));
current = PickChild(current, "Debugger");
CHECK(const_cast<v8::CpuProfileNode*>(current));
CHECK(!strcmp("DebuggerStatement", current->GetBailoutReason()));
CHECK(!strcmp("Deoptimized too many times", current->GetBailoutReason()));
}

View File

@ -25,6 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --no-always-opt
Debug = debug.Debug;
var listened = false;

View File

@ -25,6 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --no-always-opt
var Debug = debug.Debug;

View File

@ -29,6 +29,8 @@
// Test debug evaluation for functions without local context, but with
// nested catch contexts.
// Flags: --no-always-opt
"use strict";
var x;

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-always-opt
Debug = debug.Debug;