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

Unified Diff: src/arm/full-codegen-arm.cc

Issue 9117034: New class for Date objects: caches individual date components. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add constant for index of first barrier-free slot. Created 8 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/api.cc ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index 6654263989e82501ff86d2f1096061d4de82dd68..66f58813bc23ff291ce2965d98b83875242acd90 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -2932,6 +2932,25 @@ void FullCodeGenerator::EmitValueOf(CallRuntime* expr) {
}
+void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
+ ZoneList<Expression*>* args = expr->arguments();
+ ASSERT(args->length() == 2);
+ ASSERT_NE(NULL, args->at(1)->AsLiteral());
+ int index = Smi::cast(*(args->at(1)->AsLiteral()->handle()))->value();
+
+ VisitForAccumulatorValue(args->at(0)); // Load the object.
+
+#ifdef DEBUG
+ __ AbortIfSmi(r0);
+ __ CompareObjectType(r0, r1, r1, JS_DATE_TYPE);
+ __ Assert(eq, "Trying to get date field from non-date.");
+#endif
+
+ __ ldr(r0, FieldMemOperand(r0, JSDate::kValueOffset + kPointerSize * index));
+ context()->Plug(r0);
+}
+
+
void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
// Load the arguments on the stack and call the runtime function.
ZoneList<Expression*>* args = expr->arguments();
@@ -2976,6 +2995,37 @@ void FullCodeGenerator::EmitSetValueOf(CallRuntime* expr) {
}
+void FullCodeGenerator::EmitSetDateField(CallRuntime* expr) {
+ ZoneList<Expression*>* args = expr->arguments();
+ ASSERT(args->length() == 3);
+ ASSERT_NE(NULL, args->at(1)->AsLiteral());
+ int index = Smi::cast(*(args->at(1)->AsLiteral()->handle()))->value();
+
+ VisitForStackValue(args->at(0)); // Load the object.
+ VisitForAccumulatorValue(args->at(2)); // Load the value.
+ __ pop(r1); // r0 = value. r1 = object.
+
+#ifdef DEBUG
+ __ AbortIfSmi(r1);
+ __ CompareObjectType(r1, r2, r2, JS_DATE_TYPE);
+ __ Assert(eq, "Trying to get date field from non-date.");
+#endif
+
+ // Store the value.
+ __ str(r0, FieldMemOperand(r1, JSDate::kValueOffset + kPointerSize * index));
+ // 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(r2, r0);
+ __ RecordWriteField(
+ r1, JSDate::kValueOffset + kPointerSize * index,
+ r2, r3, kLRHasBeenSaved, kDontSaveFPRegs);
+ }
+ context()->Plug(r0);
+}
+
+
void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
ASSERT_EQ(args->length(), 1);
« no previous file with comments | « src/api.cc ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698