Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 7a89bd07f2beed0db6faf49c7539bc08e8870394..00a0d8f154080f0e960efce6449bf6ba7f632c27 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -472,7 +472,7 @@ void FullCodeGenerator::EmitReturnSequence() { |
Label check_exit_codesize; |
masm_->bind(&check_exit_codesize); |
#endif |
- CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
+ SetReturnPosition(function()); |
__ RecordJSReturn(); |
// Do not use the leave instruction here because it is too short to |
// patch with the code required by the debugger. |
@@ -1046,7 +1046,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
} |
// Record position before stub call for type feedback. |
- SetSourcePosition(clause->position()); |
+ SetExpressionPosition(clause); |
Handle<Code> ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, |
strength(language_mode())).code(); |
CallIC(ic, clause->CompareId()); |
@@ -1093,8 +1093,9 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
Comment cmnt(masm_, "[ ForInStatement"); |
+ SetStatementPosition(stmt, SKIP_BREAK); |
+ |
FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
- SetStatementPosition(stmt); |
Label loop, exit; |
ForIn loop_statement(this, stmt); |
@@ -1102,7 +1103,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
// Get the object to enumerate over. If the object is null or undefined, skip |
// over the loop. See ECMA-262 version 5, section 12.6.4. |
- SetExpressionPosition(stmt->enumerable()); |
+ SetExpressionAsStatementPosition(stmt->enumerable()); |
VisitForAccumulatorValue(stmt->enumerable()); |
__ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
__ j(equal, &exit); |
@@ -1206,7 +1207,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
// Generate code for doing the condition check. |
PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); |
__ bind(&loop); |
- SetExpressionPosition(stmt->each()); |
+ SetExpressionAsStatementPosition(stmt->each()); |
__ movp(rax, Operand(rsp, 0 * kPointerSize)); // Get the current index. |
__ cmpp(rax, Operand(rsp, 1 * kPointerSize)); // Compare to the array length. |
@@ -1455,7 +1456,7 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(VariableProxy* proxy, |
void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
// Record position before possible IC call. |
- SetSourcePosition(proxy->position()); |
+ SetExpressionPosition(proxy); |
PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
Variable* var = proxy->var(); |
@@ -1949,6 +1950,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
DCHECK(expr->target()->IsValidReferenceExpression()); |
Comment cmnt(masm_, "[ Assignment"); |
+ SetExpressionPosition(expr, INSERT_BREAK); |
Property* property = expr->target()->AsProperty(); |
LhsKind assign_type = Property::GetAssignType(property); |
@@ -2037,7 +2039,6 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
__ Push(rax); // Left operand goes on the stack. |
VisitForAccumulatorValue(expr->value()); |
- SetSourcePosition(expr->position() + 1); |
AccumulatorValueContext context(this); |
if (ShouldInlineSmiCase(op)) { |
EmitInlineSmiBinaryOp(expr->binary_operation(), |
@@ -2053,8 +2054,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
VisitForAccumulatorValue(expr->value()); |
} |
- // Record source position before possible IC call. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// Store the value. |
switch (assign_type) { |
@@ -2084,6 +2084,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
void FullCodeGenerator::VisitYield(Yield* expr) { |
Comment cmnt(masm_, "[ Yield"); |
+ SetExpressionPosition(expr); |
+ |
// Evaluate yielded value first; the initial iterator definition depends on |
// this. It stays on the stack while we update the iterator. |
VisitForStackValue(expr->expression()); |
@@ -2370,7 +2372,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(!prop->IsSuperAccess()); |
@@ -2383,7 +2385,7 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
// Stack: receiver, home_object |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(!key->value()->IsSmi()); |
DCHECK(prop->IsSuperAccess()); |
@@ -2395,7 +2397,7 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
__ Move(LoadDescriptor::SlotRegister(), |
SmiFromSlot(prop->PropertyFeedbackSlot())); |
@@ -2405,9 +2407,8 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
// Stack: receiver, home_object, key. |
+ SetExpressionPosition(prop); |
__ Push(Smi::FromInt(language_mode())); |
- SetSourcePosition(prop->position()); |
- |
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
} |
@@ -2738,8 +2739,6 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
DCHECK(prop != NULL); |
DCHECK(prop->key()->IsLiteral()); |
- // Record source code position before IC call. |
- SetSourcePosition(expr->position()); |
__ Move(StoreDescriptor::NameRegister(), prop->key()->AsLiteral()->value()); |
__ Pop(StoreDescriptor::ReceiverRegister()); |
if (FLAG_vector_stores) { |
@@ -2786,12 +2785,9 @@ void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { |
void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
// Assignment to a property, using a keyed store IC. |
- |
__ Pop(StoreDescriptor::NameRegister()); // Key. |
__ Pop(StoreDescriptor::ReceiverRegister()); |
DCHECK(StoreDescriptor::ValueRegister().is(rax)); |
- // Record source code position before IC call. |
- SetSourcePosition(expr->position()); |
Handle<Code> ic = |
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code(); |
if (FLAG_vector_stores) { |
@@ -2808,6 +2804,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
void FullCodeGenerator::VisitProperty(Property* expr) { |
Comment cmnt(masm_, "[ Property"); |
+ SetExpressionPosition(expr); |
+ |
Expression* key = expr->key(); |
if (key->IsPropertyName()) { |
@@ -2885,8 +2883,8 @@ void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) { |
DCHECK(callee->IsProperty()); |
Property* prop = callee->AsProperty(); |
DCHECK(prop->IsSuperAccess()); |
+ SetExpressionPosition(prop); |
- SetSourcePosition(prop->position()); |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(!key->value()->IsSmi()); |
// Load the function from the receiver. |
@@ -2947,7 +2945,7 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
Property* prop = callee->AsProperty(); |
DCHECK(prop->IsSuperAccess()); |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
// Load the function from the receiver. |
SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
VisitForStackValue(super_ref->home_object()); |
@@ -2981,14 +2979,11 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { |
// Load the arguments. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
- { PreservePositionScope scope(masm()->positions_recorder()); |
- for (int i = 0; i < arg_count; i++) { |
- VisitForStackValue(args->at(i)); |
- } |
+ for (int i = 0; i < arg_count; i++) { |
+ VisitForStackValue(args->at(i)); |
} |
- // Record source position of the IC call. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
__ Move(rdx, SmiFromSlot(expr->CallFeedbackICSlot())); |
__ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
@@ -3047,13 +3042,10 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) { |
VariableProxy* callee = expr->expression()->AsVariableProxy(); |
if (callee->var()->IsLookupSlot()) { |
Label slow, done; |
- SetSourcePosition(callee->position()); |
- { |
- PreservePositionScope scope(masm()->positions_recorder()); |
- // Generate code for loading from variables potentially shadowed by |
- // eval-introduced variables. |
- EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |
- } |
+ SetExpressionPosition(callee); |
+ // Generate code for loading from variables potentially shadowed by |
+ // eval-introduced variables. |
+ EmitDynamicLookupFastCase(callee, NOT_INSIDE_TYPEOF, &slow, &done); |
__ bind(&slow); |
// Call the runtime to find the function to call (returned in rax) and |
// the object holding it (returned in rdx). |
@@ -3103,7 +3095,6 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
// function using the given arguments. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
- { PreservePositionScope pos_scope(masm()->positions_recorder()); |
PushCalleeAndWithBaseObject(expr); |
// Push the arguments. |
@@ -3120,9 +3111,8 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
__ movp(Operand(rsp, (arg_count + 1) * kPointerSize), rax); |
PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
- } |
// Record source position for debugger. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
__ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
__ CallStub(&stub); |
@@ -3147,10 +3137,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
EmitKeyedSuperCallWithLoadIC(expr); |
} |
} else { |
- { |
- PreservePositionScope scope(masm()->positions_recorder()); |
VisitForStackValue(property->obj()); |
- } |
if (is_named_call) { |
EmitCallWithLoadIC(expr); |
} else { |
@@ -3162,9 +3149,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
} else { |
DCHECK(call_type == Call::OTHER_CALL); |
// Call to an arbitrary expression not handled specially above. |
- { PreservePositionScope scope(masm()->positions_recorder()); |
VisitForStackValue(callee); |
- } |
__ PushRoot(Heap::kUndefinedValueRootIndex); |
// Emit function call. |
EmitCall(expr); |
@@ -3198,7 +3183,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
// Call the construct call builtin that handles allocation and |
// constructor invocation. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// Load function and argument count into rdi and rax. |
__ Set(rax, arg_count); |
@@ -3241,7 +3226,7 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
// Call the construct call builtin that handles allocation and |
// constructor invocation. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// Load function and argument count into edi and eax. |
__ Set(rax, arg_count); |
@@ -4690,8 +4675,7 @@ void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
- // Record source position of the IC call. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
__ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
__ CallStub(&stub); |
@@ -4872,7 +4856,6 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
DCHECK(expr->expression()->IsValidReferenceExpression()); |
Comment cmnt(masm_, "[ CountOperation"); |
- SetSourcePosition(expr->position()); |
Property* prop = expr->expression()->AsProperty(); |
LhsKind assign_type = Property::GetAssignType(prop); |
@@ -5019,8 +5002,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
} |
} |
- // Record position before stub call. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// Call stub for +1/-1. |
__ bind(&stub_call); |
@@ -5240,7 +5222,7 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, |
void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
Comment cmnt(masm_, "[ CompareOperation"); |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// First we try a fast inlined version of the compare when one of |
// the operands is a literal. |
@@ -5294,8 +5276,6 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
__ bind(&slow_case); |
} |
- // Record position and call the compare IC. |
- SetSourcePosition(expr->position()); |
Handle<Code> ic = CodeFactory::CompareIC( |
isolate(), op, strength(language_mode())).code(); |
CallIC(ic, expr->CompareOperationFeedbackId()); |