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

Side by Side Diff: src/mips/full-codegen-mips.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/macros.py ('k') | src/mips/lithium-codegen-mips.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3876 matching lines...) Expand 10 before | Expand all | Expand 10 after
3887 __ GetObjectType(v0, a1, a1); 3887 __ GetObjectType(v0, a1, a1);
3888 __ Branch(&done, ne, a1, Operand(JS_VALUE_TYPE)); 3888 __ Branch(&done, ne, a1, Operand(JS_VALUE_TYPE));
3889 3889
3890 __ lw(v0, FieldMemOperand(v0, JSValue::kValueOffset)); 3890 __ lw(v0, FieldMemOperand(v0, JSValue::kValueOffset));
3891 3891
3892 __ bind(&done); 3892 __ bind(&done);
3893 context()->Plug(v0); 3893 context()->Plug(v0);
3894 } 3894 }
3895 3895
3896 3896
3897 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) {
3898 ZoneList<Expression*>* args = expr->arguments();
3899 DCHECK_EQ(1, args->length());
3900
3901 VisitForAccumulatorValue(args->at(0)); // Load the object.
3902
3903 Label done, not_date_object;
3904 Register object = v0;
3905 Register result = v0;
3906 Register scratch1 = a1;
3907
3908 __ JumpIfSmi(object, &not_date_object);
3909 __ GetObjectType(object, scratch1, scratch1);
3910 __ Branch(&done, eq, scratch1, Operand(JS_DATE_TYPE));
3911 __ bind(&not_date_object);
3912 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3913
3914 __ bind(&done);
3915 context()->Plug(result);
3916 }
3917
3918
3897 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3919 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3898 ZoneList<Expression*>* args = expr->arguments(); 3920 ZoneList<Expression*>* args = expr->arguments();
3899 DCHECK(args->length() == 2); 3921 DCHECK(args->length() == 2);
3900 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); 3922 DCHECK_NOT_NULL(args->at(1)->AsLiteral());
3901 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); 3923 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3902 3924
3903 VisitForAccumulatorValue(args->at(0)); // Load the object. 3925 VisitForAccumulatorValue(args->at(0)); // Load the object.
3904 3926
3905 Label runtime, done, not_date_object;
3906 Register object = v0; 3927 Register object = v0;
3907 Register result = v0; 3928 Register result = v0;
3908 Register scratch0 = t5; 3929 Register scratch0 = t5;
3909 Register scratch1 = a1; 3930 Register scratch1 = a1;
3910 3931
3911 __ JumpIfSmi(object, &not_date_object);
3912 __ GetObjectType(object, scratch1, scratch1);
3913 __ Branch(&not_date_object, ne, scratch1, Operand(JS_DATE_TYPE));
3914
3915 if (index->value() == 0) { 3932 if (index->value() == 0) {
3916 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset)); 3933 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset));
3917 __ jmp(&done);
3918 } else { 3934 } else {
3935 Label runtime, done;
3919 if (index->value() < JSDate::kFirstUncachedField) { 3936 if (index->value() < JSDate::kFirstUncachedField) {
3920 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 3937 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
3921 __ li(scratch1, Operand(stamp)); 3938 __ li(scratch1, Operand(stamp));
3922 __ lw(scratch1, MemOperand(scratch1)); 3939 __ lw(scratch1, MemOperand(scratch1));
3923 __ lw(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset)); 3940 __ lw(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
3924 __ Branch(&runtime, ne, scratch1, Operand(scratch0)); 3941 __ Branch(&runtime, ne, scratch1, Operand(scratch0));
3925 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset + 3942 __ lw(result, FieldMemOperand(object, JSDate::kValueOffset +
3926 kPointerSize * index->value())); 3943 kPointerSize * index->value()));
3927 __ jmp(&done); 3944 __ jmp(&done);
3928 } 3945 }
3929 __ bind(&runtime); 3946 __ bind(&runtime);
3930 __ PrepareCallCFunction(2, scratch1); 3947 __ PrepareCallCFunction(2, scratch1);
3931 __ li(a1, Operand(index)); 3948 __ li(a1, Operand(index));
3932 __ Move(a0, object); 3949 __ Move(a0, object);
3933 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 3950 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3934 __ jmp(&done); 3951 __ bind(&done);
3935 } 3952 }
3936 3953
3937 __ bind(&not_date_object); 3954 context()->Plug(result);
3938 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3939 __ bind(&done);
3940 context()->Plug(v0);
3941 } 3955 }
3942 3956
3943 3957
3944 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3958 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3945 ZoneList<Expression*>* args = expr->arguments(); 3959 ZoneList<Expression*>* args = expr->arguments();
3946 DCHECK_EQ(3, args->length()); 3960 DCHECK_EQ(3, args->length());
3947 3961
3948 Register string = v0; 3962 Register string = v0;
3949 Register index = a1; 3963 Register index = a1;
3950 Register value = a2; 3964 Register value = a2;
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
5544 reinterpret_cast<uint32_t>( 5558 reinterpret_cast<uint32_t>(
5545 isolate->builtins()->OsrAfterStackCheck()->entry())); 5559 isolate->builtins()->OsrAfterStackCheck()->entry()));
5546 return OSR_AFTER_STACK_CHECK; 5560 return OSR_AFTER_STACK_CHECK;
5547 } 5561 }
5548 5562
5549 5563
5550 } // namespace internal 5564 } // namespace internal
5551 } // namespace v8 5565 } // namespace v8
5552 5566
5553 #endif // V8_TARGET_ARCH_MIPS 5567 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/macros.py ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698