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 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); | 2686 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
2687 __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. | 2687 __ lw(a2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key. |
2688 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); | 2688 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); |
2689 RecordJSReturnSite(expr); | 2689 RecordJSReturnSite(expr); |
2690 // Restore context register. | 2690 // Restore context register. |
2691 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2691 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2692 context()->DropAndPlug(1, v0); // Drop the key still on the stack. | 2692 context()->DropAndPlug(1, v0); // Drop the key still on the stack. |
2693 } | 2693 } |
2694 | 2694 |
2695 | 2695 |
2696 void FullCodeGenerator::EmitCallWithStub(Call* expr) { | 2696 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
2697 // Code common for calls using the call stub. | 2697 // Code common for calls using the call stub. |
2698 ZoneList<Expression*>* args = expr->arguments(); | 2698 ZoneList<Expression*>* args = expr->arguments(); |
2699 int arg_count = args->length(); | 2699 int arg_count = args->length(); |
2700 { PreservePositionScope scope(masm()->positions_recorder()); | 2700 { PreservePositionScope scope(masm()->positions_recorder()); |
2701 for (int i = 0; i < arg_count; i++) { | 2701 for (int i = 0; i < arg_count; i++) { |
2702 VisitForStackValue(args->at(i)); | 2702 VisitForStackValue(args->at(i)); |
2703 } | 2703 } |
2704 } | 2704 } |
2705 // Record source position for debugger. | 2705 // Record source position for debugger. |
2706 SetSourcePosition(expr->position()); | 2706 SetSourcePosition(expr->position()); |
2707 | 2707 |
| 2708 // Record call targets. |
| 2709 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
2708 Handle<Object> uninitialized = | 2710 Handle<Object> uninitialized = |
2709 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2711 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2710 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2712 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
2711 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2713 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
2712 __ li(a2, Operand(cell)); | 2714 __ li(a2, Operand(cell)); |
2713 | 2715 |
2714 // Record call targets in unoptimized code. | 2716 CallFunctionStub stub(arg_count, flags); |
2715 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | |
2716 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2717 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2717 __ CallStub(&stub, expr->CallFeedbackId()); | 2718 __ CallStub(&stub, expr->CallFeedbackId()); |
2718 RecordJSReturnSite(expr); | 2719 RecordJSReturnSite(expr); |
2719 // Restore context register. | 2720 // Restore context register. |
2720 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2721 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2721 context()->DropAndPlug(1, v0); | 2722 context()->DropAndPlug(1, v0); |
2722 } | 2723 } |
2723 | 2724 |
2724 | 2725 |
2725 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { | 2726 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 __ push(v0); | 2832 __ push(v0); |
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, NO_CALL_FUNCTION_FLAGS); |
2842 } else if (property != NULL) { | 2843 } else if (property != NULL) { |
2843 { PreservePositionScope scope(masm()->positions_recorder()); | 2844 { PreservePositionScope scope(masm()->positions_recorder()); |
2844 VisitForStackValue(property->obj()); | 2845 VisitForStackValue(property->obj()); |
2845 } | 2846 } |
2846 if (property->key()->IsPropertyName()) { | 2847 if (property->key()->IsPropertyName()) { |
2847 EmitCallWithIC(expr, | 2848 EmitCallWithIC(expr, |
2848 property->key()->AsLiteral()->value(), | 2849 property->key()->AsLiteral()->value(), |
2849 NOT_CONTEXTUAL); | 2850 NOT_CONTEXTUAL); |
2850 } else { | 2851 } else { |
2851 EmitKeyedCallWithIC(expr, property->key()); | 2852 EmitKeyedCallWithIC(expr, property->key()); |
2852 } | 2853 } |
2853 } else { | 2854 } else { |
2854 // Call to an arbitrary expression not handled specially above. | 2855 // Call to an arbitrary expression not handled specially above. |
2855 { PreservePositionScope scope(masm()->positions_recorder()); | 2856 { PreservePositionScope scope(masm()->positions_recorder()); |
2856 VisitForStackValue(callee); | 2857 VisitForStackValue(callee); |
2857 } | 2858 } |
2858 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | 2859 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
2859 __ push(a1); | 2860 __ push(a1); |
2860 // Emit function call. | 2861 // Emit function call. |
2861 EmitCallWithStub(expr); | 2862 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
2862 } | 2863 } |
2863 | 2864 |
2864 #ifdef DEBUG | 2865 #ifdef DEBUG |
2865 // RecordJSReturnSite should have been called. | 2866 // RecordJSReturnSite should have been called. |
2866 ASSERT(expr->return_is_recorded_); | 2867 ASSERT(expr->return_is_recorded_); |
2867 #endif | 2868 #endif |
2868 } | 2869 } |
2869 | 2870 |
2870 | 2871 |
2871 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2872 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
(...skipping 2092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4964 Assembler::target_address_at(pc_immediate_load_address)) == | 4965 Assembler::target_address_at(pc_immediate_load_address)) == |
4965 reinterpret_cast<uint32_t>( | 4966 reinterpret_cast<uint32_t>( |
4966 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4967 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4967 return OSR_AFTER_STACK_CHECK; | 4968 return OSR_AFTER_STACK_CHECK; |
4968 } | 4969 } |
4969 | 4970 |
4970 | 4971 |
4971 } } // namespace v8::internal | 4972 } } // namespace v8::internal |
4972 | 4973 |
4973 #endif // V8_TARGET_ARCH_MIPS | 4974 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |