| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 3879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3890 // If the object is not a value type, return the object. | 3890 // If the object is not a value type, return the object. |
| 3891 __ CompareObjectType(r3, r4, r4, JS_VALUE_TYPE); | 3891 __ CompareObjectType(r3, r4, r4, JS_VALUE_TYPE); |
| 3892 __ bne(&done); | 3892 __ bne(&done); |
| 3893 __ LoadP(r3, FieldMemOperand(r3, JSValue::kValueOffset)); | 3893 __ LoadP(r3, FieldMemOperand(r3, JSValue::kValueOffset)); |
| 3894 | 3894 |
| 3895 __ bind(&done); | 3895 __ bind(&done); |
| 3896 context()->Plug(r3); | 3896 context()->Plug(r3); |
| 3897 } | 3897 } |
| 3898 | 3898 |
| 3899 | 3899 |
| 3900 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { |
| 3901 ZoneList<Expression*>* args = expr->arguments(); |
| 3902 DCHECK_EQ(1, args->length()); |
| 3903 |
| 3904 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3905 |
| 3906 Label done, not_date_object; |
| 3907 Register object = r3; |
| 3908 Register result = r3; |
| 3909 Register scratch0 = r4; |
| 3910 |
| 3911 __ JumpIfSmi(object, ¬_date_object); |
| 3912 __ CompareObjectType(object, scratch0, scratch0, JS_DATE_TYPE); |
| 3913 __ beq(&done); |
| 3914 __ bind(¬_date_object); |
| 3915 __ CallRuntime(Runtime::kThrowNotDateError, 0); |
| 3916 |
| 3917 __ bind(&done); |
| 3918 context()->Plug(result); |
| 3919 } |
| 3920 |
| 3921 |
| 3900 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { | 3922 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 3901 ZoneList<Expression*>* args = expr->arguments(); | 3923 ZoneList<Expression*>* args = expr->arguments(); |
| 3902 DCHECK(args->length() == 2); | 3924 DCHECK(args->length() == 2); |
| 3903 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); | 3925 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); |
| 3904 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); | 3926 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); |
| 3905 | 3927 |
| 3906 VisitForAccumulatorValue(args->at(0)); // Load the object. | 3928 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 3907 | 3929 |
| 3908 Label runtime, done, not_date_object; | |
| 3909 Register object = r3; | 3930 Register object = r3; |
| 3910 Register result = r3; | 3931 Register result = r3; |
| 3911 Register scratch0 = r11; | 3932 Register scratch0 = r11; |
| 3912 Register scratch1 = r4; | 3933 Register scratch1 = r4; |
| 3913 | 3934 |
| 3914 __ JumpIfSmi(object, ¬_date_object); | |
| 3915 __ CompareObjectType(object, scratch1, scratch1, JS_DATE_TYPE); | |
| 3916 __ bne(¬_date_object); | |
| 3917 | |
| 3918 if (index->value() == 0) { | 3935 if (index->value() == 0) { |
| 3919 __ LoadP(result, FieldMemOperand(object, JSDate::kValueOffset)); | 3936 __ LoadP(result, FieldMemOperand(object, JSDate::kValueOffset)); |
| 3920 __ b(&done); | |
| 3921 } else { | 3937 } else { |
| 3938 Label runtime, done; |
| 3922 if (index->value() < JSDate::kFirstUncachedField) { | 3939 if (index->value() < JSDate::kFirstUncachedField) { |
| 3923 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); | 3940 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 3924 __ mov(scratch1, Operand(stamp)); | 3941 __ mov(scratch1, Operand(stamp)); |
| 3925 __ LoadP(scratch1, MemOperand(scratch1)); | 3942 __ LoadP(scratch1, MemOperand(scratch1)); |
| 3926 __ LoadP(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); | 3943 __ LoadP(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); |
| 3927 __ cmp(scratch1, scratch0); | 3944 __ cmp(scratch1, scratch0); |
| 3928 __ bne(&runtime); | 3945 __ bne(&runtime); |
| 3929 __ LoadP(result, | 3946 __ LoadP(result, |
| 3930 FieldMemOperand(object, JSDate::kValueOffset + | 3947 FieldMemOperand(object, JSDate::kValueOffset + |
| 3931 kPointerSize * index->value()), | 3948 kPointerSize * index->value()), |
| 3932 scratch0); | 3949 scratch0); |
| 3933 __ b(&done); | 3950 __ b(&done); |
| 3934 } | 3951 } |
| 3935 __ bind(&runtime); | 3952 __ bind(&runtime); |
| 3936 __ PrepareCallCFunction(2, scratch1); | 3953 __ PrepareCallCFunction(2, scratch1); |
| 3937 __ LoadSmiLiteral(r4, index); | 3954 __ LoadSmiLiteral(r4, index); |
| 3938 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); | 3955 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 3939 __ b(&done); | 3956 __ bind(&done); |
| 3940 } | 3957 } |
| 3941 | 3958 |
| 3942 __ bind(¬_date_object); | 3959 context()->Plug(result); |
| 3943 __ CallRuntime(Runtime::kThrowNotDateError, 0); | |
| 3944 __ bind(&done); | |
| 3945 context()->Plug(r3); | |
| 3946 } | 3960 } |
| 3947 | 3961 |
| 3948 | 3962 |
| 3949 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { | 3963 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { |
| 3950 ZoneList<Expression*>* args = expr->arguments(); | 3964 ZoneList<Expression*>* args = expr->arguments(); |
| 3951 DCHECK_EQ(3, args->length()); | 3965 DCHECK_EQ(3, args->length()); |
| 3952 | 3966 |
| 3953 Register string = r3; | 3967 Register string = r3; |
| 3954 Register index = r4; | 3968 Register index = r4; |
| 3955 Register value = r5; | 3969 Register value = r5; |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5516 return ON_STACK_REPLACEMENT; | 5530 return ON_STACK_REPLACEMENT; |
| 5517 } | 5531 } |
| 5518 | 5532 |
| 5519 DCHECK(interrupt_address == | 5533 DCHECK(interrupt_address == |
| 5520 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5534 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5521 return OSR_AFTER_STACK_CHECK; | 5535 return OSR_AFTER_STACK_CHECK; |
| 5522 } | 5536 } |
| 5523 } // namespace internal | 5537 } // namespace internal |
| 5524 } // namespace v8 | 5538 } // namespace v8 |
| 5525 #endif // V8_TARGET_ARCH_PPC | 5539 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |