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

Unified Diff: src/arm/full-codegen-arm.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/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index 418e0c5f7c9cfbcfba491a0b1021e1f95492a9dd..d67a03d893f12882dd2f7e3bd5283d452c8a59d6 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -2933,6 +2933,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();
@@ -2977,6 +2996,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') | src/arm/lithium-codegen-arm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698