| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 146 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 147 | 147 |
| 148 #ifdef DEBUG | 148 #ifdef DEBUG |
| 149 if (strlen(FLAG_stop_at) > 0 && | 149 if (strlen(FLAG_stop_at) > 0 && |
| 150 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 150 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 151 __ stop("stop-at"); | 151 __ stop("stop-at"); |
| 152 } | 152 } |
| 153 #endif | 153 #endif |
| 154 | 154 |
| 155 // Strict mode functions and builtins need to replace the receiver | 155 // Classic mode functions and builtins need to replace the receiver with the |
| 156 // with undefined when called as functions (without an explicit | 156 // global proxy when called as functions (without an explicit receiver |
| 157 // receiver object). t1 is zero for method calls and non-zero for | 157 // object). |
| 158 // function calls. | 158 if (info->is_classic_mode() && !info->is_native()) { |
| 159 if (!info->is_classic_mode() || info->is_native()) { | |
| 160 Label ok; | 159 Label ok; |
| 161 __ Branch(&ok, eq, t1, Operand(zero_reg)); | |
| 162 int receiver_offset = info->scope()->num_parameters() * kPointerSize; | 160 int receiver_offset = info->scope()->num_parameters() * kPointerSize; |
| 161 __ lw(at, MemOperand(sp, receiver_offset)); |
| 163 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 162 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
| 163 __ Branch(&ok, ne, a2, Operand(at)); |
| 164 |
| 165 __ lw(a2, GlobalObjectOperand()); |
| 166 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); |
| 167 |
| 164 __ sw(a2, MemOperand(sp, receiver_offset)); | 168 __ sw(a2, MemOperand(sp, receiver_offset)); |
| 169 |
| 165 __ bind(&ok); | 170 __ bind(&ok); |
| 166 } | 171 } |
| 167 | 172 |
| 168 // Open a frame scope to indicate that there is a frame on the stack. The | 173 // Open a frame scope to indicate that there is a frame on the stack. The |
| 169 // MANUAL indicates that the scope shouldn't actually generate code to set up | 174 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 170 // the frame (that is done below). | 175 // the frame (that is done below). |
| 171 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 176 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
| 172 | 177 |
| 173 info->set_prologue_offset(masm_->pc_offset()); | 178 info->set_prologue_offset(masm_->pc_offset()); |
| 174 __ Prologue(BUILD_FUNCTION_FRAME); | 179 __ Prologue(BUILD_FUNCTION_FRAME); |
| (...skipping 1951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 break; | 2131 break; |
| 2127 } | 2132 } |
| 2128 } | 2133 } |
| 2129 } | 2134 } |
| 2130 | 2135 |
| 2131 | 2136 |
| 2132 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, | 2137 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
| 2133 Expression *value, | 2138 Expression *value, |
| 2134 JSGeneratorObject::ResumeMode resume_mode) { | 2139 JSGeneratorObject::ResumeMode resume_mode) { |
| 2135 // The value stays in a0, and is ultimately read by the resumed generator, as | 2140 // The value stays in a0, and is ultimately read by the resumed generator, as |
| 2136 // if the CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. a1 | 2141 // if the CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it |
| 2137 // will hold the generator object until the activation has been resumed. | 2142 // is read to throw the value when the resumed generator is already closed. |
| 2143 // a1 will hold the generator object until the activation has been resumed. |
| 2138 VisitForStackValue(generator); | 2144 VisitForStackValue(generator); |
| 2139 VisitForAccumulatorValue(value); | 2145 VisitForAccumulatorValue(value); |
| 2140 __ pop(a1); | 2146 __ pop(a1); |
| 2141 | 2147 |
| 2142 // Check generator state. | 2148 // Check generator state. |
| 2143 Label wrong_state, done; | 2149 Label wrong_state, closed_state, done; |
| 2144 __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); | 2150 __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset)); |
| 2145 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 2151 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting < 0); |
| 2146 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 2152 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed == 0); |
| 2147 __ Branch(&wrong_state, le, a3, Operand(zero_reg)); | 2153 __ Branch(&closed_state, eq, a3, Operand(zero_reg)); |
| 2154 __ Branch(&wrong_state, lt, a3, Operand(zero_reg)); |
| 2148 | 2155 |
| 2149 // Load suspended function and context. | 2156 // Load suspended function and context. |
| 2150 __ lw(cp, FieldMemOperand(a1, JSGeneratorObject::kContextOffset)); | 2157 __ lw(cp, FieldMemOperand(a1, JSGeneratorObject::kContextOffset)); |
| 2151 __ lw(t0, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); | 2158 __ lw(t0, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset)); |
| 2152 | 2159 |
| 2153 // Load receiver and store as the first argument. | 2160 // Load receiver and store as the first argument. |
| 2154 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kReceiverOffset)); | 2161 __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kReceiverOffset)); |
| 2155 __ push(a2); | 2162 __ push(a2); |
| 2156 | 2163 |
| 2157 // Push holes for the rest of the arguments to the generator function. | 2164 // Push holes for the rest of the arguments to the generator function. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2210 __ push(a2); | 2217 __ push(a2); |
| 2211 __ Branch(&push_operand_holes); | 2218 __ Branch(&push_operand_holes); |
| 2212 __ bind(&call_resume); | 2219 __ bind(&call_resume); |
| 2213 ASSERT(!result_register().is(a1)); | 2220 ASSERT(!result_register().is(a1)); |
| 2214 __ Push(a1, result_register()); | 2221 __ Push(a1, result_register()); |
| 2215 __ Push(Smi::FromInt(resume_mode)); | 2222 __ Push(Smi::FromInt(resume_mode)); |
| 2216 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); | 2223 __ CallRuntime(Runtime::kResumeJSGeneratorObject, 3); |
| 2217 // Not reached: the runtime call returns elsewhere. | 2224 // Not reached: the runtime call returns elsewhere. |
| 2218 __ stop("not-reached"); | 2225 __ stop("not-reached"); |
| 2219 | 2226 |
| 2227 // Reach here when generator is closed. |
| 2228 __ bind(&closed_state); |
| 2229 if (resume_mode == JSGeneratorObject::NEXT) { |
| 2230 // Return completed iterator result when generator is closed. |
| 2231 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
| 2232 __ push(a2); |
| 2233 // Pop value from top-of-stack slot; box result into result register. |
| 2234 EmitCreateIteratorResult(true); |
| 2235 } else { |
| 2236 // Throw the provided value. |
| 2237 __ push(a0); |
| 2238 __ CallRuntime(Runtime::kThrow, 1); |
| 2239 } |
| 2240 __ jmp(&done); |
| 2241 |
| 2220 // Throw error if we attempt to operate on a running generator. | 2242 // Throw error if we attempt to operate on a running generator. |
| 2221 __ bind(&wrong_state); | 2243 __ bind(&wrong_state); |
| 2222 __ push(a1); | 2244 __ push(a1); |
| 2223 __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); | 2245 __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); |
| 2224 | 2246 |
| 2225 __ bind(&done); | 2247 __ bind(&done); |
| 2226 context()->Plug(result_register()); | 2248 context()->Plug(result_register()); |
| 2227 } | 2249 } |
| 2228 | 2250 |
| 2229 | 2251 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2619 int arg_count = args->length(); | 2641 int arg_count = args->length(); |
| 2620 { PreservePositionScope scope(masm()->positions_recorder()); | 2642 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2621 for (int i = 0; i < arg_count; i++) { | 2643 for (int i = 0; i < arg_count; i++) { |
| 2622 VisitForStackValue(args->at(i)); | 2644 VisitForStackValue(args->at(i)); |
| 2623 } | 2645 } |
| 2624 __ li(a2, Operand(name)); | 2646 __ li(a2, Operand(name)); |
| 2625 } | 2647 } |
| 2626 // Record source position for debugger. | 2648 // Record source position for debugger. |
| 2627 SetSourcePosition(expr->position()); | 2649 SetSourcePosition(expr->position()); |
| 2628 // Call the IC initialization code. | 2650 // Call the IC initialization code. |
| 2629 Handle<Code> ic = | 2651 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count); |
| 2630 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); | |
| 2631 TypeFeedbackId ast_id = mode == CONTEXTUAL | 2652 TypeFeedbackId ast_id = mode == CONTEXTUAL |
| 2632 ? TypeFeedbackId::None() | 2653 ? TypeFeedbackId::None() |
| 2633 : expr->CallFeedbackId(); | 2654 : expr->CallFeedbackId(); |
| 2634 CallIC(ic, mode, ast_id); | 2655 CallIC(ic, mode, ast_id); |
| 2635 RecordJSReturnSite(expr); | 2656 RecordJSReturnSite(expr); |
| 2636 // Restore context register. | 2657 // Restore context register. |
| 2637 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2658 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2638 context()->Plug(v0); | 2659 context()->Plug(v0); |
| 2639 } | 2660 } |
| 2640 | 2661 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2665 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); | 2686 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
| 2666 __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. | 2687 __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. |
| 2667 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); | 2688 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); |
| 2668 RecordJSReturnSite(expr); | 2689 RecordJSReturnSite(expr); |
| 2669 // Restore context register. | 2690 // Restore context register. |
| 2670 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2691 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2671 context()->DropAndPlug(1, v0); // Drop the key still on the stack. | 2692 context()->DropAndPlug(1, v0); // Drop the key still on the stack. |
| 2672 } | 2693 } |
| 2673 | 2694 |
| 2674 | 2695 |
| 2675 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { | 2696 void FullCodeGenerator::EmitCallWithStub(Call* expr) { |
| 2676 // Code common for calls using the call stub. | 2697 // Code common for calls using the call stub. |
| 2677 ZoneList<Expression*>* args = expr->arguments(); | 2698 ZoneList<Expression*>* args = expr->arguments(); |
| 2678 int arg_count = args->length(); | 2699 int arg_count = args->length(); |
| 2679 { PreservePositionScope scope(masm()->positions_recorder()); | 2700 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2680 for (int i = 0; i < arg_count; i++) { | 2701 for (int i = 0; i < arg_count; i++) { |
| 2681 VisitForStackValue(args->at(i)); | 2702 VisitForStackValue(args->at(i)); |
| 2682 } | 2703 } |
| 2683 } | 2704 } |
| 2684 // Record source position for debugger. | 2705 // Record source position for debugger. |
| 2685 SetSourcePosition(expr->position()); | 2706 SetSourcePosition(expr->position()); |
| 2686 | 2707 |
| 2687 // Record call targets. | |
| 2688 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | |
| 2689 Handle<Object> uninitialized = | 2708 Handle<Object> uninitialized = |
| 2690 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2709 TypeFeedbackCells::UninitializedSentinel(isolate()); |
| 2691 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2710 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
| 2692 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2711 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
| 2693 __ li(a2, Operand(cell)); | 2712 __ li(a2, Operand(cell)); |
| 2694 | 2713 |
| 2695 CallFunctionStub stub(arg_count, flags); | 2714 // Record call targets in unoptimized code. |
| 2715 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
| 2696 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2716 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2697 __ CallStub(&stub, expr->CallFeedbackId()); | 2717 __ CallStub(&stub, expr->CallFeedbackId()); |
| 2698 RecordJSReturnSite(expr); | 2718 RecordJSReturnSite(expr); |
| 2699 // Restore context register. | 2719 // Restore context register. |
| 2700 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2720 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2701 context()->DropAndPlug(1, v0); | 2721 context()->DropAndPlug(1, v0); |
| 2702 } | 2722 } |
| 2703 | 2723 |
| 2704 | 2724 |
| 2705 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2725 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2762 __ push(a1); | 2782 __ push(a1); |
| 2763 EmitResolvePossiblyDirectEval(arg_count); | 2783 EmitResolvePossiblyDirectEval(arg_count); |
| 2764 | 2784 |
| 2765 // The runtime call returns a pair of values in v0 (function) and | 2785 // The runtime call returns a pair of values in v0 (function) and |
| 2766 // v1 (receiver). Touch up the stack with the right values. | 2786 // v1 (receiver). Touch up the stack with the right values. |
| 2767 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2787 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2768 __ sw(v1, MemOperand(sp, arg_count * kPointerSize)); | 2788 __ sw(v1, MemOperand(sp, arg_count * kPointerSize)); |
| 2769 } | 2789 } |
| 2770 // Record source position for debugger. | 2790 // Record source position for debugger. |
| 2771 SetSourcePosition(expr->position()); | 2791 SetSourcePosition(expr->position()); |
| 2772 CallFunctionStub stub(arg_count, RECEIVER_MIGHT_BE_IMPLICIT); | 2792 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); |
| 2773 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2793 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
| 2774 __ CallStub(&stub); | 2794 __ CallStub(&stub); |
| 2775 RecordJSReturnSite(expr); | 2795 RecordJSReturnSite(expr); |
| 2776 // Restore context register. | 2796 // Restore context register. |
| 2777 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2797 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2778 context()->DropAndPlug(1, v0); | 2798 context()->DropAndPlug(1, v0); |
| 2779 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2799 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 2780 // Push global object as receiver for the call IC. | 2800 // Push global object as receiver for the call IC. |
| 2781 __ lw(a0, GlobalObjectOperand()); | 2801 __ lw(a0, GlobalObjectOperand()); |
| 2782 __ push(a0); | 2802 __ push(a0); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2804 // function and receiver and have the slow path jump around this | 2824 // function and receiver and have the slow path jump around this |
| 2805 // code. | 2825 // code. |
| 2806 if (done.is_linked()) { | 2826 if (done.is_linked()) { |
| 2807 Label call; | 2827 Label call; |
| 2808 __ Branch(&call); | 2828 __ Branch(&call); |
| 2809 __ bind(&done); | 2829 __ bind(&done); |
| 2810 // Push function. | 2830 // Push function. |
| 2811 __ push(v0); | 2831 __ push(v0); |
| 2812 // The receiver is implicitly the global receiver. Indicate this | 2832 // The receiver is implicitly the global receiver. Indicate this |
| 2813 // by passing the hole to the call function stub. | 2833 // by passing the hole to the call function stub. |
| 2814 __ LoadRoot(a1, Heap::kTheHoleValueRootIndex); | 2834 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
| 2815 __ push(a1); | 2835 __ push(a1); |
| 2816 __ bind(&call); | 2836 __ bind(&call); |
| 2817 } | 2837 } |
| 2818 | 2838 |
| 2819 // The receiver is either the global receiver or an object found | 2839 // The receiver is either the global receiver or an object found |
| 2820 // by LoadContextSlot. That object could be the hole if the | 2840 // by LoadContextSlot. |
| 2821 // receiver is implicitly the global object. | 2841 EmitCallWithStub(expr); |
| 2822 EmitCallWithStub(expr, RECEIVER_MIGHT_BE_IMPLICIT); | |
| 2823 } else if (property != NULL) { | 2842 } else if (property != NULL) { |
| 2824 { PreservePositionScope scope(masm()->positions_recorder()); | 2843 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2825 VisitForStackValue(property->obj()); | 2844 VisitForStackValue(property->obj()); |
| 2826 } | 2845 } |
| 2827 if (property->key()->IsPropertyName()) { | 2846 if (property->key()->IsPropertyName()) { |
| 2828 EmitCallWithIC(expr, | 2847 EmitCallWithIC(expr, |
| 2829 property->key()->AsLiteral()->value(), | 2848 property->key()->AsLiteral()->value(), |
| 2830 NOT_CONTEXTUAL); | 2849 NOT_CONTEXTUAL); |
| 2831 } else { | 2850 } else { |
| 2832 EmitKeyedCallWithIC(expr, property->key()); | 2851 EmitKeyedCallWithIC(expr, property->key()); |
| 2833 } | 2852 } |
| 2834 } else { | 2853 } else { |
| 2835 // Call to an arbitrary expression not handled specially above. | 2854 // Call to an arbitrary expression not handled specially above. |
| 2836 { PreservePositionScope scope(masm()->positions_recorder()); | 2855 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2837 VisitForStackValue(callee); | 2856 VisitForStackValue(callee); |
| 2838 } | 2857 } |
| 2839 // Push the hole as receiver. | 2858 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
| 2840 // It will be correctly replaced in the call stub. | |
| 2841 __ LoadRoot(a1, Heap::kTheHoleValueRootIndex); | |
| 2842 __ push(a1); | 2859 __ push(a1); |
| 2843 // Emit function call. | 2860 // Emit function call. |
| 2844 EmitCallWithStub(expr, RECEIVER_IS_IMPLICIT); | 2861 EmitCallWithStub(expr); |
| 2845 } | 2862 } |
| 2846 | 2863 |
| 2847 #ifdef DEBUG | 2864 #ifdef DEBUG |
| 2848 // RecordJSReturnSite should have been called. | 2865 // RecordJSReturnSite should have been called. |
| 2849 ASSERT(expr->return_is_recorded_); | 2866 ASSERT(expr->return_is_recorded_); |
| 2850 #endif | 2867 #endif |
| 2851 } | 2868 } |
| 2852 | 2869 |
| 2853 | 2870 |
| 2854 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2871 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 | 3791 |
| 3775 Label runtime, done; | 3792 Label runtime, done; |
| 3776 // Check for non-function argument (including proxy). | 3793 // Check for non-function argument (including proxy). |
| 3777 __ JumpIfSmi(v0, &runtime); | 3794 __ JumpIfSmi(v0, &runtime); |
| 3778 __ GetObjectType(v0, a1, a1); | 3795 __ GetObjectType(v0, a1, a1); |
| 3779 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); | 3796 __ Branch(&runtime, ne, a1, Operand(JS_FUNCTION_TYPE)); |
| 3780 | 3797 |
| 3781 // InvokeFunction requires the function in a1. Move it in there. | 3798 // InvokeFunction requires the function in a1. Move it in there. |
| 3782 __ mov(a1, result_register()); | 3799 __ mov(a1, result_register()); |
| 3783 ParameterCount count(arg_count); | 3800 ParameterCount count(arg_count); |
| 3784 __ InvokeFunction(a1, count, CALL_FUNCTION, | 3801 __ InvokeFunction(a1, count, CALL_FUNCTION, NullCallWrapper()); |
| 3785 NullCallWrapper(), CALL_AS_METHOD); | |
| 3786 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 3802 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 3787 __ jmp(&done); | 3803 __ jmp(&done); |
| 3788 | 3804 |
| 3789 __ bind(&runtime); | 3805 __ bind(&runtime); |
| 3790 __ push(v0); | 3806 __ push(v0); |
| 3791 __ CallRuntime(Runtime::kCall, args->length()); | 3807 __ CallRuntime(Runtime::kCall, args->length()); |
| 3792 __ bind(&done); | 3808 __ bind(&done); |
| 3793 | 3809 |
| 3794 context()->Plug(v0); | 3810 context()->Plug(v0); |
| 3795 } | 3811 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4191 | 4207 |
| 4192 // Push the arguments ("left-to-right"). | 4208 // Push the arguments ("left-to-right"). |
| 4193 int arg_count = args->length(); | 4209 int arg_count = args->length(); |
| 4194 for (int i = 0; i < arg_count; i++) { | 4210 for (int i = 0; i < arg_count; i++) { |
| 4195 VisitForStackValue(args->at(i)); | 4211 VisitForStackValue(args->at(i)); |
| 4196 } | 4212 } |
| 4197 | 4213 |
| 4198 if (expr->is_jsruntime()) { | 4214 if (expr->is_jsruntime()) { |
| 4199 // Call the JS runtime function. | 4215 // Call the JS runtime function. |
| 4200 __ li(a2, Operand(expr->name())); | 4216 __ li(a2, Operand(expr->name())); |
| 4201 ContextualMode mode = NOT_CONTEXTUAL; | 4217 Handle<Code> ic = isolate()->stub_cache()->ComputeCallInitialize(arg_count); |
| 4202 Handle<Code> ic = | 4218 CallIC(ic, NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
| 4203 isolate()->stub_cache()->ComputeCallInitialize(arg_count, mode); | |
| 4204 CallIC(ic, mode, expr->CallRuntimeFeedbackId()); | |
| 4205 // Restore context register. | 4219 // Restore context register. |
| 4206 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4220 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 4207 } else { | 4221 } else { |
| 4208 // Call the C runtime function. | 4222 // Call the C runtime function. |
| 4209 __ CallRuntime(expr->function(), arg_count); | 4223 __ CallRuntime(expr->function(), arg_count); |
| 4210 } | 4224 } |
| 4211 context()->Plug(v0); | 4225 context()->Plug(v0); |
| 4212 } | 4226 } |
| 4213 | 4227 |
| 4214 | 4228 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4950 Assembler::target_address_at(pc_immediate_load_address)) == | 4964 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4951 reinterpret_cast<uint32_t>( | 4965 reinterpret_cast<uint32_t>( |
| 4952 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4966 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4953 return OSR_AFTER_STACK_CHECK; | 4967 return OSR_AFTER_STACK_CHECK; |
| 4954 } | 4968 } |
| 4955 | 4969 |
| 4956 | 4970 |
| 4957 } } // namespace v8::internal | 4971 } } // namespace v8::internal |
| 4958 | 4972 |
| 4959 #endif // V8_TARGET_ARCH_MIPS | 4973 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |