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

Side by Side Diff: src/full-codegen/ia32/full-codegen-ia32.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/full-codegen.h ('k') | src/full-codegen/mips/full-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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
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 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 3303
3304 __ JumpIfSmi(eax, if_false); 3304 __ JumpIfSmi(eax, if_false);
3305 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); 3305 __ CmpObjectType(eax, JS_DATE_TYPE, ebx);
3306 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 3306 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
3307 Split(equal, if_true, if_false, fall_through); 3307 Split(equal, if_true, if_false, fall_through);
3308 3308
3309 context()->Plug(if_true, if_false); 3309 context()->Plug(if_true, if_false);
3310 } 3310 }
3311 3311
3312 3312
3313 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
3314 ZoneList<Expression*>* args = expr->arguments();
3315 DCHECK(args->length() == 2);
3316 DCHECK_NOT_NULL(args->at(1)->AsLiteral());
3317 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->value()));
3318
3319 VisitForAccumulatorValue(args->at(0)); // Load the object.
3320
3321 Register object = eax;
3322 Register result = eax;
3323 Register scratch = ecx;
3324
3325 if (index->value() == 0) {
3326 __ mov(result, FieldOperand(object, JSDate::kValueOffset));
3327 } else {
3328 Label runtime, done;
3329 if (index->value() < JSDate::kFirstUncachedField) {
3330 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
3331 __ mov(scratch, Operand::StaticVariable(stamp));
3332 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
3333 __ j(not_equal, &runtime, Label::kNear);
3334 __ mov(result, FieldOperand(object, JSDate::kValueOffset +
3335 kPointerSize * index->value()));
3336 __ jmp(&done, Label::kNear);
3337 }
3338 __ bind(&runtime);
3339 __ PrepareCallCFunction(2, scratch);
3340 __ mov(Operand(esp, 0), object);
3341 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index));
3342 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
3343 __ bind(&done);
3344 }
3345
3346 context()->Plug(result);
3347 }
3348
3349
3350 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) { 3313 void FullCodeGenerator::EmitOneByteSeqStringSetChar(CallRuntime* expr) {
3351 ZoneList<Expression*>* args = expr->arguments(); 3314 ZoneList<Expression*>* args = expr->arguments();
3352 DCHECK_EQ(3, args->length()); 3315 DCHECK_EQ(3, args->length());
3353 3316
3354 Register string = eax; 3317 Register string = eax;
3355 Register index = ebx; 3318 Register index = ebx;
3356 Register value = ecx; 3319 Register value = ecx;
3357 3320
3358 VisitForStackValue(args->at(0)); // index 3321 VisitForStackValue(args->at(0)); // index
3359 VisitForStackValue(args->at(1)); // value 3322 VisitForStackValue(args->at(1)); // value
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after
4784 Assembler::target_address_at(call_target_address, 4747 Assembler::target_address_at(call_target_address,
4785 unoptimized_code)); 4748 unoptimized_code));
4786 return OSR_AFTER_STACK_CHECK; 4749 return OSR_AFTER_STACK_CHECK;
4787 } 4750 }
4788 4751
4789 4752
4790 } // namespace internal 4753 } // namespace internal
4791 } // namespace v8 4754 } // namespace v8
4792 4755
4793 #endif // V8_TARGET_ARCH_IA32 4756 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698