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 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3712 if (prop != NULL) { | 3711 if (prop != NULL) { |
3713 assign_type = | 3712 assign_type = |
3714 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 3713 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
3715 } | 3714 } |
3716 | 3715 |
3717 // Evaluate expression and get value. | 3716 // Evaluate expression and get value. |
3718 if (assign_type == VARIABLE) { | 3717 if (assign_type == VARIABLE) { |
3719 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); | 3718 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); |
3720 AccumulatorValueContext context(this); | 3719 AccumulatorValueContext context(this); |
3721 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); | 3720 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); |
| 3721 PrepareForBailout(expr->expression(), TOS_REG); |
3722 } else { | 3722 } else { |
3723 // Reserve space for result of postfix operation. | 3723 // Reserve space for result of postfix operation. |
3724 if (expr->is_postfix() && !context()->IsEffect()) { | 3724 if (expr->is_postfix() && !context()->IsEffect()) { |
3725 __ push(Immediate(Smi::FromInt(0))); | 3725 __ push(Immediate(Smi::FromInt(0))); |
3726 } | 3726 } |
3727 if (assign_type == NAMED_PROPERTY) { | 3727 if (assign_type == NAMED_PROPERTY) { |
3728 // Put the object both on the stack and in the accumulator. | 3728 // Put the object both on the stack and in the accumulator. |
3729 VisitForAccumulatorValue(prop->obj()); | 3729 VisitForAccumulatorValue(prop->obj()); |
3730 __ push(eax); | 3730 __ push(eax); |
3731 EmitNamedPropertyLoad(prop); | 3731 EmitNamedPropertyLoad(prop); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4259 // And return. | 4259 // And return. |
4260 __ ret(0); | 4260 __ ret(0); |
4261 } | 4261 } |
4262 | 4262 |
4263 | 4263 |
4264 #undef __ | 4264 #undef __ |
4265 | 4265 |
4266 } } // namespace v8::internal | 4266 } } // namespace v8::internal |
4267 | 4267 |
4268 #endif // V8_TARGET_ARCH_IA32 | 4268 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |