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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // o fp: our caller's frame pointer | 131 // o fp: our caller's frame pointer |
132 // o sp: stack pointer | 132 // o sp: stack pointer |
133 // o ra: return address | 133 // o ra: return address |
134 // | 134 // |
135 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 135 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
136 // frames-mips.h for its layout. | 136 // frames-mips.h for its layout. |
137 void FullCodeGenerator::Generate() { | 137 void FullCodeGenerator::Generate() { |
138 CompilationInfo* info = info_; | 138 CompilationInfo* info = info_; |
139 handler_table_ = | 139 handler_table_ = |
140 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 140 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
141 profiling_counter_ = isolate()->factory()->NewJSGlobalPropertyCell( | 141 profiling_counter_ = isolate()->factory()->NewPropertyCell( |
142 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 142 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
143 SetFunctionPosition(function()); | 143 SetFunctionPosition(function()); |
144 Comment cmnt(masm_, "[ function compiled by full code generator"); | 144 Comment cmnt(masm_, "[ function compiled by full code generator"); |
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"); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 | 320 |
321 void FullCodeGenerator::ClearAccumulator() { | 321 void FullCodeGenerator::ClearAccumulator() { |
322 ASSERT(Smi::FromInt(0) == 0); | 322 ASSERT(Smi::FromInt(0) == 0); |
323 __ mov(v0, zero_reg); | 323 __ mov(v0, zero_reg); |
324 } | 324 } |
325 | 325 |
326 | 326 |
327 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { | 327 void FullCodeGenerator::EmitProfilingCounterDecrement(int delta) { |
328 __ li(a2, Operand(profiling_counter_)); | 328 __ li(a2, Operand(profiling_counter_)); |
329 __ lw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 329 __ lw(a3, FieldMemOperand(a2, PropertyCell::kValueOffset)); |
330 __ Subu(a3, a3, Operand(Smi::FromInt(delta))); | 330 __ Subu(a3, a3, Operand(Smi::FromInt(delta))); |
331 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 331 __ sw(a3, FieldMemOperand(a2, PropertyCell::kValueOffset)); |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 void FullCodeGenerator::EmitProfilingCounterReset() { | 335 void FullCodeGenerator::EmitProfilingCounterReset() { |
336 int reset_value = FLAG_interrupt_budget; | 336 int reset_value = FLAG_interrupt_budget; |
337 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { | 337 if (info_->ShouldSelfOptimize() && !FLAG_retry_self_opt) { |
338 // Self-optimization is a one-off thing: if it fails, don't try again. | 338 // Self-optimization is a one-off thing: if it fails, don't try again. |
339 reset_value = Smi::kMaxValue; | 339 reset_value = Smi::kMaxValue; |
340 } | 340 } |
341 if (isolate()->IsDebuggerActive()) { | 341 if (isolate()->IsDebuggerActive()) { |
342 // Detect debug break requests as soon as possible. | 342 // Detect debug break requests as soon as possible. |
343 reset_value = FLAG_interrupt_budget >> 4; | 343 reset_value = FLAG_interrupt_budget >> 4; |
344 } | 344 } |
345 __ li(a2, Operand(profiling_counter_)); | 345 __ li(a2, Operand(profiling_counter_)); |
346 __ li(a3, Operand(Smi::FromInt(reset_value))); | 346 __ li(a3, Operand(Smi::FromInt(reset_value))); |
347 __ sw(a3, FieldMemOperand(a2, JSGlobalPropertyCell::kValueOffset)); | 347 __ sw(a3, FieldMemOperand(a2, PropertyCell::kValueOffset)); |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, | 351 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, |
352 Label* back_edge_target) { | 352 Label* back_edge_target) { |
353 // The generated code is used in Deoptimizer::PatchStackCheckCodeAt so we need | 353 // The generated code is used in Deoptimizer::PatchStackCheckCodeAt so we need |
354 // to make sure it is constant. Branch may emit a skip-or-jump sequence | 354 // to make sure it is constant. Branch may emit a skip-or-jump sequence |
355 // instead of the normal Branch. It seems that the "skip" part of that | 355 // instead of the normal Branch. It seems that the "skip" part of that |
356 // sequence is about as long as this Branch would be so it is safe to ignore | 356 // sequence is about as long as this Branch would be so it is safe to ignore |
357 // that. | 357 // that. |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 __ jmp(&loop); | 1157 __ jmp(&loop); |
1158 | 1158 |
1159 __ bind(&no_descriptors); | 1159 __ bind(&no_descriptors); |
1160 __ Drop(1); | 1160 __ Drop(1); |
1161 __ jmp(&exit); | 1161 __ jmp(&exit); |
1162 | 1162 |
1163 // We got a fixed array in register v0. Iterate through that. | 1163 // We got a fixed array in register v0. Iterate through that. |
1164 Label non_proxy; | 1164 Label non_proxy; |
1165 __ bind(&fixed_array); | 1165 __ bind(&fixed_array); |
1166 | 1166 |
1167 Handle<JSGlobalPropertyCell> cell = | 1167 Handle<PropertyCell> cell = isolate()->factory()->NewPropertyCell( |
1168 isolate()->factory()->NewJSGlobalPropertyCell( | 1168 Handle<Object>(Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), |
1169 Handle<Object>( | 1169 isolate())); |
1170 Smi::FromInt(TypeFeedbackCells::kForInFastCaseMarker), | |
1171 isolate())); | |
1172 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); | 1170 RecordTypeFeedbackCell(stmt->ForInFeedbackId(), cell); |
1173 __ LoadHeapObject(a1, cell); | 1171 __ LoadHeapObject(a1, cell); |
1174 __ li(a2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); | 1172 __ li(a2, Operand(Smi::FromInt(TypeFeedbackCells::kForInSlowCaseMarker))); |
1175 __ sw(a2, FieldMemOperand(a1, JSGlobalPropertyCell::kValueOffset)); | 1173 __ sw(a2, FieldMemOperand(a1, PropertyCell::kValueOffset)); |
1176 | 1174 |
1177 __ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check | 1175 __ li(a1, Operand(Smi::FromInt(1))); // Smi indicates slow check |
1178 __ lw(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object | 1176 __ lw(a2, MemOperand(sp, 0 * kPointerSize)); // Get enumerated object |
1179 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1177 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
1180 __ GetObjectType(a2, a3, a3); | 1178 __ GetObjectType(a2, a3, a3); |
1181 __ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE)); | 1179 __ Branch(&non_proxy, gt, a3, Operand(LAST_JS_PROXY_TYPE)); |
1182 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy | 1180 __ li(a1, Operand(Smi::FromInt(0))); // Zero indicates proxy |
1183 __ bind(&non_proxy); | 1181 __ bind(&non_proxy); |
1184 __ Push(a1, v0); // Smi and array | 1182 __ Push(a1, v0); // Smi and array |
1185 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); | 1183 __ lw(a1, FieldMemOperand(v0, FixedArray::kLengthOffset)); |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 VisitForStackValue(args->at(i)); | 2693 VisitForStackValue(args->at(i)); |
2696 } | 2694 } |
2697 } | 2695 } |
2698 // Record source position for debugger. | 2696 // Record source position for debugger. |
2699 SetSourcePosition(expr->position()); | 2697 SetSourcePosition(expr->position()); |
2700 | 2698 |
2701 // Record call targets. | 2699 // Record call targets. |
2702 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | 2700 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
2703 Handle<Object> uninitialized = | 2701 Handle<Object> uninitialized = |
2704 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2702 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2705 Handle<JSGlobalPropertyCell> cell = | 2703 Handle<PropertyCell> cell = |
2706 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | 2704 isolate()->factory()->PropertyCell(uninitialized); |
2707 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2705 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
2708 __ li(a2, Operand(cell)); | 2706 __ li(a2, Operand(cell)); |
2709 | 2707 |
2710 CallFunctionStub stub(arg_count, flags); | 2708 CallFunctionStub stub(arg_count, flags); |
2711 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 2709 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
2712 __ CallStub(&stub, expr->CallFeedbackId()); | 2710 __ CallStub(&stub, expr->CallFeedbackId()); |
2713 RecordJSReturnSite(expr); | 2711 RecordJSReturnSite(expr); |
2714 // Restore context register. | 2712 // Restore context register. |
2715 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2713 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2716 context()->DropAndPlug(1, v0); | 2714 context()->DropAndPlug(1, v0); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2890 // constructor invocation. | 2888 // constructor invocation. |
2891 SetSourcePosition(expr->position()); | 2889 SetSourcePosition(expr->position()); |
2892 | 2890 |
2893 // Load function and argument count into a1 and a0. | 2891 // Load function and argument count into a1 and a0. |
2894 __ li(a0, Operand(arg_count)); | 2892 __ li(a0, Operand(arg_count)); |
2895 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); | 2893 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
2896 | 2894 |
2897 // Record call targets in unoptimized code. | 2895 // Record call targets in unoptimized code. |
2898 Handle<Object> uninitialized = | 2896 Handle<Object> uninitialized = |
2899 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2897 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2900 Handle<JSGlobalPropertyCell> cell = | 2898 Handle<PropertyCell> cell = |
2901 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | 2899 isolate()->factory()->NewPropertyCell(uninitialized); |
2902 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); | 2900 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); |
2903 __ li(a2, Operand(cell)); | 2901 __ li(a2, Operand(cell)); |
2904 | 2902 |
2905 CallConstructStub stub(RECORD_CALL_TARGET); | 2903 CallConstructStub stub(RECORD_CALL_TARGET); |
2906 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2904 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2907 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2905 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2908 context()->Plug(v0); | 2906 context()->Plug(v0); |
2909 } | 2907 } |
2910 | 2908 |
2911 | 2909 |
(...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4953 *context_length = 0; | 4951 *context_length = 0; |
4954 return previous_; | 4952 return previous_; |
4955 } | 4953 } |
4956 | 4954 |
4957 | 4955 |
4958 #undef __ | 4956 #undef __ |
4959 | 4957 |
4960 } } // namespace v8::internal | 4958 } } // namespace v8::internal |
4961 | 4959 |
4962 #endif // V8_TARGET_ARCH_MIPS | 4960 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |