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 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 __ Push(property->key()->AsLiteral()->handle()); | 1569 __ Push(property->key()->AsLiteral()->handle()); |
1570 } else { | 1570 } else { |
1571 VisitForStackValue(property->obj()); | 1571 VisitForStackValue(property->obj()); |
1572 VisitForStackValue(property->key()); | 1572 VisitForStackValue(property->key()); |
1573 } | 1573 } |
1574 } | 1574 } |
1575 break; | 1575 break; |
1576 } | 1576 } |
1577 } | 1577 } |
1578 | 1578 |
| 1579 // For compound assignments we need another deoptimization point after the |
| 1580 // variable/property load. |
1579 if (expr->is_compound()) { | 1581 if (expr->is_compound()) { |
1580 { AccumulatorValueContext context(this); | 1582 { AccumulatorValueContext context(this); |
1581 switch (assign_type) { | 1583 switch (assign_type) { |
1582 case VARIABLE: | 1584 case VARIABLE: |
1583 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1585 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
| 1586 PrepareForBailout(expr->target(), TOS_REG); |
1584 break; | 1587 break; |
1585 case NAMED_PROPERTY: | 1588 case NAMED_PROPERTY: |
1586 EmitNamedPropertyLoad(property); | 1589 EmitNamedPropertyLoad(property); |
| 1590 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1587 break; | 1591 break; |
1588 case KEYED_PROPERTY: | 1592 case KEYED_PROPERTY: |
1589 EmitKeyedPropertyLoad(property); | 1593 EmitKeyedPropertyLoad(property); |
| 1594 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1590 break; | 1595 break; |
1591 } | 1596 } |
1592 } | 1597 } |
1593 | 1598 |
1594 // For property compound assignments we need another deoptimization | |
1595 // point after the property load. | |
1596 if (property != NULL) { | |
1597 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1598 } | |
1599 | |
1600 Token::Value op = expr->binary_op(); | 1599 Token::Value op = expr->binary_op(); |
1601 __ push(rax); // Left operand goes on the stack. | 1600 __ push(rax); // Left operand goes on the stack. |
1602 VisitForAccumulatorValue(expr->value()); | 1601 VisitForAccumulatorValue(expr->value()); |
1603 | 1602 |
1604 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1603 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1605 ? OVERWRITE_RIGHT | 1604 ? OVERWRITE_RIGHT |
1606 : NO_OVERWRITE; | 1605 : NO_OVERWRITE; |
1607 SetSourcePosition(expr->position() + 1); | 1606 SetSourcePosition(expr->position() + 1); |
1608 AccumulatorValueContext context(this); | 1607 AccumulatorValueContext context(this); |
1609 if (ShouldInlineSmiCase(op)) { | 1608 if (ShouldInlineSmiCase(op)) { |
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3811 VisitForAccumulatorValue(prop->key()); | 3810 VisitForAccumulatorValue(prop->key()); |
3812 } | 3811 } |
3813 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack | 3812 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack |
3814 __ push(rax); // Copy of key, needed for later store. | 3813 __ push(rax); // Copy of key, needed for later store. |
3815 EmitKeyedPropertyLoad(prop); | 3814 EmitKeyedPropertyLoad(prop); |
3816 } | 3815 } |
3817 } | 3816 } |
3818 | 3817 |
3819 // We need a second deoptimization point after loading the value | 3818 // We need a second deoptimization point after loading the value |
3820 // in case evaluating the property load my have a side effect. | 3819 // in case evaluating the property load my have a side effect. |
3821 PrepareForBailout(expr->increment(), TOS_REG); | 3820 if (assign_type == VARIABLE) { |
| 3821 PrepareForBailout(expr->expression(), TOS_REG); |
| 3822 } else { |
| 3823 PrepareForBailout(expr->increment(), TOS_REG); |
| 3824 } |
3822 | 3825 |
3823 // Call ToNumber only if operand is not a smi. | 3826 // Call ToNumber only if operand is not a smi. |
3824 NearLabel no_conversion; | 3827 NearLabel no_conversion; |
3825 Condition is_smi; | 3828 Condition is_smi; |
3826 is_smi = masm_->CheckSmi(rax); | 3829 is_smi = masm_->CheckSmi(rax); |
3827 __ j(is_smi, &no_conversion); | 3830 __ j(is_smi, &no_conversion); |
3828 ToNumberStub convert_stub; | 3831 ToNumberStub convert_stub; |
3829 __ CallStub(&convert_stub); | 3832 __ CallStub(&convert_stub); |
3830 __ bind(&no_conversion); | 3833 __ bind(&no_conversion); |
3831 | 3834 |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4336 __ ret(0); | 4339 __ ret(0); |
4337 } | 4340 } |
4338 | 4341 |
4339 | 4342 |
4340 #undef __ | 4343 #undef __ |
4341 | 4344 |
4342 | 4345 |
4343 } } // namespace v8::internal | 4346 } } // namespace v8::internal |
4344 | 4347 |
4345 #endif // V8_TARGET_ARCH_X64 | 4348 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |