| Index: src/ia32/full-codegen-ia32.cc
|
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
|
| index 1f7095f578082e717a05c9ecd2cb5e121e5be613..26597d94c93c2a9f62d6b9b8ba51b83aaf0ca988 100644
|
| --- a/src/ia32/full-codegen-ia32.cc
|
| +++ b/src/ia32/full-codegen-ia32.cc
|
| @@ -43,6 +43,12 @@ namespace internal {
|
|
|
| #define __ ACCESS_MASM(masm_)
|
|
|
| +static AstId GetPropertyId(Property* property) {
|
| + if (property->is_synthetic()) return kNoAstId;
|
| + return property->id();
|
| +}
|
| +
|
| +
|
| // Generate code for a JS function. On entry to the function the receiver
|
| // and arguments have been pushed on the stack left to right, with the
|
| // return address on top of them. The actual argument count matches the
|
| @@ -732,7 +738,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
|
| SetSourcePosition(clause->position());
|
|
|
| Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT);
|
| - __ call(ic, RelocInfo::CODE_TARGET);
|
| + __ call(ic, RelocInfo::CODE_TARGET, clause->label()->id());
|
|
|
| __ test(eax, Operand(eax));
|
| __ j(not_equal, &next_test);
|
| @@ -1104,7 +1110,7 @@ void FullCodeGenerator::EmitDynamicLoadFromSlotFastCase(
|
| slow));
|
| __ mov(eax, Immediate(key_literal->handle()));
|
| Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
|
| __ jmp(done);
|
| }
|
| }
|
| @@ -1190,7 +1196,7 @@ void FullCodeGenerator::EmitVariableLoad(Variable* var) {
|
|
|
| // Do a keyed property load.
|
| Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(property));
|
|
|
| // Drop key and object left on the stack by IC.
|
| context()->Plug(eax);
|
| @@ -1295,7 +1301,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
|
| __ mov(ecx, Immediate(key->handle()));
|
| __ mov(edx, Operand(esp, 0));
|
| Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, key->id());
|
| PrepareForBailoutForId(key->id(), NO_REGISTERS);
|
| } else {
|
| VisitForEffect(value);
|
| @@ -1497,14 +1503,14 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
|
| SetSourcePosition(expr->position() + 1);
|
| AccumulatorValueContext context(this);
|
| if (ShouldInlineSmiCase(op)) {
|
| - EmitInlineSmiBinaryOp(expr,
|
| + EmitInlineSmiBinaryOp(expr->binary_operation(),
|
| op,
|
| mode,
|
| expr->target(),
|
| expr->value(),
|
| constant);
|
| } else {
|
| - EmitBinaryOp(op, mode);
|
| + EmitBinaryOp(expr->binary_operation(), op, mode);
|
| }
|
|
|
| // Deoptimization point in case the binary operation may have side effects.
|
| @@ -1537,18 +1543,18 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
|
| Literal* key = prop->key()->AsLiteral();
|
| __ mov(ecx, Immediate(key->handle()));
|
| Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| }
|
|
|
|
|
| void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
|
| SetSourcePosition(prop->position());
|
| Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitConstantSmiAdd(Expression* expr,
|
| +void FullCodeGenerator::EmitConstantSmiAdd(BinaryOperation* expr,
|
| OverwriteMode mode,
|
| bool left_is_constant_smi,
|
| Smi* value) {
|
| @@ -1570,13 +1576,13 @@ void FullCodeGenerator::EmitConstantSmiAdd(Expression* expr,
|
| __ mov(edx, eax);
|
| __ mov(eax, Immediate(value));
|
| }
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->id());
|
| __ bind(&done);
|
| context()->Plug(eax);
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitConstantSmiSub(Expression* expr,
|
| +void FullCodeGenerator::EmitConstantSmiSub(BinaryOperation* expr,
|
| OverwriteMode mode,
|
| bool left_is_constant_smi,
|
| Smi* value) {
|
| @@ -1603,13 +1609,13 @@ void FullCodeGenerator::EmitConstantSmiSub(Expression* expr,
|
| }
|
| Token::Value op = Token::SUB;
|
| TypeRecordingBinaryOpStub stub(op, mode);
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->id());
|
| __ bind(&done);
|
| context()->Plug(eax);
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitConstantSmiShiftOp(Expression* expr,
|
| +void FullCodeGenerator::EmitConstantSmiShiftOp(BinaryOperation* expr,
|
| Token::Value op,
|
| OverwriteMode mode,
|
| Smi* value) {
|
| @@ -1623,7 +1629,7 @@ void FullCodeGenerator::EmitConstantSmiShiftOp(Expression* expr,
|
| __ mov(edx, eax);
|
| __ mov(eax, Immediate(value));
|
| TypeRecordingBinaryOpStub stub(op, mode);
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->id());
|
| __ jmp(&done);
|
|
|
| __ bind(&smi_case);
|
| @@ -1671,7 +1677,7 @@ void FullCodeGenerator::EmitConstantSmiShiftOp(Expression* expr,
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitConstantSmiBitOp(Expression* expr,
|
| +void FullCodeGenerator::EmitConstantSmiBitOp(BinaryOperation* expr,
|
| Token::Value op,
|
| OverwriteMode mode,
|
| Smi* value) {
|
| @@ -1683,7 +1689,7 @@ void FullCodeGenerator::EmitConstantSmiBitOp(Expression* expr,
|
| // constant operand.
|
| __ mov(edx, Immediate(value));
|
| TypeRecordingBinaryOpStub stub(op, mode);
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->id());
|
| __ jmp(&done);
|
|
|
| __ bind(&smi_case);
|
| @@ -1706,7 +1712,7 @@ void FullCodeGenerator::EmitConstantSmiBitOp(Expression* expr,
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitConstantSmiBinaryOp(Expression* expr,
|
| +void FullCodeGenerator::EmitConstantSmiBinaryOp(BinaryOperation* expr,
|
| Token::Value op,
|
| OverwriteMode mode,
|
| bool left_is_constant_smi,
|
| @@ -1735,7 +1741,7 @@ void FullCodeGenerator::EmitConstantSmiBinaryOp(Expression* expr,
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr,
|
| +void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
|
| Token::Value op,
|
| OverwriteMode mode,
|
| Expression* left,
|
| @@ -1763,7 +1769,7 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr,
|
| __ bind(&stub_call);
|
| __ mov(eax, ecx);
|
| TypeRecordingBinaryOpStub stub(op, mode);
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->id());
|
| __ jmp(&done);
|
|
|
| __ bind(&smi_case);
|
| @@ -1840,11 +1846,12 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(Expression* expr,
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitBinaryOp(Token::Value op,
|
| +void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
|
| + Token::Value op,
|
| OverwriteMode mode) {
|
| __ pop(edx);
|
| TypeRecordingBinaryOpStub stub(op, mode);
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->id());
|
| context()->Plug(eax);
|
| }
|
|
|
| @@ -1999,7 +2006,7 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) {
|
| __ pop(edx);
|
| }
|
| Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
|
|
| // If the assignment ends an initialization block, revert to fast case.
|
| if (expr->ends_initialization_block()) {
|
| @@ -2037,7 +2044,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
| // Record source code position before IC call.
|
| SetSourcePosition(expr->position());
|
| Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
|
|
| // If the assignment ends an initialization block, revert to fast case.
|
| if (expr->ends_initialization_block()) {
|
| @@ -2086,7 +2093,7 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr,
|
| SetSourcePosition(expr->position());
|
| InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
|
| Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop);
|
| - EmitCallIC(ic, mode);
|
| + EmitCallIC(ic, mode, expr->id());
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| @@ -2119,7 +2126,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
|
| InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
|
| Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
|
| __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key.
|
| - EmitCallIC(ic, mode);
|
| + EmitCallIC(ic, mode, expr->id());
|
| RecordJSReturnSite(expr);
|
| // Restore context register.
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| @@ -2271,7 +2278,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
|
| __ pop(edx); // We do not need to keep the receiver.
|
|
|
| Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, GetPropertyId(prop));
|
| // Push result (function).
|
| __ push(eax);
|
| // Push Global receiver.
|
| @@ -3472,7 +3479,7 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
|
| __ Set(ecx, Immediate(expr->name()));
|
| InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
|
| Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop);
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| // Restore context register.
|
| __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
| } else {
|
| @@ -3738,7 +3745,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| __ mov(eax, Immediate(Smi::FromInt(1)));
|
| TypeRecordingBinaryOpStub stub(expr->binary_op(),
|
| NO_OVERWRITE);
|
| - __ CallStub(&stub);
|
| + __ CallStub(&stub, expr->increment()->id());
|
| __ bind(&done);
|
|
|
| // Store the value returned in eax.
|
| @@ -3765,7 +3772,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| __ mov(ecx, prop->key()->AsLiteral()->handle());
|
| __ pop(edx);
|
| Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| if (expr->is_postfix()) {
|
| if (!context()->IsEffect()) {
|
| context()->PlugTOS();
|
| @@ -3779,7 +3786,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| __ pop(ecx);
|
| __ pop(edx);
|
| Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
|
| - EmitCallIC(ic, RelocInfo::CODE_TARGET);
|
| + EmitCallIC(ic, RelocInfo::CODE_TARGET, expr->id());
|
| if (expr->is_postfix()) {
|
| // Result is on the stack
|
| if (!context()->IsEffect()) {
|
| @@ -4019,7 +4026,7 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) {
|
| // Record position and call the compare IC.
|
| Handle<Code> ic = CompareIC::GetUninitialized(op);
|
| SetSourcePosition(expr->position());
|
| - __ call(ic, RelocInfo::CODE_TARGET);
|
| + __ call(ic, RelocInfo::CODE_TARGET, expr->id());
|
| PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
|
| __ test(eax, Operand(eax));
|
| Split(cc, if_true, if_false, fall_through);
|
| @@ -4078,7 +4085,9 @@ Register FullCodeGenerator::context_register() {
|
| }
|
|
|
|
|
| -void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
|
| +void FullCodeGenerator::EmitCallIC(Handle<Code> ic,
|
| + RelocInfo::Mode mode,
|
| + AstId id) {
|
| ASSERT(mode == RelocInfo::CODE_TARGET ||
|
| mode == RelocInfo::CODE_TARGET_CONTEXT);
|
| switch (ic->kind()) {
|
| @@ -4097,7 +4106,7 @@ void FullCodeGenerator::EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode) {
|
| break;
|
| }
|
|
|
| - __ call(ic, mode);
|
| + __ call(ic, mode, id);
|
|
|
| // Crankshaft doesn't need patching of inlined loads and stores.
|
| // When compiling the snapshot we need to produce code that works
|
|
|