| 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 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3010 // r0 : number of arguments to the construct function | 3010 // r0 : number of arguments to the construct function |
| 3011 // r1 : the function to call | 3011 // r1 : the function to call |
| 3012 // r2 : Feedback vector | 3012 // r2 : Feedback vector |
| 3013 // r3 : slot in feedback vector (Smi) | 3013 // r3 : slot in feedback vector (Smi) |
| 3014 Label initialize, done, miss, megamorphic, not_array_function; | 3014 Label initialize, done, miss, megamorphic, not_array_function; |
| 3015 | 3015 |
| 3016 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), | 3016 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), |
| 3017 masm->isolate()->heap()->undefined_value()); | 3017 masm->isolate()->heap()->undefined_value()); |
| 3018 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), | 3018 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), |
| 3019 masm->isolate()->heap()->the_hole_value()); | 3019 masm->isolate()->heap()->the_hole_value()); |
| 3020 ASSERT_EQ(*TypeFeedbackInfo::PremonomorphicSentinel(masm->isolate()), | |
| 3021 masm->isolate()->heap()->null_value()); | |
| 3022 | 3020 |
| 3023 // Load the cache state into r4. | 3021 // Load the cache state into r4. |
| 3024 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 3022 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 3025 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 3023 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
| 3026 | 3024 |
| 3027 // A monomorphic cache hit or an already megamorphic state: invoke the | 3025 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 3028 // function without changing the state. | 3026 // function without changing the state. |
| 3029 __ cmp(r4, r1); | 3027 __ cmp(r4, r1); |
| 3030 __ b(eq, &done); | 3028 __ b(eq, &done); |
| 3031 | 3029 |
| 3032 // If we came here, we need to see if we are the array function. | 3030 // If we came here, we need to see if we are the array function. |
| 3033 // If we didn't have a matching function, and we didn't find the megamorph | 3031 // If we didn't have a matching function, and we didn't find the megamorph |
| 3034 // sentinel, then we have in the slot either some other function or an | 3032 // sentinel, then we have in the slot either some other function or an |
| 3035 // AllocationSite. Do a map check on the object in ecx. | 3033 // AllocationSite. Do a map check on the object in ecx. |
| 3036 __ ldr(r5, FieldMemOperand(r4, 0)); | 3034 __ ldr(r5, FieldMemOperand(r4, 0)); |
| 3037 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 3035 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
| 3038 __ b(ne, &miss); | 3036 __ b(ne, &miss); |
| 3039 | 3037 |
| 3040 // Make sure the function is the Array() function | 3038 // Make sure the function is the Array() function |
| 3041 __ LoadArrayFunction(r4); | 3039 __ LoadArrayFunction(r4); |
| 3042 __ cmp(r1, r4); | 3040 __ cmp(r1, r4); |
| 3043 __ b(ne, &megamorphic); | 3041 __ b(ne, &megamorphic); |
| 3044 __ jmp(&done); | 3042 __ jmp(&done); |
| 3045 | 3043 |
| 3046 __ bind(&miss); | 3044 __ bind(&miss); |
| 3047 | 3045 |
| 3048 // A monomorphic miss (i.e, here the cache is not uninitialized or | 3046 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 3049 // pre-monomorphic) goes megamorphic. | 3047 // megamorphic. |
| 3050 Label not_uninitialized; | |
| 3051 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 3048 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); |
| 3052 __ b(ne, ¬_uninitialized); | |
| 3053 | |
| 3054 // PremonomorphicSentinel is an immortal immovable object (null) so no | |
| 3055 // write-barrier is needed. | |
| 3056 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | |
| 3057 __ LoadRoot(ip, Heap::kNullValueRootIndex); | |
| 3058 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); | |
| 3059 __ jmp(&done); | |
| 3060 | |
| 3061 // If the cache isn't uninitialized, it is either premonomorphic or | |
| 3062 // monomorphic. If it is premonomorphic, we initialize it thus making | |
| 3063 // it monomorphic. Otherwise, we go megamorphic. | |
| 3064 __ bind(¬_uninitialized); | |
| 3065 __ CompareRoot(r4, Heap::kNullValueRootIndex); | |
| 3066 __ b(eq, &initialize); | 3049 __ b(eq, &initialize); |
| 3067 | |
| 3068 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 3050 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 3069 // write-barrier is needed. | 3051 // write-barrier is needed. |
| 3070 __ bind(&megamorphic); | 3052 __ bind(&megamorphic); |
| 3071 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 3053 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
| 3072 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3054 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 3073 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 3055 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
| 3074 __ jmp(&done); | 3056 __ jmp(&done); |
| 3075 | 3057 |
| 3076 // An uninitialized cache is patched with the function or sentinel to | 3058 // An uninitialized cache is patched with the function or sentinel to |
| 3077 // indicate the ElementsKind if function is the Array constructor. | 3059 // indicate the ElementsKind if function is the Array constructor. |
| (...skipping 2519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5597 MemOperand(fp, 6 * kPointerSize), | 5579 MemOperand(fp, 6 * kPointerSize), |
| 5598 NULL); | 5580 NULL); |
| 5599 } | 5581 } |
| 5600 | 5582 |
| 5601 | 5583 |
| 5602 #undef __ | 5584 #undef __ |
| 5603 | 5585 |
| 5604 } } // namespace v8::internal | 5586 } } // namespace v8::internal |
| 5605 | 5587 |
| 5606 #endif // V8_TARGET_ARCH_ARM | 5588 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |