OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 __ push(Immediate(property->key()->AsLiteral()->handle())); | 1536 __ push(Immediate(property->key()->AsLiteral()->handle())); |
1537 } else { | 1537 } else { |
1538 VisitForStackValue(property->obj()); | 1538 VisitForStackValue(property->obj()); |
1539 VisitForStackValue(property->key()); | 1539 VisitForStackValue(property->key()); |
1540 } | 1540 } |
1541 } | 1541 } |
1542 break; | 1542 break; |
1543 } | 1543 } |
1544 } | 1544 } |
1545 | 1545 |
| 1546 // For compound assignments we need another deoptimization point after the |
| 1547 // variable/property load. |
1546 if (expr->is_compound()) { | 1548 if (expr->is_compound()) { |
1547 { AccumulatorValueContext context(this); | 1549 { AccumulatorValueContext context(this); |
1548 switch (assign_type) { | 1550 switch (assign_type) { |
1549 case VARIABLE: | 1551 case VARIABLE: |
1550 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1552 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
| 1553 PrepareForBailout(expr->target(), TOS_REG); |
1551 break; | 1554 break; |
1552 case NAMED_PROPERTY: | 1555 case NAMED_PROPERTY: |
1553 EmitNamedPropertyLoad(property); | 1556 EmitNamedPropertyLoad(property); |
| 1557 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1554 break; | 1558 break; |
1555 case KEYED_PROPERTY: | 1559 case KEYED_PROPERTY: |
1556 EmitKeyedPropertyLoad(property); | 1560 EmitKeyedPropertyLoad(property); |
| 1561 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1557 break; | 1562 break; |
1558 } | 1563 } |
1559 } | 1564 } |
1560 | 1565 |
1561 // For property compound assignments we need another deoptimization | |
1562 // point after the property load. | |
1563 if (property != NULL) { | |
1564 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1565 } | |
1566 | |
1567 Token::Value op = expr->binary_op(); | 1566 Token::Value op = expr->binary_op(); |
1568 __ push(eax); // Left operand goes on the stack. | 1567 __ push(eax); // Left operand goes on the stack. |
1569 VisitForAccumulatorValue(expr->value()); | 1568 VisitForAccumulatorValue(expr->value()); |
1570 | 1569 |
1571 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1570 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1572 ? OVERWRITE_RIGHT | 1571 ? OVERWRITE_RIGHT |
1573 : NO_OVERWRITE; | 1572 : NO_OVERWRITE; |
1574 SetSourcePosition(expr->position() + 1); | 1573 SetSourcePosition(expr->position() + 1); |
1575 AccumulatorValueContext context(this); | 1574 AccumulatorValueContext context(this); |
1576 if (ShouldInlineSmiCase(op)) { | 1575 if (ShouldInlineSmiCase(op)) { |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 VisitForAccumulatorValue(prop->key()); | 3740 VisitForAccumulatorValue(prop->key()); |
3742 } | 3741 } |
3743 __ mov(edx, Operand(esp, 0)); | 3742 __ mov(edx, Operand(esp, 0)); |
3744 __ push(eax); | 3743 __ push(eax); |
3745 EmitKeyedPropertyLoad(prop); | 3744 EmitKeyedPropertyLoad(prop); |
3746 } | 3745 } |
3747 } | 3746 } |
3748 | 3747 |
3749 // We need a second deoptimization point after loading the value | 3748 // We need a second deoptimization point after loading the value |
3750 // in case evaluating the property load my have a side effect. | 3749 // in case evaluating the property load my have a side effect. |
3751 PrepareForBailout(expr->increment(), TOS_REG); | 3750 if (assign_type == VARIABLE) { |
| 3751 PrepareForBailout(expr->expression(), TOS_REG); |
| 3752 } else { |
| 3753 PrepareForBailout(expr->increment(), TOS_REG); |
| 3754 } |
3752 | 3755 |
3753 // Call ToNumber only if operand is not a smi. | 3756 // Call ToNumber only if operand is not a smi. |
3754 NearLabel no_conversion; | 3757 NearLabel no_conversion; |
3755 if (ShouldInlineSmiCase(expr->op())) { | 3758 if (ShouldInlineSmiCase(expr->op())) { |
3756 __ test(eax, Immediate(kSmiTagMask)); | 3759 __ test(eax, Immediate(kSmiTagMask)); |
3757 __ j(zero, &no_conversion); | 3760 __ j(zero, &no_conversion); |
3758 } | 3761 } |
3759 ToNumberStub convert_stub; | 3762 ToNumberStub convert_stub; |
3760 __ CallStub(&convert_stub); | 3763 __ CallStub(&convert_stub); |
3761 __ bind(&no_conversion); | 3764 __ bind(&no_conversion); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 // And return. | 4262 // And return. |
4260 __ ret(0); | 4263 __ ret(0); |
4261 } | 4264 } |
4262 | 4265 |
4263 | 4266 |
4264 #undef __ | 4267 #undef __ |
4265 | 4268 |
4266 } } // namespace v8::internal | 4269 } } // namespace v8::internal |
4267 | 4270 |
4268 #endif // V8_TARGET_ARCH_IA32 | 4271 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |