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

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

Issue 1579613002: [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: As per offline discussion, remove the weird test, which does not add a lot of value. Created 4 years, 11 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/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 3280 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 3291
3292 __ JumpIfSmi(rax, if_false); 3292 __ JumpIfSmi(rax, if_false);
3293 __ CmpObjectType(rax, JS_DATE_TYPE, rbx); 3293 __ CmpObjectType(rax, JS_DATE_TYPE, rbx);
3294 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 3294 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3295 Split(equal, if_true, if_false, fall_through); 3295 Split(equal, if_true, if_false, fall_through);
3296 3296
3297 context()->Plug(if_true, if_false); 3297 context()->Plug(if_true, if_false);
3298 } 3298 }
3299 3299
3300 3300
3301 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3302 ZoneList<Expression*>* args = expr->arguments();
3303 DCHECK(args->length() == 2);
3304 DCHECK_NOT_NULL(args->at(1)->AsLiteral());
3305 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3306
3307 VisitForAccumulatorValue(args->at(0)); // Load the object.
3308
3309 Register object = rax;
3310 Register result = rax;
3311 Register scratch = rcx;
3312
3313 if (FLAG_debug_code) {
3314 __ AssertNotSmi(object);
3315 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
3316 __ Check(equal, kOperandIsNotADate);
3317 }
3318
3319 if (index->value() == 0) {
3320 __ movp(result, FieldOperand(object, JSDate::kValueOffset));
3321 } else {
3322 Label runtime, done;
3323 if (index->value() < JSDate::kFirstUncachedField) {
3324 __ Load(scratch, ExternalReference::date_cache_stamp(isolate()));
3325 __ cmpp(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
3326 __ j(not_equal, &runtime, Label::kNear);
3327 __ movp(result, FieldOperand(object, JSDate::kValueOffset +
3328 kPointerSize * index->value()));
3329 __ jmp(&done, Label::kNear);
3330 }
3331 __ bind(&runtime);
3332 __ PrepareCallCFunction(2);
3333 __ movp(arg_reg_1, object);
3334 __ Move(arg_reg_2, index, Assembler::RelocInfoNone());
3335 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3336 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3337 __ bind(&done);
3338 }
3339
3340 context()->Plug(rax);
3341 }
3342
3343
3344 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3301 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3345 ZoneList<Expression*>* args = expr->arguments(); 3302 ZoneList<Expression*>* args = expr->arguments();
3346 DCHECK_EQ(3, args->length()); 3303 DCHECK_EQ(3, args->length());
3347 3304
3348 Register string = rax; 3305 Register string = rax;
3349 Register index = rbx; 3306 Register index = rbx;
3350 Register value = rcx; 3307 Register value = rcx;
3351 3308
3352 VisitForStackValue(args->at(0)); // index 3309 VisitForStackValue(args->at(0)); // index
3353 VisitForStackValue(args->at(1)); // value 3310 VisitForStackValue(args->at(1)); // value
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
4794 Assembler::target_address_at(call_target_address, 4751 Assembler::target_address_at(call_target_address,
4795 unoptimized_code)); 4752 unoptimized_code));
4796 return OSR_AFTER_STACK_CHECK; 4753 return OSR_AFTER_STACK_CHECK;
4797 } 4754 }
4798 4755
4799 4756
4800 } // namespace internal 4757 } // namespace internal
4801 } // namespace v8 4758 } // namespace v8
4802 4759
4803 #endif // V8_TARGET_ARCH_X64 4760 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/ppc/full-codegen-ppc.cc ('k') | src/full-codegen/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698