Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 1218493005: Debugger: use debug break slots instead of ICs (except for calls). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/debug-ia32.cc ('k') | src/mips/debug-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index b8beaaa1f31c585a11827b31538dd7095ea2deb0..132a949bd073100cdb68c4a23d323c5220330558 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -469,7 +469,7 @@ void FullCodeGenerator::EmitReturnSequence() {
Label check_exit_codesize;
masm_->bind(&check_exit_codesize);
#endif
- SetSourcePosition(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.
@@ -1022,8 +1022,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
__ bind(&slow_case);
}
- // 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());
@@ -1070,9 +1069,9 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) {
Comment cmnt(masm_, "[ ForInStatement");
- FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
+ SetStatementPosition(stmt, SKIP_BREAK);
- SetStatementPosition(stmt);
+ FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
Label loop, exit;
ForIn loop_statement(this, stmt);
@@ -1080,7 +1079,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());
__ cmp(eax, isolate()->factory()->undefined_value());
__ j(equal, &exit);
@@ -1175,7 +1174,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());
__ mov(eax, Operand(esp, 0 * kPointerSize)); // Get the current index.
__ cmp(eax, Operand(esp, 1 * kPointerSize)); // Compare to the array length.
@@ -1420,8 +1419,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();
@@ -1919,6 +1917,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);
@@ -2008,7 +2007,6 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
__ push(eax); // Left operand goes on the stack.
VisitForAccumulatorValue(expr->value());
- SetSourcePosition(expr->position() + 1);
if (ShouldInlineSmiCase(op)) {
EmitInlineSmiBinaryOp(expr->binary_operation(),
op,
@@ -2024,8 +2022,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) {
@@ -2055,6 +2052,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());
@@ -2340,7 +2339,7 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) {
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
- SetSourcePosition(prop->position());
+ SetExpressionPosition(prop);
Literal* key = prop->key()->AsLiteral();
DCHECK(!key->value()->IsSmi());
DCHECK(!prop->IsSuperAccess());
@@ -2354,7 +2353,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());
@@ -2366,7 +2365,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(),
Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
@@ -2376,9 +2375,8 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
// Stack: receiver, home_object, key.
+ SetExpressionPosition(prop);
__ push(Immediate(Smi::FromInt(language_mode())));
- SetSourcePosition(prop->position());
-
__ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
}
@@ -2738,13 +2736,10 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
// Assignment to a property, using a named store IC.
// eax : value
// esp[0] : receiver
-
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(), prop->key()->AsLiteral()->value());
__ pop(StoreDescriptor::ReceiverRegister());
if (FLAG_vector_stores) {
@@ -2796,8 +2791,6 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
__ pop(StoreDescriptor::NameRegister()); // Key.
__ pop(StoreDescriptor::ReceiverRegister());
DCHECK(StoreDescriptor::ValueRegister().is(eax));
- // Record source code position before IC call.
- SetSourcePosition(expr->position());
Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
if (FLAG_vector_stores) {
@@ -2814,6 +2807,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
void FullCodeGenerator::VisitProperty(Property* expr) {
Comment cmnt(masm_, "[ Property");
+ SetExpressionPosition(expr);
+
Expression* key = expr->key();
if (key->IsPropertyName()) {
@@ -2886,12 +2881,12 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) {
void FullCodeGenerator::EmitSuperCallWithLoadIC(Call* expr) {
+ SetExpressionPosition(expr);
Expression* callee = expr->expression();
DCHECK(callee->IsProperty());
Property* prop = callee->AsProperty();
DCHECK(prop->IsSuperAccess());
- SetSourcePosition(prop->position());
Literal* key = prop->key()->AsLiteral();
DCHECK(!key->value()->IsSmi());
// Load the function from the receiver.
@@ -2951,7 +2946,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());
@@ -2984,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(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot())));
__ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
@@ -3051,13 +3043,11 @@ 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 eax) and
// the object holding it (returned in edx).
@@ -3106,26 +3096,25 @@ 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.
- for (int i = 0; i < arg_count; i++) {
- VisitForStackValue(args->at(i));
- }
+ PushCalleeAndWithBaseObject(expr);
- // Push a copy of the function (found below the arguments) and
- // resolve eval.
- __ push(Operand(esp, (arg_count + 1) * kPointerSize));
- EmitResolvePossiblyDirectEval(arg_count);
+ // Push the arguments.
+ for (int i = 0; i < arg_count; i++) {
+ VisitForStackValue(args->at(i));
+ }
- // Touch up the stack with the resolved function.
- __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
+ // Push a copy of the function (found below the arguments) and
+ // resolve eval.
+ __ push(Operand(esp, (arg_count + 1) * kPointerSize));
+ EmitResolvePossiblyDirectEval(arg_count);
- PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
- }
- // Record source position for debugger.
- SetSourcePosition(expr->position());
+ // Touch up the stack with the resolved function.
+ __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
+
+ PrepareForBailoutForId(expr->EvalId(), NO_REGISTERS);
+
+ SetExpressionPosition(expr);
CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
__ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
__ CallStub(&stub);
@@ -3150,10 +3139,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
EmitKeyedSuperCallWithLoadIC(expr);
}
} else {
- {
- PreservePositionScope scope(masm()->positions_recorder());
- VisitForStackValue(property->obj());
- }
+ VisitForStackValue(property->obj());
if (is_named_call) {
EmitCallWithLoadIC(expr);
} else {
@@ -3165,9 +3151,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);
__ push(Immediate(isolate()->factory()->undefined_value()));
// Emit function call.
EmitCall(expr);
@@ -3201,7 +3185,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 edi and eax.
__ Move(eax, Immediate(arg_count));
@@ -3244,7 +3228,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.
__ Move(eax, Immediate(arg_count));
@@ -4667,8 +4651,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);
__ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
__ CallStub(&stub);
@@ -4848,7 +4831,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);
@@ -4999,8 +4981,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
}
}
- // Record position before stub call.
- SetSourcePosition(expr->position());
+ SetExpressionPosition(expr);
// Call stub for +1/-1.
__ bind(&stub_call);
@@ -5221,7 +5202,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.
@@ -5275,8 +5256,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());
« no previous file with comments | « src/ia32/debug-ia32.cc ('k') | src/mips/debug-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698