OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3185 // x0 : number of arguments to the construct function | 3185 // x0 : number of arguments to the construct function |
3186 // x1 : the function to call | 3186 // x1 : the function to call |
3187 // x2 : feedback vector | 3187 // x2 : feedback vector |
3188 // x3 : slot in feedback vector (smi) | 3188 // x3 : slot in feedback vector (smi) |
3189 Label initialize, done, miss, megamorphic, not_array_function; | 3189 Label initialize, done, miss, megamorphic, not_array_function; |
3190 | 3190 |
3191 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), | 3191 ASSERT_EQ(*TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()), |
3192 masm->isolate()->heap()->undefined_value()); | 3192 masm->isolate()->heap()->undefined_value()); |
3193 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), | 3193 ASSERT_EQ(*TypeFeedbackInfo::UninitializedSentinel(masm->isolate()), |
3194 masm->isolate()->heap()->the_hole_value()); | 3194 masm->isolate()->heap()->the_hole_value()); |
| 3195 ASSERT_EQ(*TypeFeedbackInfo::PremonomorphicSentinel(masm->isolate()), |
| 3196 masm->isolate()->heap()->null_value()); |
3195 | 3197 |
3196 // Load the cache state. | 3198 // Load the cache state. |
3197 __ Add(x4, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); | 3199 __ Add(x4, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); |
3198 __ Ldr(x4, FieldMemOperand(x4, FixedArray::kHeaderSize)); | 3200 __ Ldr(x4, FieldMemOperand(x4, FixedArray::kHeaderSize)); |
3199 | 3201 |
3200 // A monomorphic cache hit or an already megamorphic state: invoke the | 3202 // A monomorphic cache hit or an already megamorphic state: invoke the |
3201 // function without changing the state. | 3203 // function without changing the state. |
3202 __ Cmp(x4, x1); | 3204 __ Cmp(x4, x1); |
3203 __ B(eq, &done); | 3205 __ B(eq, &done); |
3204 | 3206 |
3205 // If we came here, we need to see if we are the array function. | 3207 // If we came here, we need to see if we are the array function. |
3206 // If we didn't have a matching function, and we didn't find the megamorph | 3208 // If we didn't have a matching function, and we didn't find the megamorph |
3207 // sentinel, then we have in the slot either some other function or an | 3209 // sentinel, then we have in the slot either some other function or an |
3208 // AllocationSite. Do a map check on the object in ecx. | 3210 // AllocationSite. Do a map check on the object in ecx. |
3209 __ Ldr(x5, FieldMemOperand(x4, AllocationSite::kMapOffset)); | 3211 __ Ldr(x5, FieldMemOperand(x4, AllocationSite::kMapOffset)); |
3210 __ JumpIfNotRoot(x5, Heap::kAllocationSiteMapRootIndex, &miss); | 3212 __ JumpIfNotRoot(x5, Heap::kAllocationSiteMapRootIndex, &miss); |
3211 | 3213 |
3212 // Make sure the function is the Array() function | 3214 // Make sure the function is the Array() function |
3213 __ LoadArrayFunction(x4); | 3215 __ LoadArrayFunction(x4); |
3214 __ Cmp(x1, x4); | 3216 __ Cmp(x1, x4); |
3215 __ B(ne, &megamorphic); | 3217 __ B(ne, &megamorphic); |
3216 __ B(&done); | 3218 __ B(&done); |
3217 | 3219 |
3218 __ Bind(&miss); | 3220 __ Bind(&miss); |
3219 | 3221 |
3220 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 3222 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
3221 // megamorphic. | 3223 // megamorphic. |
3222 __ JumpIfRoot(x4, Heap::kTheHoleValueRootIndex, &initialize); | 3224 Label not_uninitialized; |
| 3225 __ JumpIfNotRoot(x4, Heap::kTheHoleValueRootIndex, ¬_uninitialized); |
| 3226 |
| 3227 // PremonomorphicSentinel is an immortal immovable object (null) so no |
| 3228 // write-barrier is needed. |
| 3229 __ Add(x4, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); |
| 3230 __ LoadRoot(x10, Heap::kNullValueRootIndex); |
| 3231 __ Str(x10, FieldMemOperand(x4, FixedArray::kHeaderSize)); |
| 3232 __ B(&done); |
| 3233 |
| 3234 // If the cache isn't uninitialized, it is either premonomorphic or |
| 3235 // monomorphic. If it is premonomorphic, we initialize it thus making |
| 3236 // it monomorphic. Otherwise, we go megamorphic. |
| 3237 __ Bind(¬_uninitialized); |
| 3238 __ JumpIfRoot(x4, Heap::kNullValueRootIndex, &initialize); |
| 3239 |
3223 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 3240 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
3224 // write-barrier is needed. | 3241 // write-barrier is needed. |
3225 __ Bind(&megamorphic); | 3242 __ Bind(&megamorphic); |
3226 __ Add(x4, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); | 3243 __ Add(x4, x2, Operand::UntagSmiAndScale(x3, kPointerSizeLog2)); |
3227 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); | 3244 __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); |
3228 __ Str(x10, FieldMemOperand(x4, FixedArray::kHeaderSize)); | 3245 __ Str(x10, FieldMemOperand(x4, FixedArray::kHeaderSize)); |
3229 __ B(&done); | 3246 __ B(&done); |
3230 | 3247 |
3231 // An uninitialized cache is patched with the function or sentinel to | 3248 // An uninitialized cache is patched with the function or sentinel to |
3232 // indicate the ElementsKind if function is the Array constructor. | 3249 // indicate the ElementsKind if function is the Array constructor. |
(...skipping 2479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5712 MemOperand(fp, 6 * kPointerSize), | 5729 MemOperand(fp, 6 * kPointerSize), |
5713 NULL); | 5730 NULL); |
5714 } | 5731 } |
5715 | 5732 |
5716 | 5733 |
5717 #undef __ | 5734 #undef __ |
5718 | 5735 |
5719 } } // namespace v8::internal | 5736 } } // namespace v8::internal |
5720 | 5737 |
5721 #endif // V8_TARGET_ARCH_A64 | 5738 #endif // V8_TARGET_ARCH_A64 |
OLD | NEW |