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

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

Issue 1174913002: X87: [date] Refactor the %_DateField intrinsic to be optimizable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/x87/lithium-codegen-x87.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_X87 7 #if V8_TARGET_ARCH_X87
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 3758 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 // If the object is not a value type, return the object. 3769 // If the object is not a value type, return the object.
3770 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); 3770 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx);
3771 __ j(not_equal, &done, Label::kNear); 3771 __ j(not_equal, &done, Label::kNear);
3772 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); 3772 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset));
3773 3773
3774 __ bind(&done); 3774 __ bind(&done);
3775 context()->Plug(eax); 3775 context()->Plug(eax);
3776 } 3776 }
3777 3777
3778 3778
3779 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) {
3780 ZoneList<Expression*>* args = expr->arguments();
3781 DCHECK_EQ(1, args->length());
3782
3783 VisitForAccumulatorValue(args->at(0)); // Load the object.
3784
3785 Label done, not_date_object;
3786 Register object = eax;
3787 Register result = eax;
3788 Register scratch = ecx;
3789
3790 __ JumpIfSmi(object, &not_date_object, Label::kNear);
3791 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
3792 __ j(equal, &done, Label::kNear);
3793 __ bind(&not_date_object);
3794 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3795
3796 __ bind(&done);
3797 context()->Plug(result);
3798 }
3799
3800
3779 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3801 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3780 ZoneList<Expression*>* args = expr->arguments(); 3802 ZoneList<Expression*>* args = expr->arguments();
3781 DCHECK(args->length() == 2); 3803 DCHECK(args->length() == 2);
3782 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); 3804 DCHECK_NOT_NULL(args->at(1)->AsLiteral());
3783 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); 3805 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3784 3806
3785 VisitForAccumulatorValue(args->at(0)); // Load the object. 3807 VisitForAccumulatorValue(args->at(0)); // Load the object.
3786 3808
3787 Label runtime, done, not_date_object;
3788 Register object = eax; 3809 Register object = eax;
3789 Register result = eax; 3810 Register result = eax;
3790 Register scratch = ecx; 3811 Register scratch = ecx;
3791 3812
3792 __ JumpIfSmi(object, &not_date_object);
3793 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
3794 __ j(not_equal, &not_date_object);
3795
3796 if (index->value() == 0) { 3813 if (index->value() == 0) {
3797 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); 3814 __ mov(result, FieldOperand(object, JSDate::kValueOffset));
3798 __ jmp(&done);
3799 } else { 3815 } else {
3816 Label runtime, done;
3800 if (index->value() < JSDate::kFirstUncachedField) { 3817 if (index->value() < JSDate::kFirstUncachedField) {
3801 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 3818 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
3802 __ mov(scratch, Operand::StaticVariable(stamp)); 3819 __ mov(scratch, Operand::StaticVariable(stamp));
3803 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); 3820 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
3804 __ j(not_equal, &runtime, Label::kNear); 3821 __ j(not_equal, &runtime, Label::kNear);
3805 __ mov(result, FieldOperand(object, JSDate::kValueOffset + 3822 __ mov(result, FieldOperand(object, JSDate::kValueOffset +
3806 kPointerSize * index->value())); 3823 kPointerSize * index->value()));
3807 __ jmp(&done); 3824 __ jmp(&done, Label::kNear);
3808 } 3825 }
3809 __ bind(&runtime); 3826 __ bind(&runtime);
3810 __ PrepareCallCFunction(2, scratch); 3827 __ PrepareCallCFunction(2, scratch);
3811 __ mov(Operand(esp, 0), object); 3828 __ mov(Operand(esp, 0), object);
3812 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); 3829 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index));
3813 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 3830 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3814 __ jmp(&done); 3831 __ bind(&done);
3815 } 3832 }
3816 3833
3817 __ bind(&not_date_object);
3818 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3819 __ bind(&done);
3820 context()->Plug(result); 3834 context()->Plug(result);
3821 } 3835 }
3822 3836
3823 3837
3824 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3838 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3825 ZoneList<Expression*>* args = expr->arguments(); 3839 ZoneList<Expression*>* args = expr->arguments();
3826 DCHECK_EQ(3, args->length()); 3840 DCHECK_EQ(3, args->length());
3827 3841
3828 Register string = eax; 3842 Register string = eax;
3829 Register index = ebx; 3843 Register index = ebx;
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
5437 Assembler::target_address_at(call_target_address, 5451 Assembler::target_address_at(call_target_address,
5438 unoptimized_code)); 5452 unoptimized_code));
5439 return OSR_AFTER_STACK_CHECK; 5453 return OSR_AFTER_STACK_CHECK;
5440 } 5454 }
5441 5455
5442 5456
5443 } // namespace internal 5457 } // namespace internal
5444 } // namespace v8 5458 } // namespace v8
5445 5459
5446 #endif // V8_TARGET_ARCH_X87 5460 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/lithium-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698