Chromium Code Reviews| Index: src/arm/full-codegen-arm.cc |
| diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
| index cf5863dc6760e0c4fb58a4e3581740eda486f3ce..5c50cb864ce6f56db0eea2be7edab7fb018b0dad 100644 |
| --- a/src/arm/full-codegen-arm.cc |
| +++ b/src/arm/full-codegen-arm.cc |
| @@ -508,7 +508,7 @@ void FullCodeGenerator::EmitReturnSequence() { |
| { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| int32_t arg_count = info_->scope()->num_parameters() + 1; |
| int32_t sp_delta = arg_count * kPointerSize; |
| - CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
| + SetReturnPosition(function()); |
| // TODO(svenpanne) The code below is sometimes 4 words, sometimes 5! |
| PredictableCodeSizeScope predictable(masm_, -1); |
| __ RecordJSReturn(); |
| @@ -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()); |
| @@ -1128,8 +1128,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); |
| @@ -1137,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()); |
| __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| __ cmp(r0, ip); |
| @@ -1241,7 +1242,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 r0, load the length to r1. |
| __ Ldrd(r0, r1, MemOperand(sp, 0 * kPointerSize)); |
| @@ -1491,7 +1492,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(); |
| @@ -1986,6 +1987,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); |
| @@ -2079,7 +2081,6 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| __ push(r0); // Left operand goes on the stack. |
| VisitForAccumulatorValue(expr->value()); |
| - SetSourcePosition(expr->position() + 1); |
| AccumulatorValueContext context(this); |
| if (ShouldInlineSmiCase(op)) { |
| EmitInlineSmiBinaryOp(expr->binary_operation(), |
| @@ -2096,8 +2097,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) { |
| @@ -2127,6 +2127,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { |
| void FullCodeGenerator::VisitYield(Yield* expr) { |
| Comment cmnt(masm_, "[ Yield"); |
| + SetExpressionPosition(expr); |
|
ulan
2015/07/06 09:24:18
Why we don't insert break here?
Yang
2015/07/06 10:05:08
Because EmitReturnSequence emits a return, which i
|
| + |
| // Evaluate yielded value first; the initial iterator definition depends on |
| // this. It stays on the stack while we update the iterator. |
| VisitForStackValue(expr->expression()); |
| @@ -2422,7 +2424,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { |
| void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| - SetSourcePosition(prop->position()); |
| + SetExpressionPosition(prop); |
| Literal* key = prop->key()->AsLiteral(); |
| DCHECK(!prop->IsSuperAccess()); |
| @@ -2435,7 +2437,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()); |
| @@ -2447,7 +2449,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(); |
| __ mov(LoadDescriptor::SlotRegister(), |
| Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
| @@ -2457,9 +2459,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); |
| } |
| @@ -2828,12 +2829,11 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, |
| void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| // Assignment to a property, using a named store IC. |
| + SetExpressionPosition(expr); |
|
ulan
2015/07/06 09:24:18
Why we don't insert break here?
Yang
2015/07/06 10:05:08
Actually we don't need this at all. The caller alr
|
| Property* prop = expr->target()->AsProperty(); |
| 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()); |
| @@ -2881,9 +2881,8 @@ void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { |
| void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| // Assignment to a property, using a keyed store IC. |
| + SetExpressionPosition(expr); |
| - // Record source code position before IC call. |
| - SetSourcePosition(expr->position()); |
| __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); |
| DCHECK(StoreDescriptor::ValueRegister().is(r0)); |
| @@ -2903,6 +2902,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| void FullCodeGenerator::VisitProperty(Property* expr) { |
| Comment cmnt(masm_, "[ Property"); |
| + SetExpressionPosition(expr); |
| + |
| Expression* key = expr->key(); |
| if (key->IsPropertyName()) { |
| @@ -2985,8 +2986,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. |
| @@ -3050,7 +3051,7 @@ void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
| Property* prop = callee->AsProperty(); |
| DCHECK(prop->IsSuperAccess()); |
| - SetSourcePosition(prop->position()); |
| + SetExpressionPosition(prop); |
| // Load the function from the receiver. |
| const Register scratch = r1; |
| SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
| @@ -3086,14 +3087,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(); |
| __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackICSlot()))); |
| __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| @@ -3152,13 +3150,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 r0) |
| @@ -3212,28 +3207,26 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
| ZoneList<Expression*>* args = expr->arguments(); |
| int arg_count = args->length(); |
| - { PreservePositionScope pos_scope(masm()->positions_recorder()); |
| - PushCalleeAndWithBaseObject(expr); |
| + PushCalleeAndWithBaseObject(expr); |
| - // Push the arguments. |
| - for (int i = 0; i < arg_count; i++) { |
| - VisitForStackValue(args->at(i)); |
| - } |
| + // Push the arguments. |
| + for (int i = 0; i < arg_count; i++) { |
| + VisitForStackValue(args->at(i)); |
| + } |
| - // Push a copy of the function (found below the arguments) and |
| - // resolve eval. |
| - __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| - __ push(r1); |
| - EmitResolvePossiblyDirectEval(arg_count); |
| + // Push a copy of the function (found below the arguments) and |
| + // resolve eval. |
| + __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| + __ push(r1); |
| + EmitResolvePossiblyDirectEval(arg_count); |
| - // Touch up the stack with the resolved function. |
| - __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| + // Touch up the stack with the resolved function. |
| + __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| - PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| - } |
| + PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS); |
| // Record source position for debugger. |
| - SetSourcePosition(expr->position()); |
| + SetExpressionPosition(expr); |
| CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
| __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| __ CallStub(&stub); |
| @@ -3258,10 +3251,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
| EmitKeyedSuperCallWithLoadIC(expr); |
| } |
| } else { |
| - { |
| - PreservePositionScope scope(masm()->positions_recorder()); |
| VisitForStackValue(property->obj()); |
| - } |
| if (is_named_call) { |
| EmitCallWithLoadIC(expr); |
| } else { |
| @@ -3273,9 +3263,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); |
| - } |
| + VisitForStackValue(callee); |
| __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| __ push(r1); |
| // Emit function call. |
| @@ -3310,7 +3298,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 r1 and r0. |
| __ mov(r0, Operand(arg_count)); |
| @@ -3353,7 +3341,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 r1 and r0. |
| __ mov(r0, Operand(arg_count)); |
| @@ -4732,8 +4720,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); |
| __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| __ CallStub(&stub); |
| @@ -4911,7 +4898,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); |
| @@ -5067,8 +5053,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
| __ mov(r1, r0); |
| __ mov(r0, Operand(Smi::FromInt(count_value))); |
| - // Record position before stub call. |
| - SetSourcePosition(expr->position()); |
| + SetExpressionPosition(expr); |
| Handle<Code> code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, |
| strength(language_mode())).code(); |
| @@ -5284,7 +5269,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. |
| @@ -5338,8 +5323,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()); |