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

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

Issue 1191283003: [date] Use explicit control flow to replace %_ThrowIfNotADate. (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 | « src/runtime/runtime-date.cc ('k') | src/x87/full-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_X64 7 #if V8_TARGET_ARCH_X64
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 3771 matching lines...) Expand 10 before | Expand all | Expand 10 after
3782 // If the object is not a value type, return the object. 3782 // If the object is not a value type, return the object.
3783 __ CmpObjectType(rax, JS_VALUE_TYPE, rbx); 3783 __ CmpObjectType(rax, JS_VALUE_TYPE, rbx);
3784 __ j(not_equal, &done); 3784 __ j(not_equal, &done);
3785 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset)); 3785 __ movp(rax, FieldOperand(rax, JSValue::kValueOffset));
3786 3786
3787 __ bind(&done); 3787 __ bind(&done);
3788 context()->Plug(rax); 3788 context()->Plug(rax);
3789 } 3789 }
3790 3790
3791 3791
3792 void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { 3792 void FullCodeGenerator::EmitIsDate(CallRuntime* expr) {
3793 ZoneList<Expression*>* args = expr->arguments(); 3793 ZoneList<Expression*>* args = expr->arguments();
3794 DCHECK_EQ(1, args->length()); 3794 DCHECK_EQ(1, args->length());
3795 3795
3796 VisitForAccumulatorValue(args->at(0)); // Load the object. 3796 VisitForAccumulatorValue(args->at(0));
3797 3797
3798 Register object = rax; 3798 Label materialize_true, materialize_false;
3799 Register result = rax; 3799 Label* if_true = nullptr;
3800 Register scratch = rcx; 3800 Label* if_false = nullptr;
3801 Label* fall_through = nullptr;
3802 context()->PrepareTest(&materialize_true, &materialize_false, &if_true,
3803 &if_false, &fall_through);
3801 3804
3802 Label done, not_date_object; 3805 __ JumpIfSmi(rax, if_false);
3803 __ JumpIfSmi(object, &not_date_object, Label::kNear); 3806 __ CmpObjectType(rax, JS_DATE_TYPE, rbx);
3804 __ CmpObjectType(object, JS_DATE_TYPE, scratch); 3807 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3805 __ j(equal, &done, Label::kNear); 3808 Split(equal, if_true, if_false, fall_through);
3806 __ bind(&not_date_object);
3807 __ CallRuntime(Runtime::kThrowNotDateError, 0);
3808 3809
3809 __ bind(&done); 3810 context()->Plug(if_true, if_false);
3810 context()->Plug(result);
3811 } 3811 }
3812 3812
3813 3813
3814 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { 3814 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3815 ZoneList<Expression*>* args = expr->arguments(); 3815 ZoneList<Expression*>* args = expr->arguments();
3816 DCHECK(args->length() == 2); 3816 DCHECK(args->length() == 2);
3817 DCHECK_NOT_NULL(args->at(1)->AsLiteral()); 3817 DCHECK_NOT_NULL(args->at(1)->AsLiteral());
3818 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value())); 3818 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3819 3819
3820 VisitForAccumulatorValue(args->at(0)); // Load the object. 3820 VisitForAccumulatorValue(args->at(0)); // Load the object.
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
5496 Assembler::target_address_at(call_target_address, 5496 Assembler::target_address_at(call_target_address,
5497 unoptimized_code)); 5497 unoptimized_code));
5498 return OSR_AFTER_STACK_CHECK; 5498 return OSR_AFTER_STACK_CHECK;
5499 } 5499 }
5500 5500
5501 5501
5502 } // namespace internal 5502 } // namespace internal
5503 } // namespace v8 5503 } // namespace v8
5504 5504
5505 #endif // V8_TARGET_ARCH_X64 5505 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime/runtime-date.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698