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

Side by Side Diff: src/arm64/full-codegen-arm64.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/arm/lithium-codegen-arm.cc ('k') | src/arm64/lithium-arm64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 3600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3611 __ JumpIfSmi(x0, &done); 3611 __ JumpIfSmi(x0, &done);
3612 // If the object is not a value type, return the object. 3612 // If the object is not a value type, return the object.
3613 __ JumpIfNotObjectType(x0, x10, x11, JS_VALUE_TYPE, &done); 3613 __ JumpIfNotObjectType(x0, x10, x11, JS_VALUE_TYPE, &done);
3614 __ Ldr(x0, FieldMemOperand(x0, JSValue::kValueOffset)); 3614 __ Ldr(x0, FieldMemOperand(x0, JSValue::kValueOffset));
3615 3615
3616 __ Bind(&done); 3616 __ Bind(&done);
3617 context()->Plug(x0); 3617 context()->Plug(x0);
3618 } 3618 }
3619 3619
3620 3620
3621 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) {
3622 ZoneList<Expression*>* args = expr->arguments();
3623 DCHECK_EQ(1, args->length());
3624
3625 VisitForAccumulatorValue(args->at(0)); // Load the object.
3626
3627 Label done, not_date_object;
3628 Register object = x0;
3629 Register result = x0;
3630
3631 __ JumpIfSmi(object, &not_date_object);
3632 __ JumpIfObjectType(object, x10, x10, JS_DATE_TYPE, &done);
3633 __ Bind(&not_date_object);
3634 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3635
3636 __ Bind(&done);
3637 context()->Plug(result);
3638 }
3639
3640
3621 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3641 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3622 ZoneList<Expression*>* args = expr->arguments(); 3642 ZoneList<Expression*>* args = expr->arguments();
3623 DCHECK(args->length() == 2); 3643 DCHECK(args->length() == 2);
3624 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); 3644 DCHECK_NOT_NULL(args->at(1)->AsLiteral());
3625 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); 3645 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3626 3646
3627 VisitForAccumulatorValue(args->at(0)); // Load the object. 3647 VisitForAccumulatorValue(args->at(0)); // Load the object.
3628 3648
3629 Label runtime, done, not_date_object;
3630 Register object = x0; 3649 Register object = x0;
3631 Register result = x0; 3650 Register result = x0;
3632 Register stamp_addr = x10; 3651 Register stamp_addr = x10;
3633 Register stamp_cache = x11; 3652 Register stamp_cache = x11;
3634 3653
3635 __ JumpIfSmi(object, &not_date_object);
3636 __ JumpIfNotObjectType(object, x10, x10, JS_DATE_TYPE, &not_date_object);
3637
3638 if (index->value() == 0) { 3654 if (index->value() == 0) {
3639 __ Ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); 3655 __ Ldr(result, FieldMemOperand(object, JSDate::kValueOffset));
3640 __ B(&done);
3641 } else { 3656 } else {
3657 Label runtime, done;
3642 if (index->value() < JSDate::kFirstUncachedField) { 3658 if (index->value() < JSDate::kFirstUncachedField) {
3643 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); 3659 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
3644 __ Mov(x10, stamp); 3660 __ Mov(stamp_addr, stamp);
3645 __ Ldr(stamp_addr, MemOperand(x10)); 3661 __ Ldr(stamp_addr, MemOperand(stamp_addr));
3646 __ Ldr(stamp_cache, FieldMemOperand(object, JSDate::kCacheStampOffset)); 3662 __ Ldr(stamp_cache, FieldMemOperand(object, JSDate::kCacheStampOffset));
3647 __ Cmp(stamp_addr, stamp_cache); 3663 __ Cmp(stamp_addr, stamp_cache);
3648 __ B(ne, &runtime); 3664 __ B(ne, &runtime);
3649 __ Ldr(result, FieldMemOperand(object, JSDate::kValueOffset + 3665 __ Ldr(result, FieldMemOperand(object, JSDate::kValueOffset +
3650 kPointerSize * index->value())); 3666 kPointerSize * index->value()));
3651 __ B(&done); 3667 __ B(&done);
3652 } 3668 }
3653 3669
3654 __ Bind(&runtime); 3670 __ Bind(&runtime);
3655 __ Mov(x1, index); 3671 __ Mov(x1, index);
3656 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); 3672 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3657 __ B(&done); 3673 __ Bind(&done);
3658 } 3674 }
3659 3675
3660 __ Bind(&not_date_object); 3676 context()->Plug(result);
3661 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3662 __ Bind(&done);
3663 context()->Plug(x0);
3664 } 3677 }
3665 3678
3666 3679
3667 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3680 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3668 ZoneList<Expression*>* args = expr->arguments(); 3681 ZoneList<Expression*>* args = expr->arguments();
3669 DCHECK_EQ(3, args->length()); 3682 DCHECK_EQ(3, args->length());
3670 3683
3671 Register string = x0; 3684 Register string = x0;
3672 Register index = x1; 3685 Register index = x1;
3673 Register value = x2; 3686 Register value = x2;
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
5566 } 5579 }
5567 5580
5568 return INTERRUPT; 5581 return INTERRUPT;
5569 } 5582 }
5570 5583
5571 5584
5572 } // namespace internal 5585 } // namespace internal
5573 } // namespace v8 5586 } // namespace v8
5574 5587
5575 #endif // V8_TARGET_ARCH_ARM64 5588 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/arm64/lithium-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698