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 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2407 #endif // V8_INTERPRETED_REGEXP | 2407 #endif // V8_INTERPRETED_REGEXP |
2408 } | 2408 } |
2409 | 2409 |
2410 | 2410 |
2411 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, | 2411 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, |
2412 bool is_super) { | 2412 bool is_super) { |
2413 // r3 : number of arguments to the construct function | 2413 // r3 : number of arguments to the construct function |
2414 // r4 : the function to call | 2414 // r4 : the function to call |
2415 // r5 : feedback vector | 2415 // r5 : feedback vector |
2416 // r6 : slot in feedback vector (Smi) | 2416 // r6 : slot in feedback vector (Smi) |
2417 // r7 : original constructor (for IsSuperConstructorCall) | 2417 // r7 : new target (for IsSuperConstructorCall) |
2418 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 2418 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
2419 | 2419 |
2420 // Number-of-arguments register must be smi-tagged to call out. | 2420 // Number-of-arguments register must be smi-tagged to call out. |
2421 __ SmiTag(r3); | 2421 __ SmiTag(r3); |
2422 if (is_super) { | 2422 if (is_super) { |
2423 __ Push(r6, r5, r4, r3, r7); | 2423 __ Push(r6, r5, r4, r3, r7); |
2424 } else { | 2424 } else { |
2425 __ Push(r6, r5, r4, r3); | 2425 __ Push(r6, r5, r4, r3); |
2426 } | 2426 } |
2427 | 2427 |
2428 __ CallStub(stub); | 2428 __ CallStub(stub); |
2429 | 2429 |
2430 if (is_super) { | 2430 if (is_super) { |
2431 __ Pop(r6, r5, r4, r3, r7); | 2431 __ Pop(r6, r5, r4, r3, r7); |
2432 } else { | 2432 } else { |
2433 __ Pop(r6, r5, r4, r3); | 2433 __ Pop(r6, r5, r4, r3); |
2434 } | 2434 } |
2435 __ SmiUntag(r3); | 2435 __ SmiUntag(r3); |
2436 } | 2436 } |
2437 | 2437 |
2438 | 2438 |
2439 static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { | 2439 static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { |
2440 // Cache the called function in a feedback vector slot. Cache states | 2440 // Cache the called function in a feedback vector slot. Cache states |
2441 // are uninitialized, monomorphic (indicated by a JSFunction), and | 2441 // are uninitialized, monomorphic (indicated by a JSFunction), and |
2442 // megamorphic. | 2442 // megamorphic. |
2443 // r3 : number of arguments to the construct function | 2443 // r3 : number of arguments to the construct function |
2444 // r4 : the function to call | 2444 // r4 : the function to call |
2445 // r5 : feedback vector | 2445 // r5 : feedback vector |
2446 // r6 : slot in feedback vector (Smi) | 2446 // r6 : slot in feedback vector (Smi) |
2447 // r7 : original constructor (for IsSuperConstructorCall) | 2447 // r7 : new target (for IsSuperConstructorCall) |
2448 Label initialize, done, miss, megamorphic, not_array_function; | 2448 Label initialize, done, miss, megamorphic, not_array_function; |
2449 | 2449 |
2450 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), | 2450 DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
2451 masm->isolate()->heap()->megamorphic_symbol()); | 2451 masm->isolate()->heap()->megamorphic_symbol()); |
2452 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), | 2452 DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
2453 masm->isolate()->heap()->uninitialized_symbol()); | 2453 masm->isolate()->heap()->uninitialized_symbol()); |
2454 | 2454 |
2455 // Load the cache state into r8. | 2455 // Load the cache state into r8. |
2456 __ SmiToPtrArrayOffset(r8, r6); | 2456 __ SmiToPtrArrayOffset(r8, r6); |
2457 __ add(r8, r5, r8); | 2457 __ add(r8, r5, r8); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2527 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); | 2527 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
2528 __ bind(&done); | 2528 __ bind(&done); |
2529 } | 2529 } |
2530 | 2530 |
2531 | 2531 |
2532 void CallConstructStub::Generate(MacroAssembler* masm) { | 2532 void CallConstructStub::Generate(MacroAssembler* masm) { |
2533 // r3 : number of arguments | 2533 // r3 : number of arguments |
2534 // r4 : the function to call | 2534 // r4 : the function to call |
2535 // r5 : feedback vector | 2535 // r5 : feedback vector |
2536 // r6 : slot in feedback vector (Smi, for RecordCallTarget) | 2536 // r6 : slot in feedback vector (Smi, for RecordCallTarget) |
2537 // r7 : original constructor (for IsSuperConstructorCall) | 2537 // r7 : new target (for IsSuperConstructorCall) |
2538 | 2538 |
2539 Label non_function; | 2539 Label non_function; |
2540 // Check that the function is not a smi. | 2540 // Check that the function is not a smi. |
2541 __ JumpIfSmi(r4, &non_function); | 2541 __ JumpIfSmi(r4, &non_function); |
2542 // Check that the function is a JSFunction. | 2542 // Check that the function is a JSFunction. |
2543 __ CompareObjectType(r4, r8, r8, JS_FUNCTION_TYPE); | 2543 __ CompareObjectType(r4, r8, r8, JS_FUNCTION_TYPE); |
2544 __ bne(&non_function); | 2544 __ bne(&non_function); |
2545 | 2545 |
2546 if (RecordCallTarget()) { | 2546 if (RecordCallTarget()) { |
2547 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2547 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
(...skipping 10 matching lines...) Expand all Loading... |
2558 } else { | 2558 } else { |
2559 Label feedback_register_initialized; | 2559 Label feedback_register_initialized; |
2560 __ beq(&feedback_register_initialized); | 2560 __ beq(&feedback_register_initialized); |
2561 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 2561 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
2562 __ bind(&feedback_register_initialized); | 2562 __ bind(&feedback_register_initialized); |
2563 } | 2563 } |
2564 | 2564 |
2565 __ AssertUndefinedOrAllocationSite(r5, r8); | 2565 __ AssertUndefinedOrAllocationSite(r5, r8); |
2566 } | 2566 } |
2567 | 2567 |
2568 // Pass function as original constructor. | 2568 // Pass function as new target. |
2569 if (IsSuperConstructorCall()) { | 2569 if (IsSuperConstructorCall()) { |
2570 __ mr(r6, r7); | 2570 __ mr(r6, r7); |
2571 } else { | 2571 } else { |
2572 __ mr(r6, r4); | 2572 __ mr(r6, r4); |
2573 } | 2573 } |
2574 | 2574 |
2575 // Tail call to the function-specific construct stub (still in the caller | 2575 // Tail call to the function-specific construct stub (still in the caller |
2576 // context at this point). | 2576 // context at this point). |
2577 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 2577 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
2578 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); | 2578 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); |
(...skipping 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5067 UNREACHABLE(); | 5067 UNREACHABLE(); |
5068 } | 5068 } |
5069 } | 5069 } |
5070 | 5070 |
5071 | 5071 |
5072 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 5072 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
5073 // ----------- S t a t e ------------- | 5073 // ----------- S t a t e ------------- |
5074 // -- r3 : argc (only if argument_count() == ANY) | 5074 // -- r3 : argc (only if argument_count() == ANY) |
5075 // -- r4 : constructor | 5075 // -- r4 : constructor |
5076 // -- r5 : AllocationSite or undefined | 5076 // -- r5 : AllocationSite or undefined |
5077 // -- r6 : original constructor | 5077 // -- r6 : new target |
5078 // -- sp[0] : return address | 5078 // -- sp[0] : return address |
5079 // -- sp[4] : last argument | 5079 // -- sp[4] : last argument |
5080 // ----------------------------------- | 5080 // ----------------------------------- |
5081 | 5081 |
5082 if (FLAG_debug_code) { | 5082 if (FLAG_debug_code) { |
5083 // The array construct code is only set for the global and natives | 5083 // The array construct code is only set for the global and natives |
5084 // builtin Array functions which always have maps. | 5084 // builtin Array functions which always have maps. |
5085 | 5085 |
5086 // Initial map for the builtin Array function should be a map. | 5086 // Initial map for the builtin Array function should be a map. |
5087 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kPrototypeOrInitialMapOffset)); | 5087 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kPrototypeOrInitialMapOffset)); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5723 kStackUnwindSpace, NULL, | 5723 kStackUnwindSpace, NULL, |
5724 MemOperand(fp, 6 * kPointerSize), NULL); | 5724 MemOperand(fp, 6 * kPointerSize), NULL); |
5725 } | 5725 } |
5726 | 5726 |
5727 | 5727 |
5728 #undef __ | 5728 #undef __ |
5729 } // namespace internal | 5729 } // namespace internal |
5730 } // namespace v8 | 5730 } // namespace v8 |
5731 | 5731 |
5732 #endif // V8_TARGET_ARCH_PPC | 5732 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |