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 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2516 } | 2516 } |
2517 | 2517 |
2518 | 2518 |
2519 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 2519 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
2520 // r3 : number of arguments to the construct function | 2520 // r3 : number of arguments to the construct function |
2521 // r5 : Feedback vector | 2521 // r5 : Feedback vector |
2522 // r6 : slot in feedback vector (Smi) | 2522 // r6 : slot in feedback vector (Smi) |
2523 // r4 : the function to call | 2523 // r4 : the function to call |
2524 FrameScope scope(masm, StackFrame::INTERNAL); | 2524 FrameScope scope(masm, StackFrame::INTERNAL); |
2525 | 2525 |
2526 // Arguments register must be smi-tagged to call out. | 2526 // Number-of-arguments register must be smi-tagged to call out. |
2527 __ SmiTag(r3); | 2527 __ SmiTag(r3); |
2528 __ Push(r6, r5, r4, r3); | 2528 __ Push(r6, r5, r4, r3); |
2529 | 2529 |
2530 __ CallStub(stub); | 2530 __ CallStub(stub); |
2531 | 2531 |
2532 __ Pop(r6, r5, r4, r3); | 2532 __ Pop(r6, r5, r4, r3); |
2533 __ SmiUntag(r3); | 2533 __ SmiUntag(r3); |
2534 } | 2534 } |
2535 | 2535 |
2536 | 2536 |
(...skipping 12 matching lines...) Expand all Loading... |
2549 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), | 2549 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
2550 masm->isolate()->heap()->uninitialized_symbol()); | 2550 masm->isolate()->heap()->uninitialized_symbol()); |
2551 | 2551 |
2552 // Load the cache state into r7. | 2552 // Load the cache state into r7. |
2553 __ SmiToPtrArrayOffset(r7, r6); | 2553 __ SmiToPtrArrayOffset(r7, r6); |
2554 __ add(r7, r5, r7); | 2554 __ add(r7, r5, r7); |
2555 __ LoadP(r7, FieldMemOperand(r7, FixedArray::kHeaderSize)); | 2555 __ LoadP(r7, FieldMemOperand(r7, FixedArray::kHeaderSize)); |
2556 | 2556 |
2557 // A monomorphic cache hit or an already megamorphic state: invoke the | 2557 // A monomorphic cache hit or an already megamorphic state: invoke the |
2558 // function without changing the state. | 2558 // function without changing the state. |
| 2559 // We don't know if r7 is a WeakCell or a Symbol, but it's harmless to read at |
| 2560 // this position in a symbol (see static asserts in type-feedback-vector.h). |
2559 Label check_allocation_site; | 2561 Label check_allocation_site; |
2560 Register feedback_map = r8; | 2562 Register feedback_map = r8; |
2561 Register weak_value = r9; | 2563 Register weak_value = r9; |
2562 __ LoadP(weak_value, FieldMemOperand(r7, WeakCell::kValueOffset)); | 2564 __ LoadP(weak_value, FieldMemOperand(r7, WeakCell::kValueOffset)); |
2563 __ cmp(r4, weak_value); | 2565 __ cmp(r4, weak_value); |
2564 __ beq(&done); | 2566 __ beq(&done); |
2565 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); | 2567 __ CompareRoot(r7, Heap::kmegamorphic_symbolRootIndex); |
2566 __ beq(&done); | 2568 __ beq(&done); |
2567 __ LoadP(feedback_map, FieldMemOperand(r7, 0)); | 2569 __ LoadP(feedback_map, FieldMemOperand(r7, HeapObject::kMapOffset)); |
2568 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); | 2570 __ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); |
2569 __ bne(FLAG_pretenuring_call_new ? &miss : &check_allocation_site); | 2571 __ bne(FLAG_pretenuring_call_new ? &miss : &check_allocation_site); |
2570 | 2572 |
2571 // If r4 is not equal to the weak cell value, and the weak cell value is | 2573 // If the weak cell is cleared, we have a new chance to become monomorphic. |
2572 // cleared, we have a new chance to become monomorphic. | |
2573 __ JumpIfSmi(weak_value, &initialize); | 2574 __ JumpIfSmi(weak_value, &initialize); |
2574 __ b(&megamorphic); | 2575 __ b(&megamorphic); |
2575 | 2576 |
2576 if (!FLAG_pretenuring_call_new) { | 2577 if (!FLAG_pretenuring_call_new) { |
2577 __ bind(&check_allocation_site); | 2578 __ bind(&check_allocation_site); |
2578 // If we came here, we need to see if we are the array function. | 2579 // If we came here, we need to see if we are the array function. |
2579 // If we didn't have a matching function, and we didn't find the megamorph | 2580 // If we didn't have a matching function, and we didn't find the megamorph |
2580 // sentinel, then we have in the slot either some other function or an | 2581 // sentinel, then we have in the slot either some other function or an |
2581 // AllocationSite. Do a map check on the object in ecx. | 2582 // AllocationSite. |
2582 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); | 2583 __ CompareRoot(feedback_map, Heap::kAllocationSiteMapRootIndex); |
2583 __ bne(&miss); | 2584 __ bne(&miss); |
2584 | 2585 |
2585 // Make sure the function is the Array() function | 2586 // Make sure the function is the Array() function |
2586 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); | 2587 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r7); |
2587 __ cmp(r4, r7); | 2588 __ cmp(r4, r7); |
2588 __ bne(&megamorphic); | 2589 __ bne(&megamorphic); |
2589 __ b(&done); | 2590 __ b(&done); |
2590 } | 2591 } |
2591 | 2592 |
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5590 kStackUnwindSpace, NULL, | 5591 kStackUnwindSpace, NULL, |
5591 MemOperand(fp, 6 * kPointerSize), NULL); | 5592 MemOperand(fp, 6 * kPointerSize), NULL); |
5592 } | 5593 } |
5593 | 5594 |
5594 | 5595 |
5595 #undef __ | 5596 #undef __ |
5596 } | 5597 } |
5597 } // namespace v8::internal | 5598 } // namespace v8::internal |
5598 | 5599 |
5599 #endif // V8_TARGET_ARCH_PPC | 5600 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |