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. | |
1563 if (expr->is_compound()) { | 1561 if (expr->is_compound()) { |
1564 { AccumulatorValueContext context(this); | 1562 { AccumulatorValueContext context(this); |
1565 switch (assign_type) { | 1563 switch (assign_type) { |
1566 case VARIABLE: | 1564 case VARIABLE: |
1567 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1565 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
1568 PrepareForBailout(expr->target(), TOS_REG); | |
1569 break; | 1566 break; |
1570 case NAMED_PROPERTY: | 1567 case NAMED_PROPERTY: |
1571 EmitNamedPropertyLoad(property); | 1568 EmitNamedPropertyLoad(property); |
1572 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1573 break; | 1569 break; |
1574 case KEYED_PROPERTY: | 1570 case KEYED_PROPERTY: |
1575 EmitKeyedPropertyLoad(property); | 1571 EmitKeyedPropertyLoad(property); |
1576 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1577 break; | 1572 break; |
1578 } | 1573 } |
1579 } | 1574 } |
1580 | 1575 |
| 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 |
1581 Token::Value op = expr->binary_op(); | 1582 Token::Value op = expr->binary_op(); |
1582 __ push(rax); // Left operand goes on the stack. | 1583 __ push(rax); // Left operand goes on the stack. |
1583 VisitForAccumulatorValue(expr->value()); | 1584 VisitForAccumulatorValue(expr->value()); |
1584 | 1585 |
1585 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1586 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1586 ? OVERWRITE_RIGHT | 1587 ? OVERWRITE_RIGHT |
1587 : NO_OVERWRITE; | 1588 : NO_OVERWRITE; |
1588 SetSourcePosition(expr->position() + 1); | 1589 SetSourcePosition(expr->position() + 1); |
1589 AccumulatorValueContext context(this); | 1590 AccumulatorValueContext context(this); |
1590 if (ShouldInlineSmiCase(op)) { | 1591 if (ShouldInlineSmiCase(op)) { |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3442 VisitForAccumulatorValue(prop->key()); | 3443 VisitForAccumulatorValue(prop->key()); |
3443 } | 3444 } |
3444 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack | 3445 __ movq(rdx, Operand(rsp, 0)); // Leave receiver on stack |
3445 __ push(rax); // Copy of key, needed for later store. | 3446 __ push(rax); // Copy of key, needed for later store. |
3446 EmitKeyedPropertyLoad(prop); | 3447 EmitKeyedPropertyLoad(prop); |
3447 } | 3448 } |
3448 } | 3449 } |
3449 | 3450 |
3450 // We need a second deoptimization point after loading the value | 3451 // We need a second deoptimization point after loading the value |
3451 // in case evaluating the property load my have a side effect. | 3452 // in case evaluating the property load my have a side effect. |
3452 if (assign_type == VARIABLE) { | 3453 PrepareForBailout(expr->increment(), TOS_REG); |
3453 PrepareForBailout(expr->expression(), TOS_REG); | |
3454 } else { | |
3455 PrepareForBailout(expr->increment(), TOS_REG); | |
3456 } | |
3457 | 3454 |
3458 // Call ToNumber only if operand is not a smi. | 3455 // Call ToNumber only if operand is not a smi. |
3459 NearLabel no_conversion; | 3456 NearLabel no_conversion; |
3460 Condition is_smi; | 3457 Condition is_smi; |
3461 is_smi = masm_->CheckSmi(rax); | 3458 is_smi = masm_->CheckSmi(rax); |
3462 __ j(is_smi, &no_conversion); | 3459 __ j(is_smi, &no_conversion); |
3463 ToNumberStub convert_stub; | 3460 ToNumberStub convert_stub; |
3464 __ CallStub(&convert_stub); | 3461 __ CallStub(&convert_stub); |
3465 __ bind(&no_conversion); | 3462 __ bind(&no_conversion); |
3466 | 3463 |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3969 __ ret(0); | 3966 __ ret(0); |
3970 } | 3967 } |
3971 | 3968 |
3972 | 3969 |
3973 #undef __ | 3970 #undef __ |
3974 | 3971 |
3975 | 3972 |
3976 } } // namespace v8::internal | 3973 } } // namespace v8::internal |
3977 | 3974 |
3978 #endif // V8_TARGET_ARCH_X64 | 3975 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |