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 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1597 __ mov(r0, Operand(property->key()->AsLiteral()->handle())); | 1597 __ mov(r0, Operand(property->key()->AsLiteral()->handle())); |
1598 __ Push(r1, r0); | 1598 __ Push(r1, r0); |
1599 } else { | 1599 } else { |
1600 VisitForStackValue(property->obj()); | 1600 VisitForStackValue(property->obj()); |
1601 VisitForStackValue(property->key()); | 1601 VisitForStackValue(property->key()); |
1602 } | 1602 } |
1603 } | 1603 } |
1604 break; | 1604 break; |
1605 } | 1605 } |
1606 | 1606 |
1607 // For compound assignments we need another deoptimization point after the | |
1608 // variable/property load. | |
1607 if (expr->is_compound()) { | 1609 if (expr->is_compound()) { |
1608 { AccumulatorValueContext context(this); | 1610 { AccumulatorValueContext context(this); |
1609 switch (assign_type) { | 1611 switch (assign_type) { |
1610 case VARIABLE: | 1612 case VARIABLE: |
1611 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); | 1613 EmitVariableLoad(expr->target()->AsVariableProxy()->var()); |
1614 PrepareForBailout(expr->target(), TOS_REG); | |
1612 break; | 1615 break; |
1613 case NAMED_PROPERTY: | 1616 case NAMED_PROPERTY: |
1614 EmitNamedPropertyLoad(property); | 1617 EmitNamedPropertyLoad(property); |
1618 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1615 break; | 1619 break; |
1616 case KEYED_PROPERTY: | 1620 case KEYED_PROPERTY: |
1617 EmitKeyedPropertyLoad(property); | 1621 EmitKeyedPropertyLoad(property); |
1622 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1618 break; | 1623 break; |
1619 } | 1624 } |
1620 } | 1625 } |
1621 | 1626 |
1622 // For property compound assignments we need another deoptimization | |
1623 // point after the property load. | |
1624 if (property != NULL) { | |
1625 PrepareForBailoutForId(expr->CompoundLoadId(), TOS_REG); | |
1626 } | |
1627 | |
1628 Token::Value op = expr->binary_op(); | 1627 Token::Value op = expr->binary_op(); |
1629 __ push(r0); // Left operand goes on the stack. | 1628 __ push(r0); // Left operand goes on the stack. |
1630 VisitForAccumulatorValue(expr->value()); | 1629 VisitForAccumulatorValue(expr->value()); |
1631 | 1630 |
1632 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() | 1631 OverwriteMode mode = expr->value()->ResultOverwriteAllowed() |
1633 ? OVERWRITE_RIGHT | 1632 ? OVERWRITE_RIGHT |
1634 : NO_OVERWRITE; | 1633 : NO_OVERWRITE; |
1635 SetSourcePosition(expr->position() + 1); | 1634 SetSourcePosition(expr->position() + 1); |
1636 AccumulatorValueContext context(this); | 1635 AccumulatorValueContext context(this); |
1637 if (ShouldInlineSmiCase(op)) { | 1636 if (ShouldInlineSmiCase(op)) { |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3769 if (prop != NULL) { | 3768 if (prop != NULL) { |
3770 assign_type = | 3769 assign_type = |
3771 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; | 3770 (prop->key()->IsPropertyName()) ? NAMED_PROPERTY : KEYED_PROPERTY; |
3772 } | 3771 } |
3773 | 3772 |
3774 // Evaluate expression and get value. | 3773 // Evaluate expression and get value. |
3775 if (assign_type == VARIABLE) { | 3774 if (assign_type == VARIABLE) { |
3776 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); | 3775 ASSERT(expr->expression()->AsVariableProxy()->var() != NULL); |
3777 AccumulatorValueContext context(this); | 3776 AccumulatorValueContext context(this); |
3778 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); | 3777 EmitVariableLoad(expr->expression()->AsVariableProxy()->var()); |
3778 PrepareForBailout(expr->expression(), TOS_REG); | |
3779 } else { | 3779 } else { |
3780 // Reserve space for result of postfix operation. | 3780 // Reserve space for result of postfix operation. |
3781 if (expr->is_postfix() && !context()->IsEffect()) { | 3781 if (expr->is_postfix() && !context()->IsEffect()) { |
3782 __ mov(ip, Operand(Smi::FromInt(0))); | 3782 __ mov(ip, Operand(Smi::FromInt(0))); |
3783 __ push(ip); | 3783 __ push(ip); |
3784 } | 3784 } |
3785 if (assign_type == NAMED_PROPERTY) { | 3785 if (assign_type == NAMED_PROPERTY) { |
3786 // Put the object both on the stack and in the accumulator. | 3786 // Put the object both on the stack and in the accumulator. |
3787 VisitForAccumulatorValue(prop->obj()); | 3787 VisitForAccumulatorValue(prop->obj()); |
3788 __ push(r0); | 3788 __ push(r0); |
3789 EmitNamedPropertyLoad(prop); | 3789 EmitNamedPropertyLoad(prop); |
3790 } else { | 3790 } else { |
3791 if (prop->is_arguments_access()) { | 3791 if (prop->is_arguments_access()) { |
3792 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); | 3792 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); |
3793 __ ldr(r0, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); | 3793 __ ldr(r0, EmitSlotSearch(obj_proxy->var()->AsSlot(), r0)); |
3794 __ push(r0); | 3794 __ push(r0); |
3795 __ mov(r0, Operand(prop->key()->AsLiteral()->handle())); | 3795 __ mov(r0, Operand(prop->key()->AsLiteral()->handle())); |
3796 } else { | 3796 } else { |
3797 VisitForStackValue(prop->obj()); | 3797 VisitForStackValue(prop->obj()); |
3798 VisitForAccumulatorValue(prop->key()); | 3798 VisitForAccumulatorValue(prop->key()); |
3799 } | 3799 } |
3800 __ ldr(r1, MemOperand(sp, 0)); | 3800 __ ldr(r1, MemOperand(sp, 0)); |
3801 __ push(r0); | 3801 __ push(r0); |
3802 EmitKeyedPropertyLoad(prop); | 3802 EmitKeyedPropertyLoad(prop); |
3803 } | 3803 } |
3804 } | 3804 } |
3805 | 3805 |
3806 // We need a second deoptimization point after loading the value | 3806 // We need a second deoptimization point after loading the value |
3807 // in case evaluating the property load my have a side effect. | 3807 // in case evaluating the property load my have a side effect. |
3808 PrepareForBailout(expr->increment(), TOS_REG); | 3808 PrepareForBailout(expr->increment(), TOS_REG); |
fschneider
2011/03/16 10:28:18
I think it does not hurt here, but shouldn't this
Søren Thygesen Gjesse
2011/03/17 07:52:27
That looks right, done (on all platforms).
| |
3809 | 3809 |
3810 // Call ToNumber only if operand is not a smi. | 3810 // Call ToNumber only if operand is not a smi. |
3811 Label no_conversion; | 3811 Label no_conversion; |
3812 __ JumpIfSmi(r0, &no_conversion); | 3812 __ JumpIfSmi(r0, &no_conversion); |
3813 ToNumberStub convert_stub; | 3813 ToNumberStub convert_stub; |
3814 __ CallStub(&convert_stub); | 3814 __ CallStub(&convert_stub); |
3815 __ bind(&no_conversion); | 3815 __ bind(&no_conversion); |
3816 | 3816 |
3817 // Save result for postfix expressions. | 3817 // Save result for postfix expressions. |
3818 if (expr->is_postfix()) { | 3818 if (expr->is_postfix()) { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4282 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 4282 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
4283 __ add(pc, r1, Operand(masm_->CodeObject())); | 4283 __ add(pc, r1, Operand(masm_->CodeObject())); |
4284 } | 4284 } |
4285 | 4285 |
4286 | 4286 |
4287 #undef __ | 4287 #undef __ |
4288 | 4288 |
4289 } } // namespace v8::internal | 4289 } } // namespace v8::internal |
4290 | 4290 |
4291 #endif // V8_TARGET_ARCH_ARM | 4291 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |