Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: src/mips64/full-codegen-mips64.cc

Issue 1167813003: [date] Refactor the %_DateField intrinsic to be optimizable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | src/mips64/lithium-codegen-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS64 7 #if V8_TARGET_ARCH_MIPS64
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3879 matching lines...) Expand 10 before | Expand all | Expand 10 after
3890 __ GetObjectType(v0, a1, a1); 3890 __ GetObjectType(v0, a1, a1);
3891 __ Branch(&done, ne, a1, Operand(JS_VALUE_TYPE)); 3891 __ Branch(&done, ne, a1, Operand(JS_VALUE_TYPE));
3892 3892
3893 __ ld(v0, FieldMemOperand(v0, JSValue::kValueOffset)); 3893 __ ld(v0, FieldMemOperand(v0, JSValue::kValueOffset));
3894 3894
3895 __ bind(&done); 3895 __ bind(&done);
3896 context()->Plug(v0); 3896 context()->Plug(v0);
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 = v0;
3908 Register result = v0;
3909 Register scratch1 = a1;
3910
3911 __ JumpIfSmi(object, &not_date_object);
3912 __ GetObjectType(object, scratch1, scratch1);
3913 __ Branch(&done, eq, scratch1, Operand(JS_DATE_TYPE));
3914 __ bind(&not_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 = v0; 3930 Register object = v0;
3910 Register result = v0; 3931 Register result = v0;
3911 Register scratch0 = t1; 3932 Register scratch0 = t1;
3912 Register scratch1 = a1; 3933 Register scratch1 = a1;
3913 3934
3914 __ JumpIfSmi(object, &not_date_object);
3915 __ GetObjectType(object, scratch1, scratch1);
3916 __ Branch(&not_date_object, ne, scratch1, Operand(JS_DATE_TYPE));
3917
3918 if (index->value() == 0) { 3935 if (index->value() == 0) {
3919 __ ld(result, FieldMemOperand(object, JSDate::kValueOffset)); 3936 __ ld(result, FieldMemOperand(object, JSDate::kValueOffset));
3920 __ jmp(&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 __ li(scratch1, Operand(stamp)); 3941 __ li(scratch1, Operand(stamp));
3925 __ ld(scratch1, MemOperand(scratch1)); 3942 __ ld(scratch1, MemOperand(scratch1));
3926 __ ld(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); 3943 __ ld(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
3927 __ Branch(&runtime, ne, scratch1, Operand(scratch0)); 3944 __ Branch(&runtime, ne, scratch1, Operand(scratch0));
3928 __ ld(result, FieldMemOperand(object, JSDate::kValueOffset + 3945 __ ld(result, FieldMemOperand(object, JSDate::kValueOffset +
3929 kPointerSize * index->value())); 3946 kPointerSize * index->value()));
3930 __ jmp(&done); 3947 __ jmp(&done);
3931 } 3948 }
3932 __ bind(&runtime); 3949 __ bind(&runtime);
3933 __ PrepareCallCFunction(2, scratch1); 3950 __ PrepareCallCFunction(2, scratch1);
3934 __ li(a1, Operand(index)); 3951 __ li(a1, Operand(index));
3935 __ Move(a0, object); 3952 __ Move(a0, object);
3936 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 3953 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3937 __ jmp(&done); 3954 __ bind(&done);
3938 } 3955 }
3939 3956
3940 __ bind(&not_date_object); 3957 context()->Plug(result);
3941 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3942 __ bind(&done);
3943 context()->Plug(v0);
3944 } 3958 }
3945 3959
3946 3960
3947 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3961 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3948 ZoneList<Expression*>* args = expr->arguments(); 3962 ZoneList<Expression*>* args = expr->arguments();
3949 DCHECK_EQ(3, args->length()); 3963 DCHECK_EQ(3, args->length());
3950 3964
3951 Register string = v0; 3965 Register string = v0;
3952 Register index = a1; 3966 Register index = a1;
3953 Register value = a2; 3967 Register value = a2;
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
5551 reinterpret_cast<uint64_t>( 5565 reinterpret_cast<uint64_t>(
5552 isolate->builtins()->OsrAfterStackCheck()->entry())); 5566 isolate->builtins()->OsrAfterStackCheck()->entry()));
5553 return OSR_AFTER_STACK_CHECK; 5567 return OSR_AFTER_STACK_CHECK;
5554 } 5568 }
5555 5569
5556 5570
5557 } // namespace internal 5571 } // namespace internal
5558 } // namespace v8 5572 } // namespace v8
5559 5573
5560 #endif // V8_TARGET_ARCH_MIPS64 5574 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | src/mips64/lithium-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698