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 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 __ Push(property->key()->AsLiteral()->handle()); | 1551 __ Push(property->key()->AsLiteral()->handle()); |
1552 } else { | 1552 } else { |
1553 VisitForStackValue(property->obj()); | 1553 VisitForStackValue(property->obj()); |
1554 VisitForStackValue(property->key()); | 1554 VisitForStackValue(property->key()); |
1555 } | 1555 } |
1556 } | 1556 } |
1557 break; | 1557 break; |
1558 } | 1558 } |
1559 } | 1559 } |
1560 | 1560 |
| 1561 // For compound assignments we need another deoptimization point after the |
| 1562 // variable/property load. |
1561 if (expr->is_compound()) { | 1563 if (expr->is_compound()) { |
1562 { AccumulatorValueContext context(this); | 1564 { AccumulatorValueContext context(this); |
1563 switch (assign_type) { | 1565 switch (assign_type) { |
1564 case VARIABLE: | 1566 case VARIABLE: |
1565 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1567 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
| 1568 PrepareForBailout(expr->target(), TOS_REG); |
1566 break; | 1569 break; |
1567 case NAMED_PROPERTY: | 1570 case NAMED_PROPERTY: |
1568 EmitNamedPropertyLoad(property); | 1571 EmitNamedPropertyLoad(property); |
| 1572 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1569 break; | 1573 break; |
1570 case KEYED_PROPERTY: | 1574 case KEYED_PROPERTY: |
1571 EmitKeyedPropertyLoad(property); | 1575 EmitKeyedPropertyLoad(property); |
| 1576 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); |
1572 break; | 1577 break; |
1573 } | 1578 } |
1574 } | 1579 } |
1575 | 1580 |
1576 // For property compound assignments we need another deoptimization | |
1577 // point after the property load. | |
1578 if (property != NULL) { | |
1579 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1580 } | |
1581 | |
1582 Token::Value op = expr->binary_op(); | 1581 Token::Value op = expr->binary_op(); |
1583 __ push(rax); // Left operand goes on the stack. | 1582 __ push(rax); // Left operand goes on the stack. |
1584 VisitForAccumulatorValue(expr->value()); | 1583 VisitForAccumulatorValue(expr->value()); |
1585 | 1584 |
1586 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1585 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1587 ? OVERWRITE_RIGHT | 1586 ? OVERWRITE_RIGHT |
1588 : NO_OVERWRITE; | 1587 : NO_OVERWRITE; |
1589 SetSourcePosition(expr->position() + 1); | 1588 SetSourcePosition(expr->position() + 1); |
1590 AccumulatorValueContext context(this); | 1589 AccumulatorValueContext context(this); |
1591 if (ShouldInlineSmiCase(op)) { | 1590 if (ShouldInlineSmiCase(op)) { |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3415 if (prop != NULL) { | 3414 if (prop != NULL) { |
3416 assign_type = | 3415 assign_type = |
3417 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 3416 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
3418 } | 3417 } |
3419 | 3418 |
3420 // Evaluate expression and get value. | 3419 // Evaluate expression and get value. |
3421 if (assign_type == VARIABLE) { | 3420 if (assign_type == VARIABLE) { |
3422 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); | 3421 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); |
3423 AccumulatorValueContext context(this); | 3422 AccumulatorValueContext context(this); |
3424 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); | 3423 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); |
| 3424 PrepareForBailout(expr->expression(), TOS_REG); |
3425 } else { | 3425 } else { |
3426 // Reserve space for result of postfix operation. | 3426 // Reserve space for result of postfix operation. |
3427 if (expr->is_postfix() && !context()->IsEffect()) { | 3427 if (expr->is_postfix() && !context()->IsEffect()) { |
3428 __ Push(Smi::FromInt(0)); | 3428 __ Push(Smi::FromInt(0)); |
3429 } | 3429 } |
3430 if (assign_type == NAMED_PROPERTY) { | 3430 if (assign_type == NAMED_PROPERTY) { |
3431 VisitForAccumulatorValue(prop->obj()); | 3431 VisitForAccumulatorValue(prop->obj()); |
3432 __ push(rax); // Copy of receiver, needed for later store. | 3432 __ push(rax); // Copy of receiver, needed for later store. |
3433 EmitNamedPropertyLoad(prop); | 3433 EmitNamedPropertyLoad(prop); |
3434 } else { | 3434 } else { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3966 __ ret(0); | 3966 __ ret(0); |
3967 } | 3967 } |
3968 | 3968 |
3969 | 3969 |
3970 #undef __ | 3970 #undef __ |
3971 | 3971 |
3972 | 3972 |
3973 } } // namespace v8::internal | 3973 } } // namespace v8::internal |
3974 | 3974 |
3975 #endif // V8_TARGET_ARCH_X64 | 3975 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |