Commit 0427abf3 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[fullcodegen] Lift restriction on --debug-code flag.

This removes a restriction from full-codegen that limited the usability
of the --debug-code flag to only no-snap configurations. The reasoning
for the restriction would still hold, if we ever put full-codegen code
into the snapshot, which we don't. Also there already are several places
in full-codegen that queried the FLAG_debug_code directly, a more
reliable mechanism will be needed if we snapshot full code.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1722593002

Cr-Commit-Position: refs/heads/master@{#34189}
parent b238864d
...@@ -772,7 +772,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { ...@@ -772,7 +772,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current function // The variable in the declaration always resides in the current function
// context. // context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ ldr(r1, FieldMemOperand(cp, HeapObject::kMapOffset)); __ ldr(r1, FieldMemOperand(cp, HeapObject::kMapOffset));
__ CompareRoot(r1, Heap::kWithContextMapRootIndex); __ CompareRoot(r1, Heap::kWithContextMapRootIndex);
...@@ -2458,7 +2458,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2458,7 +2458,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK((var->IsStackAllocated() || var->IsContextSlot())); DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
MemOperand location = VarOperand(var, r1); MemOperand location = VarOperand(var, r1);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ ldr(r2, location); __ ldr(r2, location);
__ CompareRoot(r2, Heap::kTheHoleValueRootIndex); __ CompareRoot(r2, Heap::kTheHoleValueRootIndex);
......
...@@ -771,7 +771,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { ...@@ -771,7 +771,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current function // The variable in the declaration always resides in the current function
// context. // context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ Ldr(x1, FieldMemOperand(cp, HeapObject::kMapOffset)); __ Ldr(x1, FieldMemOperand(cp, HeapObject::kMapOffset));
__ CompareRoot(x1, Heap::kWithContextMapRootIndex); __ CompareRoot(x1, Heap::kWithContextMapRootIndex);
......
...@@ -165,14 +165,7 @@ bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime( ...@@ -165,14 +165,7 @@ bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime(
void FullCodeGenerator::Initialize() { void FullCodeGenerator::Initialize() {
InitializeAstVisitor(info_->isolate()); InitializeAstVisitor(info_->isolate());
// The generation of debug code must match between the snapshot code and the masm_->set_emit_debug_code(FLAG_debug_code);
// code that is generated later. This is assumed by the debugger when it is
// calculating PC offsets after generating a debug version of code. Therefore
// we disable the production of debug code in the full compiler if we are
// either generating a snapshot or we booted from a snapshot.
generate_debug_code_ = FLAG_debug_code && !masm_->serializer_enabled() &&
!info_->isolate()->snapshot_available();
masm_->set_emit_debug_code(generate_debug_code_);
masm_->set_predictable_code_size(true); masm_->set_predictable_code_size(true);
} }
......
...@@ -996,7 +996,6 @@ class FullCodeGenerator: public AstVisitor { ...@@ -996,7 +996,6 @@ class FullCodeGenerator: public AstVisitor {
ZoneVector<HandlerTableEntry> handler_table_; ZoneVector<HandlerTableEntry> handler_table_;
int ic_total_count_; int ic_total_count_;
Handle<Cell> profiling_counter_; Handle<Cell> profiling_counter_;
bool generate_debug_code_;
friend class NestedStatement; friend class NestedStatement;
......
...@@ -716,7 +716,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr, ...@@ -716,7 +716,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr,
void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current context. // The variable in the declaration always resides in the current context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset)); __ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset));
__ cmp(ebx, isolate()->factory()->with_context_map()); __ cmp(ebx, isolate()->factory()->with_context_map());
...@@ -2354,7 +2354,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2354,7 +2354,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK(var->IsStackAllocated() || var->IsContextSlot()); DCHECK(var->IsStackAllocated() || var->IsContextSlot());
MemOperand location = VarOperand(var, ecx); MemOperand location = VarOperand(var, ecx);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ mov(edx, location); __ mov(edx, location);
__ cmp(edx, isolate()->factory()->the_hole_value()); __ cmp(edx, isolate()->factory()->the_hole_value());
......
...@@ -765,7 +765,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { ...@@ -765,7 +765,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current function // The variable in the declaration always resides in the current function
// context. // context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset)); __ lw(a1, FieldMemOperand(cp, HeapObject::kMapOffset));
__ LoadRoot(t0, Heap::kWithContextMapRootIndex); __ LoadRoot(t0, Heap::kWithContextMapRootIndex);
...@@ -2445,7 +2445,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2445,7 +2445,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK((var->IsStackAllocated() || var->IsContextSlot())); DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
MemOperand location = VarOperand(var, a1); MemOperand location = VarOperand(var, a1);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ lw(a2, location); __ lw(a2, location);
__ LoadRoot(t0, Heap::kTheHoleValueRootIndex); __ LoadRoot(t0, Heap::kTheHoleValueRootIndex);
......
...@@ -765,7 +765,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { ...@@ -765,7 +765,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current function // The variable in the declaration always resides in the current function
// context. // context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ ld(a1, FieldMemOperand(cp, HeapObject::kMapOffset)); __ ld(a1, FieldMemOperand(cp, HeapObject::kMapOffset));
__ LoadRoot(a4, Heap::kWithContextMapRootIndex); __ LoadRoot(a4, Heap::kWithContextMapRootIndex);
...@@ -2451,7 +2451,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2451,7 +2451,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK((var->IsStackAllocated() || var->IsContextSlot())); DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
MemOperand location = VarOperand(var, a1); MemOperand location = VarOperand(var, a1);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ ld(a2, location); __ ld(a2, location);
__ LoadRoot(a4, Heap::kTheHoleValueRootIndex); __ LoadRoot(a4, Heap::kTheHoleValueRootIndex);
......
...@@ -736,7 +736,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { ...@@ -736,7 +736,7 @@ void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current function // The variable in the declaration always resides in the current function
// context. // context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ LoadP(r4, FieldMemOperand(cp, HeapObject::kMapOffset)); __ LoadP(r4, FieldMemOperand(cp, HeapObject::kMapOffset));
__ CompareRoot(r4, Heap::kWithContextMapRootIndex); __ CompareRoot(r4, Heap::kWithContextMapRootIndex);
...@@ -2456,7 +2456,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2456,7 +2456,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK((var->IsStackAllocated() || var->IsContextSlot())); DCHECK((var->IsStackAllocated() || var->IsContextSlot()));
MemOperand location = VarOperand(var, r4); MemOperand location = VarOperand(var, r4);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ LoadP(r5, location); __ LoadP(r5, location);
__ CompareRoot(r5, Heap::kTheHoleValueRootIndex); __ CompareRoot(r5, Heap::kTheHoleValueRootIndex);
......
...@@ -726,7 +726,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr, ...@@ -726,7 +726,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr,
void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current context. // The variable in the declaration always resides in the current context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ movp(rbx, FieldOperand(rsi, HeapObject::kMapOffset)); __ movp(rbx, FieldOperand(rsi, HeapObject::kMapOffset));
__ CompareRoot(rbx, Heap::kWithContextMapRootIndex); __ CompareRoot(rbx, Heap::kWithContextMapRootIndex);
...@@ -2339,7 +2339,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2339,7 +2339,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK(var->IsStackAllocated() || var->IsContextSlot()); DCHECK(var->IsStackAllocated() || var->IsContextSlot());
MemOperand location = VarOperand(var, rcx); MemOperand location = VarOperand(var, rcx);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ movp(rdx, location); __ movp(rdx, location);
__ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
......
...@@ -713,7 +713,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr, ...@@ -713,7 +713,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr,
void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) { void FullCodeGenerator::EmitDebugCheckDeclarationContext(Variable* variable) {
// The variable in the declaration always resides in the current context. // The variable in the declaration always resides in the current context.
DCHECK_EQ(0, scope()->ContextChainLength(variable->scope())); DCHECK_EQ(0, scope()->ContextChainLength(variable->scope()));
if (generate_debug_code_) { if (FLAG_debug_code) {
// Check that we're not inside a with or catch context. // Check that we're not inside a with or catch context.
__ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset)); __ mov(ebx, FieldOperand(esi, HeapObject::kMapOffset));
__ cmp(ebx, isolate()->factory()->with_context_map()); __ cmp(ebx, isolate()->factory()->with_context_map());
...@@ -2346,7 +2346,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, ...@@ -2346,7 +2346,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
// mode. // mode.
DCHECK(var->IsStackAllocated() || var->IsContextSlot()); DCHECK(var->IsStackAllocated() || var->IsContextSlot());
MemOperand location = VarOperand(var, ecx); MemOperand location = VarOperand(var, ecx);
if (generate_debug_code_ && var->mode() == LET && op == Token::INIT) { if (FLAG_debug_code && var->mode() == LET && op == Token::INIT) {
// Check for an uninitialized let binding. // Check for an uninitialized let binding.
__ mov(edx, location); __ mov(edx, location);
__ cmp(edx, isolate()->factory()->the_hole_value()); __ cmp(edx, isolate()->factory()->the_hole_value());
......
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