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 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // o sp: stack pointer | 131 // o sp: stack pointer |
132 // o ra: return address | 132 // o ra: return address |
133 // | 133 // |
134 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 134 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
135 // frames-mips.h for its layout. | 135 // frames-mips.h for its layout. |
136 void FullCodeGenerator::Generate() { | 136 void FullCodeGenerator::Generate() { |
137 CompilationInfo* info = info_; | 137 CompilationInfo* info = info_; |
138 handler_table_ = | 138 handler_table_ = |
139 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 139 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
140 | 140 |
141 InitializeFeedbackVector(); | |
142 | |
143 profiling_counter_ = isolate()->factory()->NewCell( | 141 profiling_counter_ = isolate()->factory()->NewCell( |
144 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 142 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
145 SetFunctionPosition(function()); | 143 SetFunctionPosition(function()); |
146 Comment cmnt(masm_, "[ function compiled by full code generator"); | 144 Comment cmnt(masm_, "[ function compiled by full code generator"); |
147 | 145 |
148 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 146 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
149 | 147 |
150 #ifdef DEBUG | 148 #ifdef DEBUG |
151 if (strlen(FLAG_stop_at) > 0 && | 149 if (strlen(FLAG_stop_at) > 0 && |
152 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 150 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 __ jmp(&loop); | 1170 __ jmp(&loop); |
1173 | 1171 |
1174 __ bind(&no_descriptors); | 1172 __ bind(&no_descriptors); |
1175 __ Drop(1); | 1173 __ Drop(1); |
1176 __ jmp(&exit); | 1174 __ jmp(&exit); |
1177 | 1175 |
1178 // We got a fixed array in register v0. Iterate through that. | 1176 // We got a fixed array in register v0. Iterate through that. |
1179 Label non_proxy; | 1177 Label non_proxy; |
1180 __ bind(&fixed_array); | 1178 __ bind(&fixed_array); |
1181 | 1179 |
1182 Handle<Object> feedback = Handle<Object>( | |
1183 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), | |
1184 isolate()); | |
1185 StoreFeedbackVectorSlot(slot, feedback); | |
1186 __ li(a1, FeedbackVector()); | 1180 __ li(a1, FeedbackVector()); |
1187 __ li(a2, Operand(Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker))); | 1181 __ li(a2, Operand(TypeFeedbackInfo::MegamorphicSentinel(isolate()))); |
1188 __ sw(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(slot))); | 1182 __ sw(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(slot))); |
1189 | 1183 |
1190 __ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check | 1184 __ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check |
1191 __ lw(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object | 1185 __ lw(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1192 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1186 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1193 __ GetObjectType(a2, a3, a3); | 1187 __ GetObjectType(a2, a3, a3); |
1194 __ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE)); | 1188 __ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE)); |
1195 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1189 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1196 __ bind(&non_proxy); | 1190 __ bind(&non_proxy); |
1197 __ Push(a1, v0); // Smi and array | 1191 __ Push(a1, v0); // Smi and array |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 ZoneList<Expression*>* args = expr->arguments(); | 2720 ZoneList<Expression*>* args = expr->arguments(); |
2727 int arg_count = args->length(); | 2721 int arg_count = args->length(); |
2728 { PreservePositionScope scope(masm()->positions_recorder()); | 2722 { PreservePositionScope scope(masm()->positions_recorder()); |
2729 for (int i = 0; i < arg_count; i++) { | 2723 for (int i = 0; i < arg_count; i++) { |
2730 VisitForStackValue(args->at(i)); | 2724 VisitForStackValue(args->at(i)); |
2731 } | 2725 } |
2732 } | 2726 } |
2733 // Record source position for debugger. | 2727 // Record source position for debugger. |
2734 SetSourcePosition(expr->position()); | 2728 SetSourcePosition(expr->position()); |
2735 | 2729 |
2736 Handle<Object> uninitialized = | |
2737 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
2738 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); | |
2739 __ li(a2, FeedbackVector()); | 2730 __ li(a2, FeedbackVector()); |
2740 __ li(a3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); | 2731 __ li(a3, Operand(Smi::FromInt(expr->CallFeedbackSlot()))); |
2741 | 2732 |
2742 // Record call targets in unoptimized code. | 2733 // Record call targets in unoptimized code. |
2743 CallFunctionStub stub(isolate(), arg_count, RECORD_CALL_TARGET); | 2734 CallFunctionStub stub(isolate(), arg_count, RECORD_CALL_TARGET); |
2744 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2735 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2745 __ CallStub(&stub); | 2736 __ CallStub(&stub); |
2746 RecordJSReturnSite(expr); | 2737 RecordJSReturnSite(expr); |
2747 // Restore context register. | 2738 // Restore context register. |
2748 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2739 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2913 | 2904 |
2914 // Call the construct call builtin that handles allocation and | 2905 // Call the construct call builtin that handles allocation and |
2915 // constructor invocation. | 2906 // constructor invocation. |
2916 SetSourcePosition(expr->position()); | 2907 SetSourcePosition(expr->position()); |
2917 | 2908 |
2918 // Load function and argument count into a1 and a0. | 2909 // Load function and argument count into a1 and a0. |
2919 __ li(a0, Operand(arg_count)); | 2910 __ li(a0, Operand(arg_count)); |
2920 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 2911 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
2921 | 2912 |
2922 // Record call targets in unoptimized code. | 2913 // Record call targets in unoptimized code. |
2923 Handle<Object> uninitialized = | |
2924 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
2925 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); | |
2926 if (FLAG_pretenuring_call_new) { | 2914 if (FLAG_pretenuring_call_new) { |
2927 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), | 2915 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
2928 isolate()->factory()->NewAllocationSite()); | |
2929 ASSERT(expr->AllocationSiteFeedbackSlot() == | 2916 ASSERT(expr->AllocationSiteFeedbackSlot() == |
2930 expr->CallNewFeedbackSlot() + 1); | 2917 expr->CallNewFeedbackSlot() + 1); |
2931 } | 2918 } |
2932 | 2919 |
2933 __ li(a2, FeedbackVector()); | 2920 __ li(a2, FeedbackVector()); |
2934 __ li(a3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); | 2921 __ li(a3, Operand(Smi::FromInt(expr->CallNewFeedbackSlot()))); |
2935 | 2922 |
2936 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); | 2923 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); |
2937 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2924 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
2938 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2925 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4943 Assembler::target_address_at(pc_immediate_load_address)) == | 4930 Assembler::target_address_at(pc_immediate_load_address)) == |
4944 reinterpret_cast<uint32_t>( | 4931 reinterpret_cast<uint32_t>( |
4945 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4932 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4946 return OSR_AFTER_STACK_CHECK; | 4933 return OSR_AFTER_STACK_CHECK; |
4947 } | 4934 } |
4948 | 4935 |
4949 | 4936 |
4950 } } // namespace v8::internal | 4937 } } // namespace v8::internal |
4951 | 4938 |
4952 #endif // V8_TARGET_ARCH_MIPS | 4939 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |