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