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()); |
3020 | 3022 |
3021 // Load the cache state into r4. | 3023 // Load the cache state into r4. |
3022 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 3024 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
3023 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 3025 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
3024 | 3026 |
3025 // A monomorphic cache hit or an already megamorphic state: invoke the | 3027 // A monomorphic cache hit or an already megamorphic state: invoke the |
3026 // function without changing the state. | 3028 // function without changing the state. |
3027 __ cmp(r4, r1); | 3029 __ cmp(r4, r1); |
3028 __ b(eq, &done); | 3030 __ b(eq, &done); |
3029 | 3031 |
3030 // If we came here, we need to see if we are the array function. | 3032 // If we came here, we need to see if we are the array function. |
3031 // If we didn't have a matching function, and we didn't find the megamorph | 3033 // If we didn't have a matching function, and we didn't find the megamorph |
3032 // sentinel, then we have in the slot either some other function or an | 3034 // sentinel, then we have in the slot either some other function or an |
3033 // AllocationSite. Do a map check on the object in ecx. | 3035 // AllocationSite. Do a map check on the object in ecx. |
3034 __ ldr(r5, FieldMemOperand(r4, 0)); | 3036 __ ldr(r5, FieldMemOperand(r4, 0)); |
3035 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 3037 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
3036 __ b(ne, &miss); | 3038 __ b(ne, &miss); |
3037 | 3039 |
3038 // Make sure the function is the Array() function | 3040 // Make sure the function is the Array() function |
3039 __ LoadArrayFunction(r4); | 3041 __ LoadArrayFunction(r4); |
3040 __ cmp(r1, r4); | 3042 __ cmp(r1, r4); |
3041 __ b(ne, &megamorphic); | 3043 __ b(ne, &megamorphic); |
3042 __ jmp(&done); | 3044 __ jmp(&done); |
3043 | 3045 |
3044 __ bind(&miss); | 3046 __ bind(&miss); |
3045 | 3047 |
3046 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 3048 // A monomorphic miss (i.e, here the cache is not uninitialized or |
3047 // megamorphic. | 3049 // pre-monomorphic) goes megamorphic. |
| 3050 Label not_uninitialized; |
3048 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); | 3051 __ 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); |
3049 __ b(eq, &initialize); | 3066 __ b(eq, &initialize); |
| 3067 |
3050 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 3068 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
3051 // write-barrier is needed. | 3069 // write-barrier is needed. |
3052 __ bind(&megamorphic); | 3070 __ bind(&megamorphic); |
3053 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 3071 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
3054 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3072 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
3055 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 3073 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
3056 __ jmp(&done); | 3074 __ jmp(&done); |
3057 | 3075 |
3058 // An uninitialized cache is patched with the function or sentinel to | 3076 // An uninitialized cache is patched with the function or sentinel to |
3059 // indicate the ElementsKind if function is the Array constructor. | 3077 // indicate the ElementsKind if function is the Array constructor. |
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5574 MemOperand(fp, 6 * kPointerSize), | 5592 MemOperand(fp, 6 * kPointerSize), |
5575 NULL); | 5593 NULL); |
5576 } | 5594 } |
5577 | 5595 |
5578 | 5596 |
5579 #undef __ | 5597 #undef __ |
5580 | 5598 |
5581 } } // namespace v8::internal | 5599 } } // namespace v8::internal |
5582 | 5600 |
5583 #endif // V8_TARGET_ARCH_ARM | 5601 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |