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