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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 __ push(Immediate(property->key()->AsLiteral()->handle())); | 1556 __ push(Immediate(property->key()->AsLiteral()->handle())); |
1557 } else { | 1557 } else { |
1558 VisitForStackValue(property->obj()); | 1558 VisitForStackValue(property->obj()); |
1559 VisitForStackValue(property->key()); | 1559 VisitForStackValue(property->key()); |
1560 } | 1560 } |
1561 } | 1561 } |
1562 break; | 1562 break; |
1563 } | 1563 } |
1564 } | 1564 } |
1565 | 1565 |
| 1566 // For compound assignments we need another deoptimization point after the |
| 1567 // variable/property load. |
1566 if (expr->is_compound()) { | 1568 if (expr->is_compound()) { |
1567 { AccumulatorValueContext context(this); | 1569 { AccumulatorValueContext context(this); |
1568 switch (assign_type) { | 1570 switch (assign_type) { |
1569 case VARIABLE: | 1571 case VARIABLE: |
1570 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1572 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
| 1573 PrepareForBailout(expr->target(), TOS_REG); |
1571 break; | 1574 break; |
1572 case NAMED_PROPERTY: | 1575 case NAMED_PROPERTY: |
1573 EmitNamedPropertyLoad(property); | 1576 EmitNamedPropertyLoad(property); |
| 1577 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1574 break; | 1578 break; |
1575 case KEYED_PROPERTY: | 1579 case KEYED_PROPERTY: |
1576 EmitKeyedPropertyLoad(property); | 1580 EmitKeyedPropertyLoad(property); |
| 1581 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1577 break; | 1582 break; |
1578 } | 1583 } |
1579 } | 1584 } |
1580 | 1585 |
1581 // For property compound assignments we need another deoptimization | |
1582 // point after the property load. | |
1583 if (property != NULL) { | |
1584 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1585 } | |
1586 | |
1587 Token::Value op = expr->binary_op(); | 1586 Token::Value op = expr->binary_op(); |
1588 __ push(eax); // Left operand goes on the stack. | 1587 __ push(eax); // Left operand goes on the stack. |
1589 VisitForAccumulatorValue(expr->value()); | 1588 VisitForAccumulatorValue(expr->value()); |
1590 | 1589 |
1591 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1590 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1592 ? OVERWRITE_RIGHT | 1591 ? OVERWRITE_RIGHT |
1593 : NO_OVERWRITE; | 1592 : NO_OVERWRITE; |
1594 SetSourcePosition(expr->position() + 1); | 1593 SetSourcePosition(expr->position() + 1); |
1595 AccumulatorValueContext context(this); | 1594 AccumulatorValueContext context(this); |
1596 if (ShouldInlineSmiCase(op)) { | 1595 if (ShouldInlineSmiCase(op)) { |
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3835 VisitForAccumulatorValue(prop->key()); | 3834 VisitForAccumulatorValue(prop->key()); |
3836 } | 3835 } |
3837 __ mov(edx, Operand(esp, 0)); | 3836 __ mov(edx, Operand(esp, 0)); |
3838 __ push(eax); | 3837 __ push(eax); |
3839 EmitKeyedPropertyLoad(prop); | 3838 EmitKeyedPropertyLoad(prop); |
3840 } | 3839 } |
3841 } | 3840 } |
3842 | 3841 |
3843 // We need a second deoptimization point after loading the value | 3842 // We need a second deoptimization point after loading the value |
3844 // in case evaluating the property load my have a side effect. | 3843 // in case evaluating the property load my have a side effect. |
3845 PrepareForBailout(expr->increment(), TOS_REG); | 3844 if (assign_type == VARIABLE) { |
| 3845 PrepareForBailout(expr->expression(), TOS_REG); |
| 3846 } else { |
| 3847 PrepareForBailout(expr->increment(), TOS_REG); |
| 3848 } |
3846 | 3849 |
3847 // Call ToNumber only if operand is not a smi. | 3850 // Call ToNumber only if operand is not a smi. |
3848 NearLabel no_conversion; | 3851 NearLabel no_conversion; |
3849 if (ShouldInlineSmiCase(expr->op())) { | 3852 if (ShouldInlineSmiCase(expr->op())) { |
3850 __ test(eax, Immediate(kSmiTagMask)); | 3853 __ test(eax, Immediate(kSmiTagMask)); |
3851 __ j(zero, &no_conversion); | 3854 __ j(zero, &no_conversion); |
3852 } | 3855 } |
3853 ToNumberStub convert_stub; | 3856 ToNumberStub convert_stub; |
3854 __ CallStub(&convert_stub); | 3857 __ CallStub(&convert_stub); |
3855 __ bind(&no_conversion); | 3858 __ bind(&no_conversion); |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4354 // And return. | 4357 // And return. |
4355 __ ret(0); | 4358 __ ret(0); |
4356 } | 4359 } |
4357 | 4360 |
4358 | 4361 |
4359 #undef __ | 4362 #undef __ |
4360 | 4363 |
4361 } } // namespace v8::internal | 4364 } } // namespace v8::internal |
4362 | 4365 |
4363 #endif // V8_TARGET_ARCH_IA32 | 4366 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |