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 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 | 2748 |
2749 void FullCodeGenerator::VisitCall(Call* expr) { | 2749 void FullCodeGenerator::VisitCall(Call* expr) { |
2750 #ifdef DEBUG | 2750 #ifdef DEBUG |
2751 // We want to verify that RecordJSReturnSite gets called on all paths | 2751 // We want to verify that RecordJSReturnSite gets called on all paths |
2752 // through this function. Avoid early returns. | 2752 // through this function. Avoid early returns. |
2753 expr->return_is_recorded_ = false; | 2753 expr->return_is_recorded_ = false; |
2754 #endif | 2754 #endif |
2755 | 2755 |
2756 Comment cmnt(masm_, "[ Call"); | 2756 Comment cmnt(masm_, "[ Call"); |
2757 Expression* callee = expr->expression(); | 2757 Expression* callee = expr->expression(); |
2758 VariableProxy* proxy = callee->AsVariableProxy(); | 2758 Call::CallType call_type = expr->GetCallType(isolate()); |
2759 Property* property = callee->AsProperty(); | |
2760 | 2759 |
2761 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { | 2760 if (call_type == Call::POSSIBLY_EVAL_CALL) { |
2762 // In a call to eval, we first call %ResolvePossiblyDirectEval to | 2761 // In a call to eval, we first call %ResolvePossiblyDirectEval to |
2763 // resolve the function we need to call and the receiver of the | 2762 // resolve the function we need to call and the receiver of the |
2764 // call. Then we call the resolved function using the given | 2763 // call. Then we call the resolved function using the given |
2765 // arguments. | 2764 // arguments. |
2766 ZoneList<Expression*>* args = expr->arguments(); | 2765 ZoneList<Expression*>* args = expr->arguments(); |
2767 int arg_count = args->length(); | 2766 int arg_count = args->length(); |
2768 | 2767 |
2769 { PreservePositionScope pos_scope(masm()->positions_recorder()); | 2768 { PreservePositionScope pos_scope(masm()->positions_recorder()); |
2770 VisitForStackValue(callee); | 2769 VisitForStackValue(callee); |
2771 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 2770 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
(...skipping 17 matching lines...) Expand all Loading... |
2789 } | 2788 } |
2790 // Record source position for debugger. | 2789 // Record source position for debugger. |
2791 SetSourcePosition(expr->position()); | 2790 SetSourcePosition(expr->position()); |
2792 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); | 2791 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); |
2793 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2792 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2794 __ CallStub(&stub); | 2793 __ CallStub(&stub); |
2795 RecordJSReturnSite(expr); | 2794 RecordJSReturnSite(expr); |
2796 // Restore context register. | 2795 // Restore context register. |
2797 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2796 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2798 context()->DropAndPlug(1, v0); | 2797 context()->DropAndPlug(1, v0); |
2799 } else if (proxy != NULL && proxy->var()->IsUnallocated()) { | 2798 } else if (call_type == Call::GLOBAL_CALL) { |
2800 // Push global object as receiver for the call IC. | 2799 // Push global object as receiver for the call IC. |
2801 __ lw(a0, GlobalObjectOperand()); | 2800 __ lw(a0, GlobalObjectOperand()); |
2802 __ push(a0); | 2801 __ push(a0); |
| 2802 VariableProxy* proxy = callee->AsVariableProxy(); |
2803 EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); | 2803 EmitCallWithIC(expr, proxy->name(), CONTEXTUAL); |
2804 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 2804 } else if (call_type == Call::LOOKUP_SLOT_CALL) { |
2805 // Call to a lookup slot (dynamically introduced variable). | 2805 // Call to a lookup slot (dynamically introduced variable). |
| 2806 VariableProxy* proxy = callee->AsVariableProxy(); |
2806 Label slow, done; | 2807 Label slow, done; |
2807 | 2808 |
2808 { PreservePositionScope scope(masm()->positions_recorder()); | 2809 { PreservePositionScope scope(masm()->positions_recorder()); |
2809 // Generate code for loading from variables potentially shadowed | 2810 // Generate code for loading from variables potentially shadowed |
2810 // by eval-introduced variables. | 2811 // by eval-introduced variables. |
2811 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); | 2812 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); |
2812 } | 2813 } |
2813 | 2814 |
2814 __ bind(&slow); | 2815 __ bind(&slow); |
2815 // Call the runtime to find the function to call (returned in v0) | 2816 // Call the runtime to find the function to call (returned in v0) |
(...skipping 16 matching lines...) Expand all Loading... |
2832 // The receiver is implicitly the global receiver. Indicate this | 2833 // The receiver is implicitly the global receiver. Indicate this |
2833 // by passing the hole to the call function stub. | 2834 // by passing the hole to the call function stub. |
2834 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | 2835 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
2835 __ push(a1); | 2836 __ push(a1); |
2836 __ bind(&call); | 2837 __ bind(&call); |
2837 } | 2838 } |
2838 | 2839 |
2839 // The receiver is either the global receiver or an object found | 2840 // The receiver is either the global receiver or an object found |
2840 // by LoadContextSlot. | 2841 // by LoadContextSlot. |
2841 EmitCallWithStub(expr); | 2842 EmitCallWithStub(expr); |
2842 } else if (property != NULL) { | 2843 } else if (call_type == Call::PROPERTY_CALL) { |
| 2844 Property* property = callee->AsProperty(); |
2843 { PreservePositionScope scope(masm()->positions_recorder()); | 2845 { PreservePositionScope scope(masm()->positions_recorder()); |
2844 VisitForStackValue(property->obj()); | 2846 VisitForStackValue(property->obj()); |
2845 } | 2847 } |
2846 if (property->key()->IsPropertyName()) { | 2848 if (property->key()->IsPropertyName()) { |
2847 EmitCallWithIC(expr, | 2849 EmitCallWithIC(expr, |
2848 property->key()->AsLiteral()->value(), | 2850 property->key()->AsLiteral()->value(), |
2849 NOT_CONTEXTUAL); | 2851 NOT_CONTEXTUAL); |
2850 } else { | 2852 } else { |
2851 EmitKeyedCallWithIC(expr, property->key()); | 2853 EmitKeyedCallWithIC(expr, property->key()); |
2852 } | 2854 } |
2853 } else { | 2855 } else { |
| 2856 ASSERT(call_type == Call::OTHER_CALL); |
2854 // Call to an arbitrary expression not handled specially above. | 2857 // Call to an arbitrary expression not handled specially above. |
2855 { PreservePositionScope scope(masm()->positions_recorder()); | 2858 { PreservePositionScope scope(masm()->positions_recorder()); |
2856 VisitForStackValue(callee); | 2859 VisitForStackValue(callee); |
2857 } | 2860 } |
2858 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | 2861 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
2859 __ push(a1); | 2862 __ push(a1); |
2860 // Emit function call. | 2863 // Emit function call. |
2861 EmitCallWithStub(expr); | 2864 EmitCallWithStub(expr); |
2862 } | 2865 } |
2863 | 2866 |
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4964 Assembler::target_address_at(pc_immediate_load_address)) == | 4967 Assembler::target_address_at(pc_immediate_load_address)) == |
4965 reinterpret_cast<uint32_t>( | 4968 reinterpret_cast<uint32_t>( |
4966 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4969 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4967 return OSR_AFTER_STACK_CHECK; | 4970 return OSR_AFTER_STACK_CHECK; |
4968 } | 4971 } |
4969 | 4972 |
4970 | 4973 |
4971 } } // namespace v8::internal | 4974 } } // namespace v8::internal |
4972 | 4975 |
4973 #endif // V8_TARGET_ARCH_MIPS | 4976 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |