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

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: Rebase Created 8 years, 9 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 60f3ae8fd518d1f9cde26b68cbe49c2f3a028ee2..77f4e4414dac6f553d45e5722fed23e478d28905 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -2951,17 +2951,42 @@ 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();
+ Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
VisitForAccumulatorValue(args->at(0)); // Load the object.
+ Label runtime, done;
+ Register object = r0;
+ Register result = r0;
+ Register scratch0 = r9;
+ Register scratch1 = r1;
+
#ifdef DEBUG
- __ AbortIfSmi(r0);
- __ CompareObjectType(r0, r1, r1, JS_DATE_TYPE);
+ __ AbortIfSmi(object);
+ __ CompareObjectType(object, scratch1, scratch1, JS_DATE_TYPE);
__ Assert(eq, "Trying to get date field from non-date.");
#endif
- __ ldr(r0, FieldMemOperand(r0, JSDate::kValueOffset + kPointerSize * index));
+ if (index->value() == 0) {
+ __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset));
+ } else {
+ if (index->value() < JSDate::kFirstUncachedField) {
+ ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
+ __ mov(scratch1, Operand(stamp));
+ __ ldr(scratch1, MemOperand(scratch1));
+ __ ldr(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
+ __ cmp(scratch1, scratch0);
+ __ b(ne, &runtime);
+ __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset +
+ kPointerSize * index->value()));
+ __ jmp(&done);
+ }
+ __ bind(&runtime);
+ __ PrepareCallCFunction(2, scratch1);
+ __ mov(r1, Operand(index));
+ __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
+ __ bind(&done);
+ }
context()->Plug(r0);
}
@@ -3010,37 +3035,6 @@ 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