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 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 VisitForAccumulatorValue(prop->key()); | 3442 VisitForAccumulatorValue(prop->key()); |
3444 } | 3443 } |
3445 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack | 3444 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack |
3446 __ push(rax); // Copy of key, needed for later store. | 3445 __ push(rax); // Copy of key, needed for later store. |
3447 EmitKeyedPropertyLoad(prop); | 3446 EmitKeyedPropertyLoad(prop); |
3448 } | 3447 } |
3449 } | 3448 } |
3450 | 3449 |
3451 // We need a second deoptimization point after loading the value | 3450 // We need a second deoptimization point after loading the value |
3452 // in case evaluating the property load my have a side effect. | 3451 // in case evaluating the property load my have a side effect. |
3453 PrepareForBailout(expr->increment(), TOS_REG); | 3452 if (assign_type == VARIABLE) { |
| 3453 PrepareForBailout(expr->expression(), TOS_REG); |
| 3454 } else { |
| 3455 PrepareForBailout(expr->increment(), TOS_REG); |
| 3456 } |
3454 | 3457 |
3455 // Call ToNumber only if operand is not a smi. | 3458 // Call ToNumber only if operand is not a smi. |
3456 NearLabel no_conversion; | 3459 NearLabel no_conversion; |
3457 Condition is_smi; | 3460 Condition is_smi; |
3458 is_smi = masm_->CheckSmi(rax); | 3461 is_smi = masm_->CheckSmi(rax); |
3459 __ j(is_smi, &no_conversion); | 3462 __ j(is_smi, &no_conversion); |
3460 ToNumberStub convert_stub; | 3463 ToNumberStub convert_stub; |
3461 __ CallStub(&convert_stub); | 3464 __ CallStub(&convert_stub); |
3462 __ bind(&no_conversion); | 3465 __ bind(&no_conversion); |
3463 | 3466 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3966 __ ret(0); | 3969 __ ret(0); |
3967 } | 3970 } |
3968 | 3971 |
3969 | 3972 |
3970 #undef __ | 3973 #undef __ |
3971 | 3974 |
3972 | 3975 |
3973 } } // namespace v8::internal | 3976 } } // namespace v8::internal |
3974 | 3977 |
3975 #endif // V8_TARGET_ARCH_X64 | 3978 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |