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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 3778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3789 // If the object is not a value type, return the object. | 3789 // If the object is not a value type, return the object. |
3790 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); | 3790 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
3791 __ j(not_equal, &done, Label::kNear); | 3791 __ j(not_equal, &done, Label::kNear); |
3792 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); | 3792 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
3793 | 3793 |
3794 __ bind(&done); | 3794 __ bind(&done); |
3795 context()->Plug(eax); | 3795 context()->Plug(eax); |
3796 } | 3796 } |
3797 | 3797 |
3798 | 3798 |
3799 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { | 3799 void FullCodeGenerator::EmitIsDate(CallRuntime* expr) { |
3800 ZoneList<Expression*>* args = expr->arguments(); | 3800 ZoneList<Expression*>* args = expr->arguments(); |
3801 DCHECK_EQ(1, args->length()); | 3801 DCHECK_EQ(1, args->length()); |
3802 | 3802 |
3803 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3803 VisitForAccumulatorValue(args->at(0)); |
3804 | 3804 |
3805 Label done, not_date_object; | 3805 Label materialize_true, materialize_false; |
3806 Register object = eax; | 3806 Label* if_true = nullptr; |
3807 Register result = eax; | 3807 Label* if_false = nullptr; |
3808 Register scratch = ecx; | 3808 Label* fall_through = nullptr; |
| 3809 context()->PrepareTest(&materialize_true, &materialize_false, &if_true, |
| 3810 &if_false, &fall_through); |
3809 | 3811 |
3810 __ JumpIfSmi(object, ¬_date_object, Label::kNear); | 3812 __ JumpIfSmi(eax, if_false); |
3811 __ CmpObjectType(object, JS_DATE_TYPE, scratch); | 3813 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); |
3812 __ j(equal, &done, Label::kNear); | 3814 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
3813 __ bind(¬_date_object); | 3815 Split(equal, if_true, if_false, fall_through); |
3814 __ CallRuntime(Runtime::kThrowNotDateError, 0); | |
3815 | 3816 |
3816 __ bind(&done); | 3817 context()->Plug(if_true, if_false); |
3817 context()->Plug(result); | |
3818 } | 3818 } |
3819 | 3819 |
3820 | 3820 |
3821 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3821 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
3822 ZoneList<Expression*>* args = expr->arguments(); | 3822 ZoneList<Expression*>* args = expr->arguments(); |
3823 DCHECK(args->length() == 2); | 3823 DCHECK(args->length() == 2); |
3824 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); | 3824 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
3825 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3825 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
3826 | 3826 |
3827 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3827 VisitForAccumulatorValue(args->at(0)); // Load the object. |
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5472 Assembler::target_address_at(call_target_address, | 5472 Assembler::target_address_at(call_target_address, |
5473 unoptimized_code)); | 5473 unoptimized_code)); |
5474 return OSR_AFTER_STACK_CHECK; | 5474 return OSR_AFTER_STACK_CHECK; |
5475 } | 5475 } |
5476 | 5476 |
5477 | 5477 |
5478 } // namespace internal | 5478 } // namespace internal |
5479 } // namespace v8 | 5479 } // namespace v8 |
5480 | 5480 |
5481 #endif // V8_TARGET_ARCH_X87 | 5481 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |