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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 3894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3905 __ JumpIfSmi(r0, &done); | 3905 __ JumpIfSmi(r0, &done); |
3906 // If the object is not a value type, return the object. | 3906 // If the object is not a value type, return the object. |
3907 __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE); | 3907 __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE); |
3908 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset), eq); | 3908 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset), eq); |
3909 | 3909 |
3910 __ bind(&done); | 3910 __ bind(&done); |
3911 context()->Plug(r0); | 3911 context()->Plug(r0); |
3912 } | 3912 } |
3913 | 3913 |
3914 | 3914 |
| 3915 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { |
| 3916 ZoneList<Expression*>* args = expr->arguments(); |
| 3917 DCHECK_EQ(1, args->length()); |
| 3918 |
| 3919 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3920 |
| 3921 Label done, not_date_object; |
| 3922 Register object = r0; |
| 3923 Register result = r0; |
| 3924 Register scratch0 = r9; |
| 3925 |
| 3926 __ JumpIfSmi(object, ¬_date_object); |
| 3927 __ CompareObjectType(object, scratch0, scratch0, JS_DATE_TYPE); |
| 3928 __ b(eq, &done); |
| 3929 __ bind(¬_date_object); |
| 3930 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
| 3931 |
| 3932 __ bind(&done); |
| 3933 context()->Plug(result); |
| 3934 } |
| 3935 |
| 3936 |
3915 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3937 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
3916 ZoneList<Expression*>* args = expr->arguments(); | 3938 ZoneList<Expression*>* args = expr->arguments(); |
3917 DCHECK(args->length() == 2); | 3939 DCHECK(args->length() == 2); |
3918 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); | 3940 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
3919 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3941 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
3920 | 3942 |
3921 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3943 VisitForAccumulatorValue(args->at(0)); // Load the object. |
3922 | 3944 |
3923 Label runtime, done, not_date_object; | |
3924 Register object = r0; | 3945 Register object = r0; |
3925 Register result = r0; | 3946 Register result = r0; |
3926 Register scratch0 = r9; | 3947 Register scratch0 = r9; |
3927 Register scratch1 = r1; | 3948 Register scratch1 = r1; |
3928 | 3949 |
3929 __ JumpIfSmi(object, ¬_date_object); | |
3930 __ CompareObjectType(object, scratch1, scratch1, JS_DATE_TYPE); | |
3931 __ b(ne, ¬_date_object); | |
3932 | |
3933 if (index->value() == 0) { | 3950 if (index->value() == 0) { |
3934 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); | 3951 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); |
3935 __ jmp(&done); | |
3936 } else { | 3952 } else { |
| 3953 Label runtime, done; |
3937 if (index->value() < JSDate::kFirstUncachedField) { | 3954 if (index->value() < JSDate::kFirstUncachedField) { |
3938 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); | 3955 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
3939 __ mov(scratch1, Operand(stamp)); | 3956 __ mov(scratch1, Operand(stamp)); |
3940 __ ldr(scratch1, MemOperand(scratch1)); | 3957 __ ldr(scratch1, MemOperand(scratch1)); |
3941 __ ldr(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); | 3958 __ ldr(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); |
3942 __ cmp(scratch1, scratch0); | 3959 __ cmp(scratch1, scratch0); |
3943 __ b(ne, &runtime); | 3960 __ b(ne, &runtime); |
3944 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset + | 3961 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset + |
3945 kPointerSize * index->value())); | 3962 kPointerSize * index->value())); |
3946 __ jmp(&done); | 3963 __ jmp(&done); |
3947 } | 3964 } |
3948 __ bind(&runtime); | 3965 __ bind(&runtime); |
3949 __ PrepareCallCFunction(2, scratch1); | 3966 __ PrepareCallCFunction(2, scratch1); |
3950 __ mov(r1, Operand(index)); | 3967 __ mov(r1, Operand(index)); |
3951 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); | 3968 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
3952 __ jmp(&done); | 3969 __ bind(&done); |
3953 } | 3970 } |
3954 | 3971 |
3955 __ bind(¬_date_object); | 3972 context()->Plug(result); |
3956 __ CallRuntime(Runtime::kThrowNotDateError, 0); | |
3957 __ bind(&done); | |
3958 context()->Plug(r0); | |
3959 } | 3973 } |
3960 | 3974 |
3961 | 3975 |
3962 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3976 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
3963 ZoneList<Expression*>* args = expr->arguments(); | 3977 ZoneList<Expression*>* args = expr->arguments(); |
3964 DCHECK_EQ(3, args->length()); | 3978 DCHECK_EQ(3, args->length()); |
3965 | 3979 |
3966 Register string = r0; | 3980 Register string = r0; |
3967 Register index = r1; | 3981 Register index = r1; |
3968 Register value = r2; | 3982 Register value = r2; |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5600 DCHECK(interrupt_address == | 5614 DCHECK(interrupt_address == |
5601 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5615 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5602 return OSR_AFTER_STACK_CHECK; | 5616 return OSR_AFTER_STACK_CHECK; |
5603 } | 5617 } |
5604 | 5618 |
5605 | 5619 |
5606 } // namespace internal | 5620 } // namespace internal |
5607 } // namespace v8 | 5621 } // namespace v8 |
5608 | 5622 |
5609 #endif // V8_TARGET_ARCH_ARM | 5623 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |