Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index 74f1b4d47b8f05cae321ce6942197214b32cca5c..0345751dfc7c3c6d8047139f388be000e0c99c31 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -498,7 +498,7 @@ void FullCodeGenerator::EmitReturnSequence() { |
{ |
InstructionAccurateScope scope(masm_, |
Assembler::kJSReturnSequenceInstructions); |
- CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
+ SetReturnPosition(function()); |
__ RecordJSReturn(); |
// This code is generated using Assembler methods rather than Macro |
// Assembler methods because it will be patched later on, and so the size |
@@ -1080,7 +1080,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()); |
@@ -1126,9 +1126,11 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { |
void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
ASM_LOCATION("FullCodeGenerator::VisitForInStatement"); |
Comment cmnt(masm_, "[ ForInStatement"); |
+ SetStatementPosition(stmt, SKIP_BREAK); |
+ |
FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); |
+ |
// TODO(all): This visitor probably needs better comments and a revisit. |
- SetStatementPosition(stmt); |
Label loop, exit; |
ForIn loop_statement(this, stmt); |
@@ -1136,7 +1138,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()); |
__ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, &exit); |
Register null_value = x15; |
@@ -1230,7 +1232,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()); |
// Load the current count to x0, load the length to x1. |
__ PeekPair(x0, x1, 0); |
@@ -1469,7 +1471,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(); |
@@ -1959,6 +1961,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); |
@@ -2049,7 +2052,6 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
__ Push(x0); // Left operand goes on the stack. |
VisitForAccumulatorValue(expr->value()); |
- SetSourcePosition(expr->position() + 1); |
AccumulatorValueContext context(this); |
if (ShouldInlineSmiCase(op)) { |
EmitInlineSmiBinaryOp(expr->binary_operation(), |
@@ -2066,8 +2068,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) { |
@@ -2096,7 +2097,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
Literal* key = prop->key()->AsLiteral(); |
DCHECK(!prop->IsSuperAccess()); |
@@ -2109,7 +2110,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()); |
@@ -2121,7 +2122,7 @@ void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
// Call keyed load IC. It has arguments key and receiver in x0 and x1. |
Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
__ Mov(LoadDescriptor::SlotRegister(), |
@@ -2132,9 +2133,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); |
} |
@@ -2518,8 +2518,6 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
DCHECK(prop != NULL); |
DCHECK(prop->key()->IsLiteral()); |
- // Record source code position before IC call. |
- SetSourcePosition(expr->position()); |
__ Mov(StoreDescriptor::NameRegister(), |
Operand(prop->key()->AsLiteral()->value())); |
__ Pop(StoreDescriptor::ReceiverRegister()); |
@@ -2569,8 +2567,6 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
ASM_LOCATION("FullCodeGenerator::EmitKeyedPropertyAssignment"); |
// Assignment to a property, using a keyed store IC. |
- // Record source code position before IC call. |
- SetSourcePosition(expr->position()); |
// TODO(all): Could we pass this in registers rather than on the stack? |
__ Pop(StoreDescriptor::NameRegister(), StoreDescriptor::ReceiverRegister()); |
DCHECK(StoreDescriptor::ValueRegister().is(x0)); |
@@ -2591,6 +2587,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
void FullCodeGenerator::VisitProperty(Property* expr) { |
Comment cmnt(masm_, "[ Property"); |
+ SetExpressionPosition(expr); |
Expression* key = expr->key(); |
if (key->IsPropertyName()) { |
@@ -2675,8 +2672,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()); |
@@ -2738,8 +2735,7 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
DCHECK(callee->IsProperty()); |
Property* prop = callee->AsProperty(); |
DCHECK(prop->IsSuperAccess()); |
- |
- SetSourcePosition(prop->position()); |
+ SetExpressionPosition(prop); |
// Load the function from the receiver. |
const Register scratch = x10; |
@@ -2776,13 +2772,10 @@ 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)); |
} |
- } |
- // Record source position of the IC call. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
Handle<Code> ic = CodeFactory::CallIC(isolate(), arg_count, call_type).code(); |
__ Mov(x3, SmiFromSlot(expr->CallFeedbackICSlot())); |
@@ -2843,13 +2836,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()); |
+ 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 x0) |
@@ -2901,8 +2891,6 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
- { |
- PreservePositionScope pos_scope(masm()->positions_recorder()); |
PushCalleeAndWithBaseObject(expr); |
// Push the arguments. |
@@ -2920,10 +2908,9 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
__ Poke(x0, (arg_count + 1) * kPointerSize); |
PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
- } |
// Record source position for debugger. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// Call the evaluated function. |
CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
@@ -2951,10 +2938,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
EmitKeyedSuperCallWithLoadIC(expr); |
} |
} else { |
- { |
- PreservePositionScope scope(masm()->positions_recorder()); |
VisitForStackValue(property->obj()); |
- } |
if (is_named_call) { |
EmitCallWithLoadIC(expr); |
} else { |
@@ -2966,9 +2950,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); |
- } |
__ LoadRoot(x1, Heap::kUndefinedValueRootIndex); |
__ Push(x1); |
// Emit function call. |
@@ -3003,7 +2985,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 x1 and x0. |
__ Mov(x0, arg_count); |
@@ -3046,7 +3028,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 x1 and x0. |
__ Mov(x0, arg_count); |
@@ -4426,8 +4408,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); |
__ Peek(x1, (arg_count + 1) * kPointerSize); |
__ CallStub(&stub); |
@@ -4602,7 +4583,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); |
@@ -4753,8 +4733,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
__ Mov(x1, x0); |
__ Mov(x0, Smi::FromInt(count_value)); |
- // Record position before stub call. |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
{ |
Assembler::BlockPoolsScope scope(masm_); |
@@ -4981,7 +4960,7 @@ void FullCodeGenerator::EmitLiteralCompareTypeof(Expression* expr, |
void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { |
Comment cmnt(masm_, "[ CompareOperation"); |
- SetSourcePosition(expr->position()); |
+ SetExpressionPosition(expr); |
// Try to generate an optimized comparison with a literal value. |
// TODO(jbramley): This only checks common values like NaN or undefined. |
@@ -5036,8 +5015,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()); |
@@ -5091,6 +5068,8 @@ void FullCodeGenerator::VisitThisFunction(ThisFunction* 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()); |