| 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 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2941 // If the object is not a value type, return the object. | 2941 // If the object is not a value type, return the object. |
| 2942 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); | 2942 __ CmpObjectType(eax, JS_VALUE_TYPE, ebx); |
| 2943 __ j(not_equal, &done, Label::kNear); | 2943 __ j(not_equal, &done, Label::kNear); |
| 2944 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); | 2944 __ mov(eax, FieldOperand(eax, JSValue::kValueOffset)); |
| 2945 | 2945 |
| 2946 __ bind(&done); | 2946 __ bind(&done); |
| 2947 context()->Plug(eax); | 2947 context()->Plug(eax); |
| 2948 } | 2948 } |
| 2949 | 2949 |
| 2950 | 2950 |
| 2951 void FullCodeGenerator::EmitDateField(CallRuntime* expr) { |
| 2952 ZoneList<Expression*>* args = expr->arguments(); |
| 2953 ASSERT(args->length() == 2); |
| 2954 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
| 2955 int index = Smi::cast(*(args->at(1)->AsLiteral()->handle()))->value(); |
| 2956 |
| 2957 VisitForAccumulatorValue(args->at(0)); // Load the object. |
| 2958 |
| 2959 #ifdef DEBUG |
| 2960 __ AbortIfSmi(eax); |
| 2961 __ CmpObjectType(eax, JS_DATE_TYPE, ebx); |
| 2962 __ Assert(equal, "Trying to get date field from non-date."); |
| 2963 #endif |
| 2964 |
| 2965 __ mov(eax, FieldOperand(eax, JSDate::kValueOffset + kPointerSize * index)); |
| 2966 context()->Plug(eax); |
| 2967 } |
| 2968 |
| 2969 |
| 2951 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { | 2970 void FullCodeGenerator::EmitMathPow(CallRuntime* expr) { |
| 2952 // Load the arguments on the stack and call the runtime function. | 2971 // Load the arguments on the stack and call the runtime function. |
| 2953 ZoneList<Expression*>* args = expr->arguments(); | 2972 ZoneList<Expression*>* args = expr->arguments(); |
| 2954 ASSERT(args->length() == 2); | 2973 ASSERT(args->length() == 2); |
| 2955 VisitForStackValue(args->at(0)); | 2974 VisitForStackValue(args->at(0)); |
| 2956 VisitForStackValue(args->at(1)); | 2975 VisitForStackValue(args->at(1)); |
| 2957 | 2976 |
| 2958 if (CpuFeatures::IsSupported(SSE2)) { | 2977 if (CpuFeatures::IsSupported(SSE2)) { |
| 2959 MathPowStub stub(MathPowStub::ON_STACK); | 2978 MathPowStub stub(MathPowStub::ON_STACK); |
| 2960 __ CallStub(&stub); | 2979 __ CallStub(&stub); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2987 // Update the write barrier. Save the value as it will be | 3006 // Update the write barrier. Save the value as it will be |
| 2988 // overwritten by the write barrier code and is needed afterward. | 3007 // overwritten by the write barrier code and is needed afterward. |
| 2989 __ mov(edx, eax); | 3008 __ mov(edx, eax); |
| 2990 __ RecordWriteField(ebx, JSValue::kValueOffset, edx, ecx, kDontSaveFPRegs); | 3009 __ RecordWriteField(ebx, JSValue::kValueOffset, edx, ecx, kDontSaveFPRegs); |
| 2991 | 3010 |
| 2992 __ bind(&done); | 3011 __ bind(&done); |
| 2993 context()->Plug(eax); | 3012 context()->Plug(eax); |
| 2994 } | 3013 } |
| 2995 | 3014 |
| 2996 | 3015 |
| 3016 void FullCodeGenerator::EmitSetDateField(CallRuntime* expr) { |
| 3017 ZoneList<Expression*>* args = expr->arguments(); |
| 3018 ASSERT(args->length() == 3); |
| 3019 ASSERT_NE(NULL, args->at(1)->AsLiteral()); |
| 3020 int index = Smi::cast(*(args->at(1)->AsLiteral()->handle()))->value(); |
| 3021 |
| 3022 VisitForStackValue(args->at(0)); // Load the object. |
| 3023 VisitForAccumulatorValue(args->at(2)); // Load the value. |
| 3024 __ pop(ebx); // eax = value. ebx = object. |
| 3025 |
| 3026 #ifdef DEBUG |
| 3027 __ AbortIfSmi(ebx); |
| 3028 __ CmpObjectType(ebx, JS_DATE_TYPE, ecx); |
| 3029 __ Assert(equal, "Trying to set date field on non-date."); |
| 3030 #endif |
| 3031 |
| 3032 // Store the value. |
| 3033 __ mov(FieldOperand(ebx, JSDate::kValueOffset + kPointerSize * index), eax); |
| 3034 // Caches can only be smi or NaN, so we can skip the write barrier for them. |
| 3035 if (index < JSDate::kFirstBarrierFree) { |
| 3036 // Update the write barrier. Save the value as it will be |
| 3037 // overwritten by the write barrier code and is needed afterward. |
| 3038 __ mov(edx, eax); |
| 3039 __ RecordWriteField(ebx, JSDate::kValueOffset + kPointerSize * index, |
| 3040 edx, ecx, kDontSaveFPRegs); |
| 3041 } |
| 3042 context()->Plug(eax); |
| 3043 } |
| 3044 |
| 3045 |
| 2997 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { | 3046 void FullCodeGenerator::EmitNumberToString(CallRuntime* expr) { |
| 2998 ZoneList<Expression*>* args = expr->arguments(); | 3047 ZoneList<Expression*>* args = expr->arguments(); |
| 2999 ASSERT_EQ(args->length(), 1); | 3048 ASSERT_EQ(args->length(), 1); |
| 3000 | 3049 |
| 3001 // Load the argument on the stack and call the stub. | 3050 // Load the argument on the stack and call the stub. |
| 3002 VisitForStackValue(args->at(0)); | 3051 VisitForStackValue(args->at(0)); |
| 3003 | 3052 |
| 3004 NumberToStringStub stub; | 3053 NumberToStringStub stub; |
| 3005 __ CallStub(&stub); | 3054 __ CallStub(&stub); |
| 3006 context()->Plug(eax); | 3055 context()->Plug(eax); |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4453 *context_length = 0; | 4502 *context_length = 0; |
| 4454 return previous_; | 4503 return previous_; |
| 4455 } | 4504 } |
| 4456 | 4505 |
| 4457 | 4506 |
| 4458 #undef __ | 4507 #undef __ |
| 4459 | 4508 |
| 4460 } } // namespace v8::internal | 4509 } } // namespace v8::internal |
| 4461 | 4510 |
| 4462 #endif // V8_TARGET_ARCH_IA32 | 4511 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |