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. | |
1548 if (expr->is_compound()) { | 1546 if (expr->is_compound()) { |
1549 { AccumulatorValueContext context(this); | 1547 { AccumulatorValueContext context(this); |
1550 switch (assign_type) { | 1548 switch (assign_type) { |
1551 case VARIABLE: | 1549 case VARIABLE: |
1552 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1550 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
1553 PrepareForBailout(expr->target(), TOS_REG); | |
1554 break; | 1551 break; |
1555 case NAMED_PROPERTY: | 1552 case NAMED_PROPERTY: |
1556 EmitNamedPropertyLoad(property); | 1553 EmitNamedPropertyLoad(property); |
1557 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1558 break; | 1554 break; |
1559 case KEYED_PROPERTY: | 1555 case KEYED_PROPERTY: |
1560 EmitKeyedPropertyLoad(property); | 1556 EmitKeyedPropertyLoad(property); |
1561 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1562 break; | 1557 break; |
1563 } | 1558 } |
1564 } | 1559 } |
1565 | 1560 |
| 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 |
1566 Token::Value op = expr->binary_op(); | 1567 Token::Value op = expr->binary_op(); |
1567 __ push(eax); // Left operand goes on the stack. | 1568 __ push(eax); // Left operand goes on the stack. |
1568 VisitForAccumulatorValue(expr->value()); | 1569 VisitForAccumulatorValue(expr->value()); |
1569 | 1570 |
1570 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1571 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1571 ? OVERWRITE_RIGHT | 1572 ? OVERWRITE_RIGHT |
1572 : NO_OVERWRITE; | 1573 : NO_OVERWRITE; |
1573 SetSourcePosition(expr->position() + 1); | 1574 SetSourcePosition(expr->position() + 1); |
1574 AccumulatorValueContext context(this); | 1575 AccumulatorValueContext context(this); |
1575 if (ShouldInlineSmiCase(op)) { | 1576 if (ShouldInlineSmiCase(op)) { |
(...skipping 2164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3740 VisitForAccumulatorValue(prop->key()); | 3741 VisitForAccumulatorValue(prop->key()); |
3741 } | 3742 } |
3742 __ mov(edx, Operand(esp, 0)); | 3743 __ mov(edx, Operand(esp, 0)); |
3743 __ push(eax); | 3744 __ push(eax); |
3744 EmitKeyedPropertyLoad(prop); | 3745 EmitKeyedPropertyLoad(prop); |
3745 } | 3746 } |
3746 } | 3747 } |
3747 | 3748 |
3748 // We need a second deoptimization point after loading the value | 3749 // We need a second deoptimization point after loading the value |
3749 // in case evaluating the property load my have a side effect. | 3750 // in case evaluating the property load my have a side effect. |
3750 if (assign_type == VARIABLE) { | 3751 PrepareForBailout(expr->increment(), TOS_REG); |
3751 PrepareForBailout(expr->expression(), TOS_REG); | |
3752 } else { | |
3753 PrepareForBailout(expr->increment(), TOS_REG); | |
3754 } | |
3755 | 3752 |
3756 // Call ToNumber only if operand is not a smi. | 3753 // Call ToNumber only if operand is not a smi. |
3757 NearLabel no_conversion; | 3754 NearLabel no_conversion; |
3758 if (ShouldInlineSmiCase(expr->op())) { | 3755 if (ShouldInlineSmiCase(expr->op())) { |
3759 __ test(eax, Immediate(kSmiTagMask)); | 3756 __ test(eax, Immediate(kSmiTagMask)); |
3760 __ j(zero, &no_conversion); | 3757 __ j(zero, &no_conversion); |
3761 } | 3758 } |
3762 ToNumberStub convert_stub; | 3759 ToNumberStub convert_stub; |
3763 __ CallStub(&convert_stub); | 3760 __ CallStub(&convert_stub); |
3764 __ bind(&no_conversion); | 3761 __ bind(&no_conversion); |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4262 // And return. | 4259 // And return. |
4263 __ ret(0); | 4260 __ ret(0); |
4264 } | 4261 } |
4265 | 4262 |
4266 | 4263 |
4267 #undef __ | 4264 #undef __ |
4268 | 4265 |
4269 } } // namespace v8::internal | 4266 } } // namespace v8::internal |
4270 | 4267 |
4271 #endif // V8_TARGET_ARCH_IA32 | 4268 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |