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 3783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3794 // If the object is not a value type, return the object. | 3794 // If the object is not a value type, return the object. |
3795 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); | 3795 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
3796 __ j(not_equal, &done, Label::kNear); | 3796 __ j(not_equal, &done, Label::kNear); |
3797 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); | 3797 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
3798 | 3798 |
3799 __ bind(&done); | 3799 __ bind(&done); |
3800 context()->Plug(eax); | 3800 context()->Plug(eax); |
3801 } | 3801 } |
3802 | 3802 |
3803 | 3803 |
| 3804 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { |
| 3805 ZoneList<Expression*>* args = expr->arguments(); |
| 3806 DCHECK_EQ(1, args->length()); |
| 3807 |
| 3808 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3809 |
| 3810 Label done, not_date_object; |
| 3811 Register object = eax; |
| 3812 Register result = eax; |
| 3813 Register scratch = ecx; |
| 3814 |
| 3815 __ JumpIfSmi(object, ¬_date_object, Label::kNear); |
| 3816 __ CmpObjectType(object, JS_DATE_TYPE, scratch); |
| 3817 __ j(equal, &done, Label::kNear); |
| 3818 __ bind(¬_date_object); |
| 3819 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
| 3820 |
| 3821 __ bind(&done); |
| 3822 context()->Plug(result); |
| 3823 } |
| 3824 |
| 3825 |
3804 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3826 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
3805 ZoneList<Expression*>* args = expr->arguments(); | 3827 ZoneList<Expression*>* args = expr->arguments(); |
3806 DCHECK(args->length() == 2); | 3828 DCHECK(args->length() == 2); |
3807 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); | 3829 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
3808 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3830 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
3809 | 3831 |
3810 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3832 VisitForAccumulatorValue(args->at(0)); // Load the object. |
3811 | 3833 |
3812 Label runtime, done, not_date_object; | |
3813 Register object = eax; | 3834 Register object = eax; |
3814 Register result = eax; | 3835 Register result = eax; |
3815 Register scratch = ecx; | 3836 Register scratch = ecx; |
3816 | 3837 |
3817 __ JumpIfSmi(object, ¬_date_object); | |
3818 __ CmpObjectType(object, JS_DATE_TYPE, scratch); | |
3819 __ j(not_equal, ¬_date_object); | |
3820 | |
3821 if (index->value() == 0) { | 3838 if (index->value() == 0) { |
3822 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); | 3839 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
3823 __ jmp(&done); | |
3824 } else { | 3840 } else { |
| 3841 Label runtime, done; |
3825 if (index->value() < JSDate::kFirstUncachedField) { | 3842 if (index->value() < JSDate::kFirstUncachedField) { |
3826 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); | 3843 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
3827 __ mov(scratch, Operand::StaticVariable(stamp)); | 3844 __ mov(scratch, Operand::StaticVariable(stamp)); |
3828 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); | 3845 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
3829 __ j(not_equal, &runtime, Label::kNear); | 3846 __ j(not_equal, &runtime, Label::kNear); |
3830 __ mov(result, FieldOperand(object, JSDate::kValueOffset + | 3847 __ mov(result, FieldOperand(object, JSDate::kValueOffset + |
3831 kPointerSize * index->value())); | 3848 kPointerSize * index->value())); |
3832 __ jmp(&done); | 3849 __ jmp(&done, Label::kNear); |
3833 } | 3850 } |
3834 __ bind(&runtime); | 3851 __ bind(&runtime); |
3835 __ PrepareCallCFunction(2, scratch); | 3852 __ PrepareCallCFunction(2, scratch); |
3836 __ mov(Operand(esp, 0), object); | 3853 __ mov(Operand(esp, 0), object); |
3837 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); | 3854 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); |
3838 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); | 3855 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
3839 __ jmp(&done); | 3856 __ bind(&done); |
3840 } | 3857 } |
3841 | 3858 |
3842 __ bind(¬_date_object); | |
3843 __ CallRuntime(Runtime::kThrowNotDateError, 0); | |
3844 __ bind(&done); | |
3845 context()->Plug(result); | 3859 context()->Plug(result); |
3846 } | 3860 } |
3847 | 3861 |
3848 | 3862 |
3849 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3863 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3850 ZoneList<Expression*>* args = expr->arguments(); | 3864 ZoneList<Expression*>* args = expr->arguments(); |
3851 DCHECK_EQ(3, args->length()); | 3865 DCHECK_EQ(3, args->length()); |
3852 | 3866 |
3853 Register string = eax; | 3867 Register string = eax; |
3854 Register index = ebx; | 3868 Register index = ebx; |
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5464 Assembler::target_address_at(call_target_address, | 5478 Assembler::target_address_at(call_target_address, |
5465 unoptimized_code)); | 5479 unoptimized_code)); |
5466 return OSR_AFTER_STACK_CHECK; | 5480 return OSR_AFTER_STACK_CHECK; |
5467 } | 5481 } |
5468 | 5482 |
5469 | 5483 |
5470 } // namespace internal | 5484 } // namespace internal |
5471 } // namespace v8 | 5485 } // namespace v8 |
5472 | 5486 |
5473 #endif // V8_TARGET_ARCH_IA32 | 5487 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |