OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3791 // If the object is not a value type, return the object. | 3791 // If the object is not a value type, return the object. |
3792 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); | 3792 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
3793 __ j(not_equal, &done, Label::kNear); | 3793 __ j(not_equal, &done, Label::kNear); |
3794 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); | 3794 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
3795 | 3795 |
3796 __ bind(&done); | 3796 __ bind(&done); |
3797 context()->Plug(eax); | 3797 context()->Plug(eax); |
3798 } | 3798 } |
3799 | 3799 |
3800 | 3800 |
3801 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { | 3801 void FullCodeGenerator::EmitIsDate(CallRuntime* expr) { |
3802 ZoneList<Expression*>* args = expr->arguments(); | 3802 ZoneList<Expression*>* args = expr->arguments(); |
3803 DCHECK_EQ(1, args->length()); | 3803 DCHECK_EQ(1, args->length()); |
3804 | 3804 |
3805 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3805 VisitForAccumulatorValue(args->at(0)); |
3806 | 3806 |
3807 Label done, not_date_object; | 3807 Label materialize_true, materialize_false; |
3808 Register object = eax; | 3808 Label* if_true = nullptr; |
3809 Register result = eax; | 3809 Label* if_false = nullptr; |
3810 Register scratch = ecx; | 3810 Label* fall_through = nullptr; |
| 3811 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
| 3812 &if_false, &fall_through); |
3811 | 3813 |
3812 __ JumpIfSmi(object, ¬_date_object, Label::kNear); | 3814 __ JumpIfSmi(eax, if_false); |
3813 __ CmpObjectType(object, JS_DATE_TYPE, scratch); | 3815 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); |
3814 __ j(equal, &done, Label::kNear); | 3816 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3815 __ bind(¬_date_object); | 3817 Split(equal, if_true, if_false, fall_through); |
3816 __ CallRuntime(Runtime::kThrowNotDateError, 0); | |
3817 | 3818 |
3818 __ bind(&done); | 3819 context()->Plug(if_true, if_false); |
3819 context()->Plug(result); | |
3820 } | 3820 } |
3821 | 3821 |
3822 | 3822 |
3823 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3823 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
3824 ZoneList<Expression*>* args = expr->arguments(); | 3824 ZoneList<Expression*>* args = expr->arguments(); |
3825 DCHECK(args->length() == 2); | 3825 DCHECK(args->length() == 2); |
3826 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); | 3826 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
3827 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3827 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
3828 | 3828 |
3829 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3829 VisitForAccumulatorValue(args->at(0)); // Load the object. |
(...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5475 Assembler::target_address_at(call_target_address, | 5475 Assembler::target_address_at(call_target_address, |
5476 unoptimized_code)); | 5476 unoptimized_code)); |
5477 return OSR_AFTER_STACK_CHECK; | 5477 return OSR_AFTER_STACK_CHECK; |
5478 } | 5478 } |
5479 | 5479 |
5480 | 5480 |
5481 } // namespace internal | 5481 } // namespace internal |
5482 } // namespace v8 | 5482 } // namespace v8 |
5483 | 5483 |
5484 #endif // V8_TARGET_ARCH_IA32 | 5484 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |