| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2473 Label check_allocation_site; | 2473 Label check_allocation_site; |
| 2474 Register feedback_map = r9; | 2474 Register feedback_map = r9; |
| 2475 Register weak_value = r10; | 2475 Register weak_value = r10; |
| 2476 __ LoadP(weak_value, FieldMemOperand(r8, WeakCell::kValueOffset)); | 2476 __ LoadP(weak_value, FieldMemOperand(r8, WeakCell::kValueOffset)); |
| 2477 __ cmp(r4, weak_value); | 2477 __ cmp(r4, weak_value); |
| 2478 __ beq(&done); | 2478 __ beq(&done); |
| 2479 __ CompareRoot(r8, Heap::kmegamorphic_symbolRootIndex); | 2479 __ CompareRoot(r8, Heap::kmegamorphic_symbolRootIndex); |
| 2480 __ beq(&done); | 2480 __ beq(&done); |
| 2481 __ LoadP(feedback_map, FieldMemOperand(r8, HeapObject::kMapOffset)); | 2481 __ LoadP(feedback_map, FieldMemOperand(r8, HeapObject::kMapOffset)); |
| 2482 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); | 2482 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); |
| 2483 __ bne(FLAG_pretenuring_call_new ? &miss : &check_allocation_site); | 2483 __ bne(&check_allocation_site); |
| 2484 | 2484 |
| 2485 // If the weak cell is cleared, we have a new chance to become monomorphic. | 2485 // If the weak cell is cleared, we have a new chance to become monomorphic. |
| 2486 __ JumpIfSmi(weak_value, &initialize); | 2486 __ JumpIfSmi(weak_value, &initialize); |
| 2487 __ b(&megamorphic); | 2487 __ b(&megamorphic); |
| 2488 | 2488 |
| 2489 if (!FLAG_pretenuring_call_new) { | 2489 __ bind(&check_allocation_site); |
| 2490 __ bind(&check_allocation_site); | 2490 // If we came here, we need to see if we are the array function. |
| 2491 // If we came here, we need to see if we are the array function. | 2491 // If we didn't have a matching function, and we didn't find the megamorph |
| 2492 // If we didn't have a matching function, and we didn't find the megamorph | 2492 // sentinel, then we have in the slot either some other function or an |
| 2493 // sentinel, then we have in the slot either some other function or an | 2493 // AllocationSite. |
| 2494 // AllocationSite. | 2494 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); |
| 2495 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); | 2495 __ bne(&miss); |
| 2496 __ bne(&miss); | |
| 2497 | 2496 |
| 2498 // Make sure the function is the Array() function | 2497 // Make sure the function is the Array() function |
| 2499 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r8); | 2498 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r8); |
| 2500 __ cmp(r4, r8); | 2499 __ cmp(r4, r8); |
| 2501 __ bne(&megamorphic); | 2500 __ bne(&megamorphic); |
| 2502 __ b(&done); | 2501 __ b(&done); |
| 2503 } | |
| 2504 | 2502 |
| 2505 __ bind(&miss); | 2503 __ bind(&miss); |
| 2506 | 2504 |
| 2507 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2505 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 2508 // megamorphic. | 2506 // megamorphic. |
| 2509 __ CompareRoot(r8, Heap::kuninitialized_symbolRootIndex); | 2507 __ CompareRoot(r8, Heap::kuninitialized_symbolRootIndex); |
| 2510 __ beq(&initialize); | 2508 __ beq(&initialize); |
| 2511 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2509 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 2512 // write-barrier is needed. | 2510 // write-barrier is needed. |
| 2513 __ bind(&megamorphic); | 2511 __ bind(&megamorphic); |
| 2514 __ SmiToPtrArrayOffset(r8, r6); | 2512 __ SmiToPtrArrayOffset(r8, r6); |
| 2515 __ add(r8, r5, r8); | 2513 __ add(r8, r5, r8); |
| 2516 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); | 2514 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
| 2517 __ StoreP(ip, FieldMemOperand(r8, FixedArray::kHeaderSize), r0); | 2515 __ StoreP(ip, FieldMemOperand(r8, FixedArray::kHeaderSize), r0); |
| 2518 __ jmp(&done); | 2516 __ jmp(&done); |
| 2519 | 2517 |
| 2520 // An uninitialized cache is patched with the function | 2518 // An uninitialized cache is patched with the function |
| 2521 __ bind(&initialize); | 2519 __ bind(&initialize); |
| 2522 | 2520 |
| 2523 if (!FLAG_pretenuring_call_new) { | 2521 // Make sure the function is the Array() function. |
| 2524 // Make sure the function is the Array() function. | 2522 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r8); |
| 2525 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r8); | 2523 __ cmp(r4, r8); |
| 2526 __ cmp(r4, r8); | 2524 __ bne(¬_array_function); |
| 2527 __ bne(¬_array_function); | |
| 2528 | 2525 |
| 2529 // The target function is the Array constructor, | 2526 // The target function is the Array constructor, |
| 2530 // Create an AllocationSite if we don't already have it, store it in the | 2527 // Create an AllocationSite if we don't already have it, store it in the |
| 2531 // slot. | 2528 // slot. |
| 2532 CreateAllocationSiteStub create_stub(masm->isolate()); | 2529 CreateAllocationSiteStub create_stub(masm->isolate()); |
| 2533 CallStubInRecordCallTarget(masm, &create_stub, is_super); | 2530 CallStubInRecordCallTarget(masm, &create_stub, is_super); |
| 2534 __ b(&done); | 2531 __ b(&done); |
| 2535 | 2532 |
| 2536 __ bind(¬_array_function); | 2533 __ bind(¬_array_function); |
| 2537 } | |
| 2538 | 2534 |
| 2539 CreateWeakCellStub create_stub(masm->isolate()); | 2535 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
| 2540 CallStubInRecordCallTarget(masm, &create_stub, is_super); | 2536 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
| 2541 __ bind(&done); | 2537 __ bind(&done); |
| 2542 } | 2538 } |
| 2543 | 2539 |
| 2544 | 2540 |
| 2545 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2541 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
| 2546 // Do not transform the receiver for strict mode functions and natives. | 2542 // Do not transform the receiver for strict mode functions and natives. |
| 2547 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 2543 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 2548 __ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); | 2544 __ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); |
| 2549 __ TestBit(r7, | 2545 __ TestBit(r7, |
| 2550 #if V8_TARGET_ARCH_PPC64 | 2546 #if V8_TARGET_ARCH_PPC64 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 __ JumpIfSmi(r4, &non_function_call); | 2654 __ JumpIfSmi(r4, &non_function_call); |
| 2659 // Check that the function is a JSFunction. | 2655 // Check that the function is a JSFunction. |
| 2660 __ CompareObjectType(r4, r8, r8, JS_FUNCTION_TYPE); | 2656 __ CompareObjectType(r4, r8, r8, JS_FUNCTION_TYPE); |
| 2661 __ bne(&slow); | 2657 __ bne(&slow); |
| 2662 | 2658 |
| 2663 if (RecordCallTarget()) { | 2659 if (RecordCallTarget()) { |
| 2664 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2660 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
| 2665 | 2661 |
| 2666 __ SmiToPtrArrayOffset(r8, r6); | 2662 __ SmiToPtrArrayOffset(r8, r6); |
| 2667 __ add(r8, r5, r8); | 2663 __ add(r8, r5, r8); |
| 2668 if (FLAG_pretenuring_call_new) { | 2664 // Put the AllocationSite from the feedback vector into r5, or undefined. |
| 2669 // Put the AllocationSite from the feedback vector into r5. | 2665 __ LoadP(r5, FieldMemOperand(r8, FixedArray::kHeaderSize)); |
| 2670 // By adding kPointerSize we encode that we know the AllocationSite | 2666 __ LoadP(r8, FieldMemOperand(r5, AllocationSite::kMapOffset)); |
| 2671 // entry is at the feedback vector slot given by r6 + 1. | 2667 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); |
| 2672 __ LoadP(r5, FieldMemOperand(r8, FixedArray::kHeaderSize + kPointerSize)); | 2668 if (CpuFeatures::IsSupported(ISELECT)) { |
| 2669 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); |
| 2670 __ isel(eq, r5, r5, r8); |
| 2673 } else { | 2671 } else { |
| 2674 // Put the AllocationSite from the feedback vector into r5, or undefined. | 2672 Label feedback_register_initialized; |
| 2675 __ LoadP(r5, FieldMemOperand(r8, FixedArray::kHeaderSize)); | 2673 __ beq(&feedback_register_initialized); |
| 2676 __ LoadP(r8, FieldMemOperand(r5, AllocationSite::kMapOffset)); | 2674 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
| 2677 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); | 2675 __ bind(&feedback_register_initialized); |
| 2678 if (CpuFeatures::IsSupported(ISELECT)) { | |
| 2679 __ LoadRoot(r8, Heap::kUndefinedValueRootIndex); | |
| 2680 __ isel(eq, r5, r5, r8); | |
| 2681 } else { | |
| 2682 Label feedback_register_initialized; | |
| 2683 __ beq(&feedback_register_initialized); | |
| 2684 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | |
| 2685 __ bind(&feedback_register_initialized); | |
| 2686 } | |
| 2687 } | 2676 } |
| 2688 | 2677 |
| 2689 __ AssertUndefinedOrAllocationSite(r5, r8); | 2678 __ AssertUndefinedOrAllocationSite(r5, r8); |
| 2690 } | 2679 } |
| 2691 | 2680 |
| 2692 // Pass function as original constructor. | 2681 // Pass function as original constructor. |
| 2693 if (IsSuperConstructorCall()) { | 2682 if (IsSuperConstructorCall()) { |
| 2694 __ mr(r6, r7); | 2683 __ mr(r6, r7); |
| 2695 } else { | 2684 } else { |
| 2696 __ mr(r6, r4); | 2685 __ mr(r6, r4); |
| (...skipping 3159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5856 kStackUnwindSpace, NULL, | 5845 kStackUnwindSpace, NULL, |
| 5857 MemOperand(fp, 6 * kPointerSize), NULL); | 5846 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5858 } | 5847 } |
| 5859 | 5848 |
| 5860 | 5849 |
| 5861 #undef __ | 5850 #undef __ |
| 5862 } // namespace internal | 5851 } // namespace internal |
| 5863 } // namespace v8 | 5852 } // namespace v8 |
| 5864 | 5853 |
| 5865 #endif // V8_TARGET_ARCH_PPC | 5854 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |