OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 2619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2630 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); | 2630 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); |
2631 } | 2631 } |
2632 | 2632 |
2633 | 2633 |
2634 void CallConstructStub::Generate(MacroAssembler* masm) { | 2634 void CallConstructStub::Generate(MacroAssembler* masm) { |
2635 // a0 : number of arguments | 2635 // a0 : number of arguments |
2636 // a1 : the function to call | 2636 // a1 : the function to call |
2637 // a2 : feedback vector | 2637 // a2 : feedback vector |
2638 // a3 : slot in feedback vector (Smi, for RecordCallTarget) | 2638 // a3 : slot in feedback vector (Smi, for RecordCallTarget) |
2639 // a4 : original constructor (for IsSuperConstructorCall) | 2639 // a4 : original constructor (for IsSuperConstructorCall) |
2640 Label slow, non_function_call; | 2640 |
| 2641 Label non_function; |
2641 // Check that the function is not a smi. | 2642 // Check that the function is not a smi. |
2642 __ JumpIfSmi(a1, &non_function_call); | 2643 __ JumpIfSmi(a1, &non_function); |
2643 // Check that the function is a JSFunction. | 2644 // Check that the function is a JSFunction. |
2644 __ GetObjectType(a1, a5, a5); | 2645 __ GetObjectType(a1, a5, a5); |
2645 __ Branch(&slow, ne, a5, Operand(JS_FUNCTION_TYPE)); | 2646 __ Branch(&non_function, ne, a5, Operand(JS_FUNCTION_TYPE)); |
2646 | 2647 |
2647 if (RecordCallTarget()) { | 2648 if (RecordCallTarget()) { |
2648 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); | 2649 GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
2649 | 2650 |
2650 __ dsrl(at, a3, 32 - kPointerSizeLog2); | 2651 __ dsrl(at, a3, 32 - kPointerSizeLog2); |
2651 __ Daddu(a5, a2, at); | 2652 __ Daddu(a5, a2, at); |
2652 Label feedback_register_initialized; | 2653 Label feedback_register_initialized; |
2653 // Put the AllocationSite from the feedback vector into a2, or undefined. | 2654 // Put the AllocationSite from the feedback vector into a2, or undefined. |
2654 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); | 2655 __ ld(a2, FieldMemOperand(a5, FixedArray::kHeaderSize)); |
2655 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); | 2656 __ ld(a5, FieldMemOperand(a2, AllocationSite::kMapOffset)); |
2656 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2657 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2657 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); | 2658 __ Branch(&feedback_register_initialized, eq, a5, Operand(at)); |
2658 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2659 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
2659 __ bind(&feedback_register_initialized); | 2660 __ bind(&feedback_register_initialized); |
2660 | 2661 |
2661 __ AssertUndefinedOrAllocationSite(a2, a5); | 2662 __ AssertUndefinedOrAllocationSite(a2, a5); |
2662 } | 2663 } |
2663 | 2664 |
2664 // Pass function as original constructor. | 2665 // Pass function as original constructor. |
2665 if (IsSuperConstructorCall()) { | 2666 if (IsSuperConstructorCall()) { |
2666 __ mov(a3, a4); | 2667 __ mov(a3, a4); |
2667 } else { | 2668 } else { |
2668 __ mov(a3, a1); | 2669 __ mov(a3, a1); |
2669 } | 2670 } |
2670 | 2671 |
2671 // Jump to the function-specific construct stub. | 2672 // Tail call to the function-specific construct stub (still in the caller |
2672 Register jmp_reg = a4; | 2673 // context at this point). |
2673 __ ld(jmp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 2674 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
2674 __ ld(jmp_reg, FieldMemOperand(jmp_reg, | 2675 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); |
2675 SharedFunctionInfo::kConstructStubOffset)); | 2676 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
2676 __ Daddu(at, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
2677 __ Jump(at); | 2677 __ Jump(at); |
2678 | 2678 |
2679 // a0: number of arguments | 2679 __ bind(&non_function); |
2680 // a1: called object | 2680 __ mov(a3, a1); |
2681 // a5: object type | 2681 __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
2682 __ bind(&slow); | |
2683 { | |
2684 __ Branch(&non_function_call, ne, a5, Operand(JS_FUNCTION_PROXY_TYPE)); | |
2685 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | |
2686 __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset)); | |
2687 __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | |
2688 | |
2689 __ bind(&non_function_call); | |
2690 { | |
2691 // Determine the delegate for the target (if any). | |
2692 FrameScope scope(masm, StackFrame::INTERNAL); | |
2693 __ SmiTag(a0); | |
2694 __ Push(a0, a1); | |
2695 __ CallRuntime(Runtime::kGetConstructorDelegate, 1); | |
2696 __ mov(a1, v0); | |
2697 __ Pop(a0); | |
2698 __ SmiUntag(a0); | |
2699 } | |
2700 // The delegate is always a regular function. | |
2701 __ AssertFunction(a1); | |
2702 __ Jump(masm->isolate()->builtins()->CallFunction(), | |
2703 RelocInfo::CODE_TARGET); | |
2704 } | |
2705 } | 2682 } |
2706 | 2683 |
2707 | 2684 |
2708 // StringCharCodeAtGenerator. | 2685 // StringCharCodeAtGenerator. |
2709 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 2686 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
2710 DCHECK(!a4.is(index_)); | 2687 DCHECK(!a4.is(index_)); |
2711 DCHECK(!a4.is(result_)); | 2688 DCHECK(!a4.is(result_)); |
2712 DCHECK(!a4.is(object_)); | 2689 DCHECK(!a4.is(object_)); |
2713 | 2690 |
2714 // If the receiver is a smi trigger the non-string case. | 2691 // If the receiver is a smi trigger the non-string case. |
(...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5775 MemOperand(fp, 6 * kPointerSize), NULL); | 5752 MemOperand(fp, 6 * kPointerSize), NULL); |
5776 } | 5753 } |
5777 | 5754 |
5778 | 5755 |
5779 #undef __ | 5756 #undef __ |
5780 | 5757 |
5781 } // namespace internal | 5758 } // namespace internal |
5782 } // namespace v8 | 5759 } // namespace v8 |
5783 | 5760 |
5784 #endif // V8_TARGET_ARCH_MIPS64 | 5761 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |