OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2925 // If the object is not a value type, return the object. | 2925 // If the object is not a value type, return the object. |
2926 __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE); | 2926 __ CompareObjectType(r0, r1, r1, JS_VALUE_TYPE); |
2927 __ b(ne, &done); | 2927 __ b(ne, &done); |
2928 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); | 2928 __ ldr(r0, FieldMemOperand(r0, JSValue::kValueOffset)); |
2929 | 2929 |
2930 __ bind(&done); | 2930 __ bind(&done); |
2931 context()->Plug(r0); | 2931 context()->Plug(r0); |
2932 } | 2932 } |
2933 | 2933 |
2934 | 2934 |
| 2935 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 2936 ZoneList<Expression*>* args = expr->arguments(); |
| 2937 ASSERT(args->length() == 2); |
| 2938 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
| 2939 int index = Smi::cast(*(args->at(1)->AsLiteral()->handle()))->value(); |
| 2940 |
| 2941 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 2942 |
| 2943 #ifdef DEBUG |
| 2944 __ AbortIfSmi(r0); |
| 2945 __ CompareObjectType(r0, r1, r1, JS_DATE_TYPE); |
| 2946 __ Assert(eq, "Trying to get date field from non-date."); |
| 2947 #endif |
| 2948 |
| 2949 __ ldr(r0, FieldMemOperand(r0, JSDate::kValueOffset + kPointerSize * index)); |
| 2950 context()->Plug(r0); |
| 2951 } |
| 2952 |
| 2953 |
2935 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { | 2954 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { |
2936 // Load the arguments on the stack and call the runtime function. | 2955 // Load the arguments on the stack and call the runtime function. |
2937 ZoneList<Expression*>* args = expr->arguments(); | 2956 ZoneList<Expression*>* args = expr->arguments(); |
2938 ASSERT(args->length() == 2); | 2957 ASSERT(args->length() == 2); |
2939 VisitForStackValue(args->at(0)); | 2958 VisitForStackValue(args->at(0)); |
2940 VisitForStackValue(args->at(1)); | 2959 VisitForStackValue(args->at(1)); |
2941 if (CpuFeatures::IsSupported(VFP3)) { | 2960 if (CpuFeatures::IsSupported(VFP3)) { |
2942 MathPowStub stub(MathPowStub::ON_STACK); | 2961 MathPowStub stub(MathPowStub::ON_STACK); |
2943 __ CallStub(&stub); | 2962 __ CallStub(&stub); |
2944 } else { | 2963 } else { |
(...skipping 24 matching lines...) Expand all Loading... |
2969 // overwritten by the write barrier code and is needed afterward. | 2988 // overwritten by the write barrier code and is needed afterward. |
2970 __ mov(r2, r0); | 2989 __ mov(r2, r0); |
2971 __ RecordWriteField( | 2990 __ RecordWriteField( |
2972 r1, JSValue::kValueOffset, r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); | 2991 r1, JSValue::kValueOffset, r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
2973 | 2992 |
2974 __ bind(&done); | 2993 __ bind(&done); |
2975 context()->Plug(r0); | 2994 context()->Plug(r0); |
2976 } | 2995 } |
2977 | 2996 |
2978 | 2997 |
| 2998 void FullCodeGenerator::EmitSetDateField(CallRuntime* expr) { |
| 2999 ZoneList<Expression*>* args = expr->arguments(); |
| 3000 ASSERT(args->length() == 3); |
| 3001 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
| 3002 int index = Smi::cast(*(args->at(1)->AsLiteral()->handle()))->value(); |
| 3003 |
| 3004 VisitForStackValue(args->at(0)); // Load the object. |
| 3005 VisitForAccumulatorValue(args->at(2)); // Load the value. |
| 3006 __ pop(r1); // r0 = value. r1 = object. |
| 3007 |
| 3008 #ifdef DEBUG |
| 3009 __ AbortIfSmi(r1); |
| 3010 __ CompareObjectType(r1, r2, r2, JS_DATE_TYPE); |
| 3011 __ Assert(eq, "Trying to get date field from non-date."); |
| 3012 #endif |
| 3013 |
| 3014 // Store the value. |
| 3015 __ str(r0, FieldMemOperand(r1, JSDate::kValueOffset + kPointerSize * index)); |
| 3016 // Caches can only be smi or NaN, so we can skip the write barrier for them. |
| 3017 if (index < JSDate::kFirstBarrierFree) { |
| 3018 // Update the write barrier. Save the value as it will be |
| 3019 // overwritten by the write barrier code and is needed afterward. |
| 3020 __ mov(r2, r0); |
| 3021 __ RecordWriteField( |
| 3022 r1, JSDate::kValueOffset + kPointerSize * index, |
| 3023 r2, r3, kLRHasBeenSaved, kDontSaveFPRegs); |
| 3024 } |
| 3025 context()->Plug(r0); |
| 3026 } |
| 3027 |
| 3028 |
2979 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | 3029 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { |
2980 ZoneList<Expression*>* args = expr->arguments(); | 3030 ZoneList<Expression*>* args = expr->arguments(); |
2981 ASSERT_EQ(args->length(), 1); | 3031 ASSERT_EQ(args->length(), 1); |
2982 // Load the argument on the stack and call the stub. | 3032 // Load the argument on the stack and call the stub. |
2983 VisitForStackValue(args->at(0)); | 3033 VisitForStackValue(args->at(0)); |
2984 | 3034 |
2985 NumberToStringStub stub; | 3035 NumberToStringStub stub; |
2986 __ CallStub(&stub); | 3036 __ CallStub(&stub); |
2987 context()->Plug(r0); | 3037 context()->Plug(r0); |
2988 } | 3038 } |
(...skipping 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4390 *context_length = 0; | 4440 *context_length = 0; |
4391 return previous_; | 4441 return previous_; |
4392 } | 4442 } |
4393 | 4443 |
4394 | 4444 |
4395 #undef __ | 4445 #undef __ |
4396 | 4446 |
4397 } } // namespace v8::internal | 4447 } } // namespace v8::internal |
4398 | 4448 |
4399 #endif // V8_TARGET_ARCH_ARM | 4449 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |