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

Unified Diff: src/crankshaft/x64/lithium-codegen-x64.cc

Issue 1574223002: Revert of [builtins] Refactor the remaining Date builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/ppc/lithium-ppc.cc ('k') | src/crankshaft/x64/lithium-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/x64/lithium-codegen-x64.cc
diff --git a/src/crankshaft/x64/lithium-codegen-x64.cc b/src/crankshaft/x64/lithium-codegen-x64.cc
index 30d47c8da09e2beb3656c8f13e5a9964edf3f95b..c758812b163b785683d6e01e4827732f44814406 100644
--- a/src/crankshaft/x64/lithium-codegen-x64.cc
+++ b/src/crankshaft/x64/lithium-codegen-x64.cc
@@ -1664,6 +1664,44 @@
Register result = ToRegister(instr->result());
Register map = ToRegister(instr->value());
__ EnumLength(result, map);
+}
+
+
+void LCodeGen::DoDateField(LDateField* instr) {
+ Register object = ToRegister(instr->date());
+ Register result = ToRegister(instr->result());
+ Smi* index = instr->index();
+ DCHECK(object.is(result));
+ DCHECK(object.is(rax));
+
+ if (FLAG_debug_code) {
+ __ AssertNotSmi(object);
+ __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister);
+ __ Check(equal, kOperandIsNotADate);
+ }
+
+ if (index->value() == 0) {
+ __ movp(result, FieldOperand(object, JSDate::kValueOffset));
+ } else {
+ Label runtime, done;
+ if (index->value() < JSDate::kFirstUncachedField) {
+ ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
+ Operand stamp_operand = __ ExternalOperand(stamp);
+ __ movp(kScratchRegister, stamp_operand);
+ __ cmpp(kScratchRegister, FieldOperand(object,
+ JSDate::kCacheStampOffset));
+ __ j(not_equal, &runtime, Label::kNear);
+ __ movp(result, FieldOperand(object, JSDate::kValueOffset +
+ kPointerSize * index->value()));
+ __ jmp(&done, Label::kNear);
+ }
+ __ bind(&runtime);
+ __ PrepareCallCFunction(2);
+ __ movp(arg_reg_1, object);
+ __ Move(arg_reg_2, index, Assembler::RelocInfoNone());
+ __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
+ __ bind(&done);
+ }
}
« no previous file with comments | « src/crankshaft/ppc/lithium-ppc.cc ('k') | src/crankshaft/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698