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

Side by Side 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: Bug fixes. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 // If the object is not a value type, return the object. 2926 // If the object is not a value type, return the object.
2927 __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE); 2927 __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE);
2928 __ b(ne, &done); 2928 __ b(ne, &done);
2929 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); 2929 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset));
2930 2930
2931 __ bind(&done); 2931 __ bind(&done);
2932 context()->Plug(r0); 2932 context()->Plug(r0);
2933 } 2933 }
2934 2934
2935 2935
2936 void FullCodeGenerator::EmitDateField(CallRuntime* expr) {
2937 ZoneList<Expression*>* args = expr->arguments();
2938 ASSERT(args->length() == 2);
2939 ASSERT_NE(NULL, args->at(1)->AsLiteral());
2940 Smi* index = Smi::cast(*(args->at(1)->AsLiteral()->handle()));
rossberg 2012/03/06 15:55:50 Why did you change this? It requires more redundan
ulan 2012/03/07 10:55:21 In other platforms, index is pushed onto stack bef
2941
2942 VisitForAccumulatorValue(args->at(0)); // Load the object.
2943
2944 Label runtime, done;
2945 Register object = r0;
2946 Register result = r0;
2947 Register scratch0 = r9;
2948 Register scratch1 = r1;
2949
2950 #ifdef DEBUG
2951 __ AbortIfSmi(r0);
2952 __ CompareObjectType(r0, r1, r1, JS_DATE_TYPE);
2953 __ Assert(eq, "Trying to get date field from non-date.");
2954 #endif
2955
2956 if (index->value() == 0) {
2957 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset));
2958 } else {
2959 if (index->value() < JSDate::kFirstUncachedField) {
2960 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
2961 __ mov(scratch1, Operand(stamp));
2962 __ ldr(scratch1, MemOperand(scratch1));
2963 __ ldr(scratch0, FieldMemOperand(object, JSDate::kCacheStampOffset));
2964 __ cmp(scratch1, scratch0);
2965 __ b(ne, &runtime);
2966 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset +
2967 kPointerSize * index->value()));
2968 __ jmp(&done);
2969 }
2970 __ bind(&runtime);
2971 __ PrepareCallCFunction(2, scratch1);
2972 __ mov(r1, Operand(index));
2973 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
2974 __ bind(&done);
2975 }
2976 context()->Plug(r0);
2977 }
2978
2979
2936 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { 2980 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) {
2937 // Load the arguments on the stack and call the runtime function. 2981 // Load the arguments on the stack and call the runtime function.
2938 ZoneList<Expression*>* args = expr->arguments(); 2982 ZoneList<Expression*>* args = expr->arguments();
2939 ASSERT(args->length() == 2); 2983 ASSERT(args->length() == 2);
2940 VisitForStackValue(args->at(0)); 2984 VisitForStackValue(args->at(0));
2941 VisitForStackValue(args->at(1)); 2985 VisitForStackValue(args->at(1));
2942 if (CpuFeatures::IsSupported(VFP3)) { 2986 if (CpuFeatures::IsSupported(VFP3)) {
2943 MathPowStub stub(MathPowStub::ON_STACK); 2987 MathPowStub stub(MathPowStub::ON_STACK);
2944 __ CallStub(&stub); 2988 __ CallStub(&stub);
2945 } else { 2989 } else {
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
4391 *context_length = 0; 4435 *context_length = 0;
4392 return previous_; 4436 return previous_;
4393 } 4437 }
4394 4438
4395 4439
4396 #undef __ 4440 #undef __
4397 4441
4398 } } // namespace v8::internal 4442 } } // namespace v8::internal
4399 4443
4400 #endif // V8_TARGET_ARCH_ARM 4444 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/arm/lithium-arm.h » ('j') | src/arm/lithium-arm.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698