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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 // (9) Sliced string. Replace subject with parent. Go to (4). | 2519 // (9) Sliced string. Replace subject with parent. Go to (4). |
2520 // Load offset into r11 and replace subject string with parent. | 2520 // Load offset into r11 and replace subject string with parent. |
2521 __ LoadP(r11, FieldMemOperand(subject, SlicedString::kOffsetOffset)); | 2521 __ LoadP(r11, FieldMemOperand(subject, SlicedString::kOffsetOffset)); |
2522 __ SmiUntag(r11); | 2522 __ SmiUntag(r11); |
2523 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); | 2523 __ LoadP(subject, FieldMemOperand(subject, SlicedString::kParentOffset)); |
2524 __ b(&check_underlying); // Go to (4). | 2524 __ b(&check_underlying); // Go to (4). |
2525 #endif // V8_INTERPRETED_REGEXP | 2525 #endif // V8_INTERPRETED_REGEXP |
2526 } | 2526 } |
2527 | 2527 |
2528 | 2528 |
| 2529 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
| 2530 // r3 : number of arguments to the construct function |
| 2531 // r5 : Feedback vector |
| 2532 // r6 : slot in feedback vector (Smi) |
| 2533 // r4 : the function to call |
| 2534 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2535 |
| 2536 // Arguments register must be smi-tagged to call out. |
| 2537 __ SmiTag(r3); |
| 2538 __ Push(r6, r5, r4, r3); |
| 2539 |
| 2540 __ CallStub(stub); |
| 2541 |
| 2542 __ Pop(r6, r5, r4, r3); |
| 2543 __ SmiUntag(r3); |
| 2544 } |
| 2545 |
| 2546 |
2529 static void GenerateRecordCallTarget(MacroAssembler* masm) { | 2547 static void GenerateRecordCallTarget(MacroAssembler* masm) { |
2530 // Cache the called function in a feedback vector slot. Cache states | 2548 // Cache the called function in a feedback vector slot. Cache states |
2531 // are uninitialized, monomorphic (indicated by a JSFunction), and | 2549 // are uninitialized, monomorphic (indicated by a JSFunction), and |
2532 // megamorphic. | 2550 // megamorphic. |
2533 // r3 : number of arguments to the construct function | 2551 // r3 : number of arguments to the construct function |
2534 // r4 : the function to call | 2552 // r4 : the function to call |
2535 // r5 : Feedback vector | 2553 // r5 : Feedback vector |
2536 // r6 : slot in feedback vector (Smi) | 2554 // r6 : slot in feedback vector (Smi) |
2537 Label initialize, done, miss, megamorphic, not_array_function; | 2555 Label initialize, done, miss, megamorphic, not_array_function; |
2538 | 2556 |
2539 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), | 2557 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
2540 masm->isolate()->heap()->megamorphic_symbol()); | 2558 masm->isolate()->heap()->megamorphic_symbol()); |
2541 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), | 2559 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
2542 masm->isolate()->heap()->uninitialized_symbol()); | 2560 masm->isolate()->heap()->uninitialized_symbol()); |
2543 | 2561 |
2544 // Load the cache state into r7. | 2562 // Load the cache state into r7. |
2545 __ SmiToPtrArrayOffset(r7, r6); | 2563 __ SmiToPtrArrayOffset(r7, r6); |
2546 __ add(r7, r5, r7); | 2564 __ add(r7, r5, r7); |
2547 __ LoadP(r7, FieldMemOperand(r7, FixedArray::kHeaderSize)); | 2565 __ LoadP(r7, FieldMemOperand(r7, FixedArray::kHeaderSize)); |
2548 | 2566 |
2549 // A monomorphic cache hit or an already megamorphic state: invoke the | 2567 // A monomorphic cache hit or an already megamorphic state: invoke the |
2550 // function without changing the state. | 2568 // function without changing the state. |
2551 __ cmp(r7, r4); | 2569 Label check_allocation_site; |
2552 __ b(eq, &done); | 2570 Register feedback_map = r8; |
| 2571 Register weak_value = r9; |
| 2572 __ LoadP(weak_value, FieldMemOperand(r7, WeakCell::kValueOffset)); |
| 2573 __ cmp(r4, weak_value); |
| 2574 __ beq(&done); |
| 2575 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); |
| 2576 __ beq(&done); |
| 2577 __ LoadP(feedback_map, FieldMemOperand(r7, 0)); |
| 2578 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); |
| 2579 __ bne(FLAG_pretenuring_call_new ? &miss : &check_allocation_site); |
| 2580 |
| 2581 // If r4 is not equal to the weak cell value, and the weak cell value is |
| 2582 // cleared, we have a new chance to become monomorphic. |
| 2583 __ JumpIfSmi(weak_value, &initialize); |
| 2584 __ b(&megamorphic); |
2553 | 2585 |
2554 if (!FLAG_pretenuring_call_new) { | 2586 if (!FLAG_pretenuring_call_new) { |
| 2587 __ bind(&check_allocation_site); |
2555 // If we came here, we need to see if we are the array function. | 2588 // If we came here, we need to see if we are the array function. |
2556 // If we didn't have a matching function, and we didn't find the megamorph | 2589 // If we didn't have a matching function, and we didn't find the megamorph |
2557 // sentinel, then we have in the slot either some other function or an | 2590 // sentinel, then we have in the slot either some other function or an |
2558 // AllocationSite. Do a map check on the object in ecx. | 2591 // AllocationSite. Do a map check on the object in ecx. |
2559 __ LoadP(r8, FieldMemOperand(r7, 0)); | 2592 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); |
2560 __ CompareRoot(r8, Heap::kAllocationSiteMapRootIndex); | |
2561 __ bne(&miss); | 2593 __ bne(&miss); |
2562 | 2594 |
2563 // Make sure the function is the Array() function | 2595 // Make sure the function is the Array() function |
2564 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); | 2596 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); |
2565 __ cmp(r4, r7); | 2597 __ cmp(r4, r7); |
2566 __ bne(&megamorphic); | 2598 __ bne(&megamorphic); |
2567 __ b(&done); | 2599 __ b(&done); |
2568 } | 2600 } |
2569 | 2601 |
2570 __ bind(&miss); | 2602 __ bind(&miss); |
(...skipping 16 matching lines...) Expand all Loading... |
2587 | 2619 |
2588 if (!FLAG_pretenuring_call_new) { | 2620 if (!FLAG_pretenuring_call_new) { |
2589 // Make sure the function is the Array() function. | 2621 // Make sure the function is the Array() function. |
2590 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); | 2622 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); |
2591 __ cmp(r4, r7); | 2623 __ cmp(r4, r7); |
2592 __ bne(¬_array_function); | 2624 __ bne(¬_array_function); |
2593 | 2625 |
2594 // The target function is the Array constructor, | 2626 // The target function is the Array constructor, |
2595 // Create an AllocationSite if we don't already have it, store it in the | 2627 // Create an AllocationSite if we don't already have it, store it in the |
2596 // slot. | 2628 // slot. |
2597 { | 2629 CreateAllocationSiteStub create_stub(masm->isolate()); |
2598 FrameScope scope(masm, StackFrame::INTERNAL); | 2630 CallStubInRecordCallTarget(masm, &create_stub); |
2599 | |
2600 // Arguments register must be smi-tagged to call out. | |
2601 __ SmiTag(r3); | |
2602 __ Push(r6, r5, r4, r3); | |
2603 | |
2604 CreateAllocationSiteStub create_stub(masm->isolate()); | |
2605 __ CallStub(&create_stub); | |
2606 | |
2607 __ Pop(r6, r5, r4, r3); | |
2608 __ SmiUntag(r3); | |
2609 } | |
2610 __ b(&done); | 2631 __ b(&done); |
2611 | 2632 |
2612 __ bind(¬_array_function); | 2633 __ bind(¬_array_function); |
2613 } | 2634 } |
2614 | 2635 |
2615 __ SmiToPtrArrayOffset(r7, r6); | 2636 CreateWeakCellStub create_stub(masm->isolate()); |
2616 __ add(r7, r5, r7); | 2637 CallStubInRecordCallTarget(masm, &create_stub); |
2617 __ addi(r7, r7, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | |
2618 __ StoreP(r4, MemOperand(r7, 0)); | |
2619 | |
2620 __ Push(r7, r5, r4); | |
2621 __ RecordWrite(r5, r7, r4, kLRHasNotBeenSaved, kDontSaveFPRegs, | |
2622 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | |
2623 __ Pop(r7, r5, r4); | |
2624 | |
2625 __ bind(&done); | 2638 __ bind(&done); |
2626 } | 2639 } |
2627 | 2640 |
2628 | 2641 |
2629 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2642 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
2630 // Do not transform the receiver for strict mode functions and natives. | 2643 // Do not transform the receiver for strict mode functions and natives. |
2631 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 2644 __ LoadP(r6, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
2632 __ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); | 2645 __ lwz(r7, FieldMemOperand(r6, SharedFunctionInfo::kCompilerHintsOffset)); |
2633 __ TestBit(r7, | 2646 __ TestBit(r7, |
2634 #if V8_TARGET_ARCH_PPC64 | 2647 #if V8_TARGET_ARCH_PPC64 |
(...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5587 kStackUnwindSpace, NULL, | 5600 kStackUnwindSpace, NULL, |
5588 MemOperand(fp, 6 * kPointerSize), NULL); | 5601 MemOperand(fp, 6 * kPointerSize), NULL); |
5589 } | 5602 } |
5590 | 5603 |
5591 | 5604 |
5592 #undef __ | 5605 #undef __ |
5593 } | 5606 } |
5594 } // namespace v8::internal | 5607 } // namespace v8::internal |
5595 | 5608 |
5596 #endif // V8_TARGET_ARCH_PPC | 5609 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |