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 2334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 | 2345 |
2346 // If we came here, we need to see if we are the array function. | 2346 // If we came here, we need to see if we are the array function. |
2347 // If we didn't have a matching function, and we didn't find the megamorph | 2347 // If we didn't have a matching function, and we didn't find the megamorph |
2348 // sentinel, then we have in the slot either some other function or an | 2348 // sentinel, then we have in the slot either some other function or an |
2349 // AllocationSite. Do a map check on the object in ecx. | 2349 // AllocationSite. Do a map check on the object in ecx. |
2350 Handle<Map> allocation_site_map = | 2350 Handle<Map> allocation_site_map = |
2351 masm->isolate()->factory()->allocation_site_map(); | 2351 masm->isolate()->factory()->allocation_site_map(); |
2352 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); | 2352 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); |
2353 __ j(not_equal, &miss); | 2353 __ j(not_equal, &miss); |
2354 | 2354 |
2355 // Load the global or builtins object from the current context | |
2356 __ LoadGlobalContext(ecx); | |
2357 // Make sure the function is the Array() function | 2355 // Make sure the function is the Array() function |
2358 __ cmp(edi, Operand(ecx, | 2356 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
2359 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | 2357 __ cmp(edi, ecx); |
2360 __ j(not_equal, &megamorphic); | 2358 __ j(not_equal, &megamorphic); |
2361 __ jmp(&done, Label::kFar); | 2359 __ jmp(&done, Label::kFar); |
2362 | 2360 |
2363 __ bind(&miss); | 2361 __ bind(&miss); |
2364 | 2362 |
2365 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2363 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
2366 // megamorphic. | 2364 // megamorphic. |
2367 __ cmp(ecx, Immediate(TypeFeedbackInfo::UninitializedSentinel(isolate))); | 2365 __ cmp(ecx, Immediate(TypeFeedbackInfo::UninitializedSentinel(isolate))); |
2368 __ j(equal, &initialize); | 2366 __ j(equal, &initialize); |
2369 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2367 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
2370 // write-barrier is needed. | 2368 // write-barrier is needed. |
2371 __ bind(&megamorphic); | 2369 __ bind(&megamorphic); |
2372 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 2370 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
2373 FixedArray::kHeaderSize), | 2371 FixedArray::kHeaderSize), |
2374 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 2372 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); |
2375 __ jmp(&done, Label::kFar); | 2373 __ jmp(&done, Label::kFar); |
2376 | 2374 |
2377 // An uninitialized cache is patched with the function or sentinel to | 2375 // An uninitialized cache is patched with the function or sentinel to |
2378 // indicate the ElementsKind if function is the Array constructor. | 2376 // indicate the ElementsKind if function is the Array constructor. |
2379 __ bind(&initialize); | 2377 __ bind(&initialize); |
2380 __ LoadGlobalContext(ecx); | |
2381 // Make sure the function is the Array() function | 2378 // Make sure the function is the Array() function |
2382 __ cmp(edi, Operand(ecx, | 2379 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
2383 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | 2380 __ cmp(edi, ecx); |
2384 __ j(not_equal, ¬_array_function); | 2381 __ j(not_equal, ¬_array_function); |
2385 | 2382 |
2386 // The target function is the Array constructor, | 2383 // The target function is the Array constructor, |
2387 // Create an AllocationSite if we don't already have it, store it in the slot. | 2384 // Create an AllocationSite if we don't already have it, store it in the slot. |
2388 { | 2385 { |
2389 FrameScope scope(masm, StackFrame::INTERNAL); | 2386 FrameScope scope(masm, StackFrame::INTERNAL); |
2390 | 2387 |
2391 // Arguments register must be smi-tagged to call out. | 2388 // Arguments register must be smi-tagged to call out. |
2392 __ SmiTag(eax); | 2389 __ SmiTag(eax); |
2393 __ push(eax); | 2390 __ push(eax); |
(...skipping 3064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5458 Operand(ebp, 7 * kPointerSize), | 5455 Operand(ebp, 7 * kPointerSize), |
5459 NULL); | 5456 NULL); |
5460 } | 5457 } |
5461 | 5458 |
5462 | 5459 |
5463 #undef __ | 5460 #undef __ |
5464 | 5461 |
5465 } } // namespace v8::internal | 5462 } } // namespace v8::internal |
5466 | 5463 |
5467 #endif // V8_TARGET_ARCH_IA32 | 5464 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |