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 3692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3703 } | 3703 } |
3704 __ CallRuntime(Runtime::kTypeof, 1); | 3704 __ CallRuntime(Runtime::kTypeof, 1); |
3705 context()->Plug(rax); | 3705 context()->Plug(rax); |
3706 break; | 3706 break; |
3707 } | 3707 } |
3708 | 3708 |
3709 case Token::ADD: { | 3709 case Token::ADD: { |
3710 Comment cmt(masm_, "[ UnaryOperation (ADD)"); | 3710 Comment cmt(masm_, "[ UnaryOperation (ADD)"); |
3711 VisitForAccumulatorValue(expr->expression()); | 3711 VisitForAccumulatorValue(expr->expression()); |
3712 Label no_conversion; | 3712 Label no_conversion; |
3713 Condition is_smi = masm_->CheckSmi(result_register()); | 3713 __ JumpIfSmi(result_register(), &no_conversion); |
3714 __ j(is_smi, &no_conversion); | |
3715 ToNumberStub convert_stub; | 3714 ToNumberStub convert_stub; |
3716 __ CallStub(&convert_stub); | 3715 __ CallStub(&convert_stub); |
3717 __ bind(&no_conversion); | 3716 __ bind(&no_conversion); |
3718 context()->Plug(result_register()); | 3717 context()->Plug(result_register()); |
3719 break; | 3718 break; |
3720 } | 3719 } |
3721 | 3720 |
3722 case Token::SUB: | 3721 case Token::SUB: |
3723 EmitUnaryOperation(expr, "[ UnaryOperation (SUB)"); | 3722 EmitUnaryOperation(expr, "[ UnaryOperation (SUB)"); |
3724 break; | 3723 break; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3807 // We need a second deoptimization point after loading the value | 3806 // We need a second deoptimization point after loading the value |
3808 // in case evaluating the property load my have a side effect. | 3807 // in case evaluating the property load my have a side effect. |
3809 if (assign_type == VARIABLE) { | 3808 if (assign_type == VARIABLE) { |
3810 PrepareForBailout(expr->expression(), TOS_REG); | 3809 PrepareForBailout(expr->expression(), TOS_REG); |
3811 } else { | 3810 } else { |
3812 PrepareForBailoutForId(expr->CountId(), TOS_REG); | 3811 PrepareForBailoutForId(expr->CountId(), TOS_REG); |
3813 } | 3812 } |
3814 | 3813 |
3815 // Call ToNumber only if operand is not a smi. | 3814 // Call ToNumber only if operand is not a smi. |
3816 Label no_conversion; | 3815 Label no_conversion; |
3817 Condition is_smi; | 3816 __ JumpIfSmi(rax, &no_conversion, Label::kNear); |
3818 is_smi = masm_->CheckSmi(rax); | |
3819 __ j(is_smi, &no_conversion, Label::kNear); | |
3820 ToNumberStub convert_stub; | 3817 ToNumberStub convert_stub; |
3821 __ CallStub(&convert_stub); | 3818 __ CallStub(&convert_stub); |
3822 __ bind(&no_conversion); | 3819 __ bind(&no_conversion); |
3823 | 3820 |
3824 // Save result for postfix expressions. | 3821 // Save result for postfix expressions. |
3825 if (expr->is_postfix()) { | 3822 if (expr->is_postfix()) { |
3826 if (!context()->IsEffect()) { | 3823 if (!context()->IsEffect()) { |
3827 // Save the result on the stack. If we have a named or keyed property | 3824 // Save the result on the stack. If we have a named or keyed property |
3828 // we store the result under the receiver that is currently on top | 3825 // we store the result under the receiver that is currently on top |
3829 // of the stack. | 3826 // of the stack. |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4177 | 4174 |
4178 VisitForAccumulatorValue(expr->expression()); | 4175 VisitForAccumulatorValue(expr->expression()); |
4179 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 4176 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
4180 __ CompareRoot(rax, Heap::kNullValueRootIndex); | 4177 __ CompareRoot(rax, Heap::kNullValueRootIndex); |
4181 if (expr->is_strict()) { | 4178 if (expr->is_strict()) { |
4182 Split(equal, if_true, if_false, fall_through); | 4179 Split(equal, if_true, if_false, fall_through); |
4183 } else { | 4180 } else { |
4184 __ j(equal, if_true); | 4181 __ j(equal, if_true); |
4185 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); | 4182 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
4186 __ j(equal, if_true); | 4183 __ j(equal, if_true); |
4187 Condition is_smi = masm_->CheckSmi(rax); | 4184 __ JumpIfSmi(rax, if_false); |
4188 __ j(is_smi, if_false); | |
4189 // It can be an undetectable object. | 4185 // It can be an undetectable object. |
4190 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); | 4186 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); |
4191 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), | 4187 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
4192 Immediate(1 << Map::kIsUndetectable)); | 4188 Immediate(1 << Map::kIsUndetectable)); |
4193 Split(not_zero, if_true, if_false, fall_through); | 4189 Split(not_zero, if_true, if_false, fall_through); |
4194 } | 4190 } |
4195 context()->Plug(if_true, if_false); | 4191 context()->Plug(if_true, if_false); |
4196 } | 4192 } |
4197 | 4193 |
4198 | 4194 |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4309 __ ret(0); | 4305 __ ret(0); |
4310 } | 4306 } |
4311 | 4307 |
4312 | 4308 |
4313 #undef __ | 4309 #undef __ |
4314 | 4310 |
4315 | 4311 |
4316 } } // namespace v8::internal | 4312 } } // namespace v8::internal |
4317 | 4313 |
4318 #endif // V8_TARGET_ARCH_X64 | 4314 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |