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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // Possibly allocate a local context. | 209 // Possibly allocate a local context. |
210 if (info_->num_heap_slots() > 0) { | 210 if (info_->num_heap_slots() > 0) { |
211 Comment(";;; Allocate local context"); | 211 Comment(";;; Allocate local context"); |
212 bool need_write_barrier = true; | 212 bool need_write_barrier = true; |
213 // Argument to NewContext is the function, which is still in edi. | 213 // Argument to NewContext is the function, which is still in edi. |
214 int slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 214 int slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
215 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; | 215 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt; |
216 if (info()->scope()->is_script_scope()) { | 216 if (info()->scope()->is_script_scope()) { |
217 __ push(edi); | 217 __ push(edi); |
218 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); | 218 __ Push(info()->scope()->GetScopeInfo(info()->isolate())); |
219 __ CallRuntime(Runtime::kNewScriptContext, 2); | 219 __ CallRuntime(Runtime::kNewScriptContext); |
220 deopt_mode = Safepoint::kLazyDeopt; | 220 deopt_mode = Safepoint::kLazyDeopt; |
221 } else if (slots <= FastNewContextStub::kMaximumSlots) { | 221 } else if (slots <= FastNewContextStub::kMaximumSlots) { |
222 FastNewContextStub stub(isolate(), slots); | 222 FastNewContextStub stub(isolate(), slots); |
223 __ CallStub(&stub); | 223 __ CallStub(&stub); |
224 // Result of FastNewContextStub is always in new space. | 224 // Result of FastNewContextStub is always in new space. |
225 need_write_barrier = false; | 225 need_write_barrier = false; |
226 } else { | 226 } else { |
227 __ push(edi); | 227 __ push(edi); |
228 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 228 __ CallRuntime(Runtime::kNewFunctionContext); |
229 } | 229 } |
230 RecordSafepoint(deopt_mode); | 230 RecordSafepoint(deopt_mode); |
231 | 231 |
232 // Context is returned in eax. It replaces the context passed to us. | 232 // Context is returned in eax. It replaces the context passed to us. |
233 // It's saved in the stack and kept live in esi. | 233 // It's saved in the stack and kept live in esi. |
234 __ mov(esi, eax); | 234 __ mov(esi, eax); |
235 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); | 235 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); |
236 | 236 |
237 // Copy parameters into context if necessary. | 237 // Copy parameters into context if necessary. |
238 int num_parameters = scope()->num_parameters(); | 238 int num_parameters = scope()->num_parameters(); |
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2885 | 2885 |
2886 | 2886 |
2887 void LCodeGen::DoReturn(LReturn* instr) { | 2887 void LCodeGen::DoReturn(LReturn* instr) { |
2888 if (FLAG_trace && info()->IsOptimizing()) { | 2888 if (FLAG_trace && info()->IsOptimizing()) { |
2889 // Preserve the return value on the stack and rely on the runtime call | 2889 // Preserve the return value on the stack and rely on the runtime call |
2890 // to return the value in the same register. We're leaving the code | 2890 // to return the value in the same register. We're leaving the code |
2891 // managed by the register allocator and tearing down the frame, it's | 2891 // managed by the register allocator and tearing down the frame, it's |
2892 // safe to write to the context register. | 2892 // safe to write to the context register. |
2893 __ push(eax); | 2893 __ push(eax); |
2894 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2894 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2895 __ CallRuntime(Runtime::kTraceExit, 1); | 2895 __ CallRuntime(Runtime::kTraceExit); |
2896 } | 2896 } |
2897 if (dynamic_frame_alignment_) { | 2897 if (dynamic_frame_alignment_) { |
2898 // Fetch the state of the dynamic frame alignment. | 2898 // Fetch the state of the dynamic frame alignment. |
2899 __ mov(edx, Operand(ebp, | 2899 __ mov(edx, Operand(ebp, |
2900 JavaScriptFrameConstants::kDynamicAlignmentStateOffset)); | 2900 JavaScriptFrameConstants::kDynamicAlignmentStateOffset)); |
2901 } | 2901 } |
2902 if (NeedsEagerFrame()) { | 2902 if (NeedsEagerFrame()) { |
2903 __ mov(esp, ebp); | 2903 __ mov(esp, ebp); |
2904 __ pop(ebp); | 2904 __ pop(ebp); |
2905 } | 2905 } |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 // If there is no frame, the context must be in esi. | 3473 // If there is no frame, the context must be in esi. |
3474 DCHECK(result.is(esi)); | 3474 DCHECK(result.is(esi)); |
3475 } | 3475 } |
3476 } | 3476 } |
3477 | 3477 |
3478 | 3478 |
3479 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { | 3479 void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) { |
3480 DCHECK(ToRegister(instr->context()).is(esi)); | 3480 DCHECK(ToRegister(instr->context()).is(esi)); |
3481 __ push(Immediate(instr->hydrogen()->pairs())); | 3481 __ push(Immediate(instr->hydrogen()->pairs())); |
3482 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags()))); | 3482 __ push(Immediate(Smi::FromInt(instr->hydrogen()->flags()))); |
3483 CallRuntime(Runtime::kDeclareGlobals, 2, instr); | 3483 CallRuntime(Runtime::kDeclareGlobals, instr); |
3484 } | 3484 } |
3485 | 3485 |
3486 | 3486 |
3487 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, | 3487 void LCodeGen::CallKnownFunction(Handle<JSFunction> function, |
3488 int formal_parameter_count, int arity, | 3488 int formal_parameter_count, int arity, |
3489 LInstruction* instr) { | 3489 LInstruction* instr) { |
3490 bool dont_adapt_arguments = | 3490 bool dont_adapt_arguments = |
3491 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 3491 formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
3492 bool can_invoke_directly = | 3492 bool can_invoke_directly = |
3493 dont_adapt_arguments || formal_parameter_count == arity; | 3493 dont_adapt_arguments || formal_parameter_count == arity; |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5928 | 5928 |
5929 Label use_cache, call_runtime; | 5929 Label use_cache, call_runtime; |
5930 __ CheckEnumCache(&call_runtime); | 5930 __ CheckEnumCache(&call_runtime); |
5931 | 5931 |
5932 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); | 5932 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset)); |
5933 __ jmp(&use_cache, Label::kNear); | 5933 __ jmp(&use_cache, Label::kNear); |
5934 | 5934 |
5935 // Get the set of properties to enumerate. | 5935 // Get the set of properties to enumerate. |
5936 __ bind(&call_runtime); | 5936 __ bind(&call_runtime); |
5937 __ push(eax); | 5937 __ push(eax); |
5938 CallRuntime(Runtime::kGetPropertyNamesFast, 1, instr); | 5938 CallRuntime(Runtime::kGetPropertyNamesFast, instr); |
5939 | 5939 |
5940 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), | 5940 __ cmp(FieldOperand(eax, HeapObject::kMapOffset), |
5941 isolate()->factory()->meta_map()); | 5941 isolate()->factory()->meta_map()); |
5942 DeoptimizeIf(not_equal, instr, Deoptimizer::kWrongMap); | 5942 DeoptimizeIf(not_equal, instr, Deoptimizer::kWrongMap); |
5943 __ bind(&use_cache); | 5943 __ bind(&use_cache); |
5944 } | 5944 } |
5945 | 5945 |
5946 | 5946 |
5947 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { | 5947 void LCodeGen::DoForInCacheArray(LForInCacheArray* instr) { |
5948 Register map = ToRegister(instr->map()); | 5948 Register map = ToRegister(instr->map()); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6049 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { | 6049 void LCodeGen::DoStoreFrameContext(LStoreFrameContext* instr) { |
6050 Register context = ToRegister(instr->context()); | 6050 Register context = ToRegister(instr->context()); |
6051 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context); | 6051 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context); |
6052 } | 6052 } |
6053 | 6053 |
6054 | 6054 |
6055 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) { | 6055 void LCodeGen::DoAllocateBlockContext(LAllocateBlockContext* instr) { |
6056 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6056 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6057 __ Push(scope_info); | 6057 __ Push(scope_info); |
6058 __ push(ToRegister(instr->function())); | 6058 __ push(ToRegister(instr->function())); |
6059 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6059 CallRuntime(Runtime::kPushBlockContext, instr); |
6060 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6060 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6061 } | 6061 } |
6062 | 6062 |
6063 | 6063 |
6064 #undef __ | 6064 #undef __ |
6065 | 6065 |
6066 } // namespace internal | 6066 } // namespace internal |
6067 } // namespace v8 | 6067 } // namespace v8 |
6068 | 6068 |
6069 #endif // V8_TARGET_ARCH_X87 | 6069 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |