Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 6992051: MIPS: port Fix calls of strict mode function with an implicit receiver. (Closed)
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2692 CpuFeatures::Scope scope(FPU); 2692 CpuFeatures::Scope scope(FPU);
2693 if (!IsMipsSoftFloatABI) { 2693 if (!IsMipsSoftFloatABI) {
2694 Move(f12, dreg); 2694 Move(f12, dreg);
2695 Move(a2, reg); 2695 Move(a2, reg);
2696 } else { 2696 } else {
2697 Move(a2, reg); 2697 Move(a2, reg);
2698 Move(a0, a1, dreg); 2698 Move(a0, a1, dreg);
2699 } 2699 }
2700 } 2700 }
2701 2701
2702
2703 void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) {
2704 // This macro takes the dst register to make the code more readable
2705 // at the call sites. However, the dst register has to be t1 to
2706 // follow the calling convention which requires the call type to be
2707 // in t1.
2708 ASSERT(dst.is(t1));
2709 if (call_kind == CALL_AS_FUNCTION) {
2710 li(dst, Operand(Smi::FromInt(1)));
2711 } else {
2712 li(dst, Operand(Smi::FromInt(0)));
2713 }
2714 }
2715
2716
2702 // ----------------------------------------------------------------------------- 2717 // -----------------------------------------------------------------------------
2703 // JavaScript invokes. 2718 // JavaScript invokes.
2704 2719
2705 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 2720 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
2706 const ParameterCount& actual, 2721 const ParameterCount& actual,
2707 Handle<Code> code_constant, 2722 Handle<Code> code_constant,
2708 Register code_reg, 2723 Register code_reg,
2709 Label* done, 2724 Label* done,
2710 InvokeFlag flag, 2725 InvokeFlag flag,
2711 const CallWrapper& call_wrapper) { 2726 const CallWrapper& call_wrapper,
2727 CallKind call_kind) {
2712 bool definitely_matches = false; 2728 bool definitely_matches = false;
2713 Label regular_invoke; 2729 Label regular_invoke;
2714 2730
2715 // Check whether the expected and actual arguments count match. If not, 2731 // Check whether the expected and actual arguments count match. If not,
2716 // setup registers according to contract with ArgumentsAdaptorTrampoline: 2732 // setup registers according to contract with ArgumentsAdaptorTrampoline:
2717 // a0: actual arguments count 2733 // a0: actual arguments count
2718 // a1: function (passed through to callee) 2734 // a1: function (passed through to callee)
2719 // a2: expected arguments count 2735 // a2: expected arguments count
2720 // a3: callee code entry 2736 // a3: callee code entry
2721 2737
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 if (!definitely_matches) { 2769 if (!definitely_matches) {
2754 if (!code_constant.is_null()) { 2770 if (!code_constant.is_null()) {
2755 li(a3, Operand(code_constant)); 2771 li(a3, Operand(code_constant));
2756 addiu(a3, a3, Code::kHeaderSize - kHeapObjectTag); 2772 addiu(a3, a3, Code::kHeaderSize - kHeapObjectTag);
2757 } 2773 }
2758 2774
2759 Handle<Code> adaptor = 2775 Handle<Code> adaptor =
2760 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2776 isolate()->builtins()->ArgumentsAdaptorTrampoline();
2761 if (flag == CALL_FUNCTION) { 2777 if (flag == CALL_FUNCTION) {
2762 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); 2778 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET));
2779 SetCallKind(t1, call_kind);
2763 Call(adaptor, RelocInfo::CODE_TARGET); 2780 Call(adaptor, RelocInfo::CODE_TARGET);
2764 call_wrapper.AfterCall(); 2781 call_wrapper.AfterCall();
2765 jmp(done); 2782 jmp(done);
2766 } else { 2783 } else {
2784 SetCallKind(t1, call_kind);
2767 Jump(adaptor, RelocInfo::CODE_TARGET); 2785 Jump(adaptor, RelocInfo::CODE_TARGET);
2768 } 2786 }
2769 bind(&regular_invoke); 2787 bind(&regular_invoke);
2770 } 2788 }
2771 } 2789 }
2772 2790
2773 2791
2774 void MacroAssembler::InvokeCode(Register code, 2792 void MacroAssembler::InvokeCode(Register code,
2775 const ParameterCount& expected, 2793 const ParameterCount& expected,
2776 const ParameterCount& actual, 2794 const ParameterCount& actual,
2777 InvokeFlag flag, 2795 InvokeFlag flag,
2778 const CallWrapper& call_wrapper) { 2796 const CallWrapper& call_wrapper,
2797 CallKind call_kind) {
2779 Label done; 2798 Label done;
2780 2799
2781 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag, 2800 InvokePrologue(expected, actual, Handle<Code>::null(), code, &done, flag,
2782 call_wrapper); 2801 call_wrapper, call_kind);
2783 if (flag == CALL_FUNCTION) { 2802 if (flag == CALL_FUNCTION) {
2803 SetCallKind(t1, call_kind);
2784 Call(code); 2804 Call(code);
2785 } else { 2805 } else {
2786 ASSERT(flag == JUMP_FUNCTION); 2806 ASSERT(flag == JUMP_FUNCTION);
2807 SetCallKind(t1, call_kind);
2787 Jump(code); 2808 Jump(code);
2788 } 2809 }
2789 // Continue here if InvokePrologue does handle the invocation due to 2810 // Continue here if InvokePrologue does handle the invocation due to
2790 // mismatched parameter counts. 2811 // mismatched parameter counts.
2791 bind(&done); 2812 bind(&done);
2792 } 2813 }
2793 2814
2794 2815
2795 void MacroAssembler::InvokeCode(Handle<Code> code, 2816 void MacroAssembler::InvokeCode(Handle<Code> code,
2796 const ParameterCount& expected, 2817 const ParameterCount& expected,
2797 const ParameterCount& actual, 2818 const ParameterCount& actual,
2798 RelocInfo::Mode rmode, 2819 RelocInfo::Mode rmode,
2799 InvokeFlag flag) { 2820 InvokeFlag flag,
2821 CallKind call_kind) {
2800 Label done; 2822 Label done;
2801 2823
2802 InvokePrologue(expected, actual, code, no_reg, &done, flag); 2824 InvokePrologue(expected, actual, code, no_reg, &done, flag,
2825 NullCallWrapper(), call_kind);
2803 if (flag == CALL_FUNCTION) { 2826 if (flag == CALL_FUNCTION) {
2827 SetCallKind(t1, call_kind);
2804 Call(code, rmode); 2828 Call(code, rmode);
2805 } else { 2829 } else {
2830 SetCallKind(t1, call_kind);
2806 Jump(code, rmode); 2831 Jump(code, rmode);
2807 } 2832 }
2808 // Continue here if InvokePrologue does handle the invocation due to 2833 // Continue here if InvokePrologue does handle the invocation due to
2809 // mismatched parameter counts. 2834 // mismatched parameter counts.
2810 bind(&done); 2835 bind(&done);
2811 } 2836 }
2812 2837
2813 2838
2814 void MacroAssembler::InvokeFunction(Register function, 2839 void MacroAssembler::InvokeFunction(Register function,
2815 const ParameterCount& actual, 2840 const ParameterCount& actual,
2816 InvokeFlag flag, 2841 InvokeFlag flag,
2817 const CallWrapper& call_wrapper) { 2842 const CallWrapper& call_wrapper,
2843 CallKind call_kind) {
2818 // Contract with called JS functions requires that function is passed in a1. 2844 // Contract with called JS functions requires that function is passed in a1.
2819 ASSERT(function.is(a1)); 2845 ASSERT(function.is(a1));
2820 Register expected_reg = a2; 2846 Register expected_reg = a2;
2821 Register code_reg = a3; 2847 Register code_reg = a3;
2822 2848
2823 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 2849 lw(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
2824 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); 2850 lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
2825 lw(expected_reg, 2851 lw(expected_reg,
2826 FieldMemOperand(code_reg, 2852 FieldMemOperand(code_reg,
2827 SharedFunctionInfo::kFormalParameterCountOffset)); 2853 SharedFunctionInfo::kFormalParameterCountOffset));
2828 sra(expected_reg, expected_reg, kSmiTagSize); 2854 sra(expected_reg, expected_reg, kSmiTagSize);
2829 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 2855 lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
2830 2856
2831 ParameterCount expected(expected_reg); 2857 ParameterCount expected(expected_reg);
2832 InvokeCode(code_reg, expected, actual, flag, call_wrapper); 2858 InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind);
2833 } 2859 }
2834 2860
2835 2861
2836 void MacroAssembler::InvokeFunction(JSFunction* function, 2862 void MacroAssembler::InvokeFunction(JSFunction* function,
2837 const ParameterCount& actual, 2863 const ParameterCount& actual,
2838 InvokeFlag flag) { 2864 InvokeFlag flag) {
2839 ASSERT(function->is_compiled()); 2865 ASSERT(function->is_compiled());
2840 2866
2841 // Get the function and setup the context. 2867 // Get the function and setup the context.
2842 li(a1, Operand(Handle<JSFunction>(function))); 2868 li(a1, Operand(Handle<JSFunction>(function)));
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
4021 opcode == BGTZL); 4047 opcode == BGTZL);
4022 opcode = (cond == eq) ? BEQ : BNE; 4048 opcode = (cond == eq) ? BEQ : BNE;
4023 instr = (instr & ~kOpcodeMask) | opcode; 4049 instr = (instr & ~kOpcodeMask) | opcode;
4024 masm_.emit(instr); 4050 masm_.emit(instr);
4025 } 4051 }
4026 4052
4027 4053
4028 } } // namespace v8::internal 4054 } } // namespace v8::internal
4029 4055
4030 #endif // V8_TARGET_ARCH_MIPS 4056 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698