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

Unified Diff: src/ia32/lithium-codegen-ia32.cc

Issue 9572008: Implement date library functions in C++. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
index d8c3972f8bc8d5eb4ccc2ae31b0ef15219bf77c4..613194afc00037247a8cfceb2cea02719322faeb 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -1273,6 +1273,7 @@ void LCodeGen::DoValueOf(LValueOf* instr) {
Register result = ToRegister(instr->result());
Register map = ToRegister(instr->TempAt(0));
ASSERT(input.is(result));
+
Label done;
// If the object is a smi return the object.
__ JumpIfSmi(input, &done, Label::kNear);
@@ -1286,6 +1287,49 @@ void LCodeGen::DoValueOf(LValueOf* instr) {
}
+void LCodeGen::DoDateField(LDateField* instr) {
+ Register input = ToRegister(instr->InputAt(0));
+ Register result = ToRegister(instr->result());
+ Register map = ToRegister(instr->TempAt(0));
+ ASSERT(input.is(result));
+
+#ifdef DEBUG
rossberg 2012/03/06 15:55:50 This one got removed, too.
+ __ AbortIfSmi(input);
+ __ CmpObjectType(input, JS_DATE_TYPE, map);
+ __ Assert(equal, "Trying to get date field from non-date.");
+#endif
+
+ __ mov(result, FieldOperand(input,
+ JSDate::kValueOffset + kPointerSize * instr->index()));
+}
+
+
+void LCodeGen::DoSetDateField(LSetDateField* instr) {
+ Register date = ToRegister(instr->InputAt(0));
+ Register value = ToRegister(instr->InputAt(1));
+ Register result = ToRegister(instr->result());
+ Register temp = ToRegister(instr->TempAt(0));
+ int index = instr->index();
+
+#ifdef DEBUG
+ __ AbortIfSmi(date);
+ __ CmpObjectType(date, JS_DATE_TYPE, temp);
+ __ Assert(equal, "Trying to get date field from non-date.");
+#endif
+
+ __ mov(FieldOperand(date, JSDate::kValueOffset + kPointerSize * index),
+ value);
+ // Caches can only be smi or NaN, so we can skip the write barrier for them.
+ if (index < JSDate::kFirstBarrierFree) {
+ // Update the write barrier. Save the value as it will be
+ // overwritten by the write barrier code and is needed afterward.
+ __ mov(result, value);
+ __ RecordWriteField(date, JSDate::kValueOffset + kPointerSize * index,
+ value, temp, kDontSaveFPRegs);
+ }
+}
+
+
void LCodeGen::DoBitNotI(LBitNotI* instr) {
LOperand* input = instr->InputAt(0);
ASSERT(input->Equals(instr->result()));

Powered by Google App Engine
This is Rietveld 408576698