Index: src/codegen-arm.cc |
=================================================================== |
--- src/codegen-arm.cc (revision 958) |
+++ src/codegen-arm.cc (working copy) |
@@ -1043,7 +1043,7 @@ |
} |
// Record the position for debugging purposes. |
- __ RecordPosition(position); |
+ CodeForSourcePosition(position); |
// Use the shared code stub to call the function. |
CallFunctionStub call_function(args->length()); |
@@ -1074,7 +1074,7 @@ |
void CodeGenerator::VisitBlock(Block* node) { |
Comment cmnt(masm_, "[ Block"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
node->set_break_stack_height(break_stack_height_); |
VisitStatements(node->statements()); |
__ bind(node->break_target()); |
@@ -1094,6 +1094,7 @@ |
void CodeGenerator::VisitDeclaration(Declaration* node) { |
Comment cmnt(masm_, "[ Declaration"); |
+ CodeForStatement(node); |
Variable* var = node->proxy()->var(); |
ASSERT(var != NULL); // must have been resolved |
Slot* slot = var->slot(); |
@@ -1159,7 +1160,7 @@ |
void CodeGenerator::VisitExpressionStatement(ExpressionStatement* node) { |
Comment cmnt(masm_, "[ ExpressionStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
Expression* expression = node->expression(); |
expression->MarkAsStatement(); |
Load(expression); |
@@ -1169,6 +1170,7 @@ |
void CodeGenerator::VisitEmptyStatement(EmptyStatement* node) { |
Comment cmnt(masm_, "// EmptyStatement"); |
+ CodeForStatement(node); |
// nothing to do |
} |
@@ -1180,7 +1182,7 @@ |
bool has_then_stm = node->HasThenStatement(); |
bool has_else_stm = node->HasElseStatement(); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
Label exit; |
if (has_then_stm && has_else_stm) { |
@@ -1245,7 +1247,7 @@ |
void CodeGenerator::VisitContinueStatement(ContinueStatement* node) { |
Comment cmnt(masm_, "[ ContinueStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
CleanStack(break_stack_height_ - node->target()->break_stack_height()); |
__ b(node->target()->continue_target()); |
} |
@@ -1253,7 +1255,7 @@ |
void CodeGenerator::VisitBreakStatement(BreakStatement* node) { |
Comment cmnt(masm_, "[ BreakStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
CleanStack(break_stack_height_ - node->target()->break_stack_height()); |
__ b(node->target()->break_target()); |
} |
@@ -1261,7 +1263,7 @@ |
void CodeGenerator::VisitReturnStatement(ReturnStatement* node) { |
Comment cmnt(masm_, "[ ReturnStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
Load(node->expression()); |
// Move the function result into r0. |
frame_->Pop(r0); |
@@ -1272,7 +1274,7 @@ |
void CodeGenerator::VisitWithEnterStatement(WithEnterStatement* node) { |
Comment cmnt(masm_, "[ WithEnterStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
Load(node->expression()); |
__ CallRuntime(Runtime::kPushContext, 1); |
if (kDebug) { |
@@ -1289,6 +1291,7 @@ |
void CodeGenerator::VisitWithExitStatement(WithExitStatement* node) { |
Comment cmnt(masm_, "[ WithExitStatement"); |
+ CodeForStatement(node); |
// Pop context. |
__ ldr(cp, ContextOperand(cp, Context::PREVIOUS_INDEX)); |
// Update context local. |
@@ -1355,7 +1358,7 @@ |
void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) { |
Comment cmnt(masm_, "[ SwitchStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
node->set_break_stack_height(break_stack_height_); |
Load(node->tag()); |
@@ -1423,7 +1426,7 @@ |
void CodeGenerator::VisitLoopStatement(LoopStatement* node) { |
Comment cmnt(masm_, "[ LoopStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
node->set_break_stack_height(break_stack_height_); |
// simple condition analysis |
@@ -1463,7 +1466,7 @@ |
// Record source position of the statement as this code which is after the |
// code for the body actually belongs to the loop statement and not the |
// body. |
- if (FLAG_debug_info) __ RecordPosition(node->statement_pos()); |
+ CodeForStatement(node); |
ASSERT(node->type() == LoopStatement::FOR_LOOP); |
Visit(node->next()); |
} |
@@ -1495,7 +1498,7 @@ |
void CodeGenerator::VisitForInStatement(ForInStatement* node) { |
Comment cmnt(masm_, "[ ForInStatement"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
// We keep stuff on the stack while the body is executing. |
// Record it, so that a break/continue crossing this statement |
@@ -1683,6 +1686,7 @@ |
void CodeGenerator::VisitTryCatch(TryCatch* node) { |
Comment cmnt(masm_, "[ TryCatch"); |
+ CodeForStatement(node); |
Label try_block, exit; |
@@ -1779,6 +1783,7 @@ |
void CodeGenerator::VisitTryFinally(TryFinally* node) { |
Comment cmnt(masm_, "[ TryFinally"); |
+ CodeForStatement(node); |
// State: Used to keep track of reason for entering the finally |
// block. Should probably be extended to hold information for |
@@ -1920,7 +1925,7 @@ |
void CodeGenerator::VisitDebuggerStatement(DebuggerStatement* node) { |
Comment cmnt(masm_, "[ DebuggerStatament"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
__ CallRuntime(Runtime::kDebugBreak, 0); |
// Ignore the return value. |
} |
@@ -2228,7 +2233,7 @@ |
void CodeGenerator::VisitAssignment(Assignment* node) { |
Comment cmnt(masm_, "[ Assignment"); |
- if (FLAG_debug_info) RecordStatementPosition(node); |
+ CodeForStatement(node); |
Reference target(this, node->target()); |
if (target.is_illegal()) return; |
@@ -2259,7 +2264,7 @@ |
// Assignment ignored - leave the value on the stack. |
} else { |
- __ RecordPosition(node->position()); |
+ CodeForSourcePosition(node->position()); |
if (node->op() == Token::INIT_CONST) { |
// Dynamic constant initializations must use the function context |
// and initialize the actual constant declared. Dynamic variable |
@@ -2276,7 +2281,7 @@ |
Comment cmnt(masm_, "[ Throw"); |
Load(node->exception()); |
- __ RecordPosition(node->position()); |
+ CodeForSourcePosition(node->position()); |
__ CallRuntime(Runtime::kThrow, 1); |
frame_->Push(r0); |
} |
@@ -2295,7 +2300,7 @@ |
ZoneList<Expression*>* args = node->arguments(); |
- RecordStatementPosition(node); |
+ CodeForStatement(node); |
// Standard function call. |
// Check if the function is a variable or a property. |
@@ -2331,7 +2336,7 @@ |
// Setup the receiver register and call the IC initialization code. |
Handle<Code> stub = ComputeCallInitialize(args->length()); |
- __ RecordPosition(node->position()); |
+ CodeForSourcePosition(node->position()); |
__ Call(stub, RelocInfo::CODE_TARGET_CONTEXT); |
__ ldr(cp, frame_->Context()); |
// Remove the function from the stack. |
@@ -2378,7 +2383,7 @@ |
// Set the receiver register and call the IC initialization code. |
Handle<Code> stub = ComputeCallInitialize(args->length()); |
- __ RecordPosition(node->position()); |
+ CodeForSourcePosition(node->position()); |
__ Call(stub, RelocInfo::CODE_TARGET); |
__ ldr(cp, frame_->Context()); |
@@ -2432,7 +2437,7 @@ |
ZoneList<Expression*>* args = node->arguments(); |
Expression* function = node->expression(); |
- RecordStatementPosition(node); |
+ CodeForStatement(node); |
// Prepare stack for call to resolved function. |
Load(function); |
@@ -2462,7 +2467,7 @@ |
__ str(r1, MemOperand(sp, args->length() * kPointerSize)); |
// Call the function. |
- __ RecordPosition(node->position()); |
+ CodeForSourcePosition(node->position()); |
CallFunctionStub call_function(args->length()); |
__ CallStub(&call_function); |
@@ -2476,6 +2481,7 @@ |
void CodeGenerator::VisitCallNew(CallNew* node) { |
Comment cmnt(masm_, "[ CallNew"); |
+ CodeForStatement(node); |
// According to ECMA-262, section 11.2.2, page 44, the function |
// expression in new calls must be evaluated before the |
@@ -2501,7 +2507,7 @@ |
// Call the construct call builtin that handles allocation and |
// constructor invocation. |
- __ RecordPosition(RelocInfo::POSITION); |
+ CodeForSourcePosition(node->position()); |
__ Call(Handle<Code>(Builtins::builtin(Builtins::JSConstructCall)), |
RelocInfo::CONSTRUCT_CALL); |
@@ -3207,15 +3213,6 @@ |
} |
-void CodeGenerator::RecordStatementPosition(Node* node) { |
- if (FLAG_debug_info) { |
- int statement_pos = node->statement_pos(); |
- if (statement_pos == RelocInfo::kNoPosition) return; |
- __ RecordStatementPosition(statement_pos); |
- } |
-} |
- |
- |
#undef __ |
#define __ masm-> |
@@ -3243,7 +3240,7 @@ |
VirtualFrame* frame = cgen_->frame(); |
Property* property = expression_->AsProperty(); |
if (property != NULL) { |
- __ RecordPosition(property->position()); |
+ cgen_->CodeForSourcePosition(property->position()); |
} |
switch (type_) { |
@@ -3309,7 +3306,7 @@ |
VirtualFrame* frame = cgen_->frame(); |
Property* property = expression_->AsProperty(); |
if (property != NULL) { |
- __ RecordPosition(property->position()); |
+ cgen_->CodeForSourcePosition(property->position()); |
} |
switch (type_) { |
@@ -3412,7 +3409,7 @@ |
Comment cmnt(masm, "[ Store to keyed Property"); |
Property* property = expression_->AsProperty(); |
ASSERT(property != NULL); |
- __ RecordPosition(property->position()); |
+ cgen_->CodeForSourcePosition(property->position()); |
// Call IC code. |
Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); |