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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.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 3041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3052 Register target = ToRegister(instr->target()); | 3052 Register target = ToRegister(instr->target()); |
3053 generator.BeforeCall(__ CallSize(Operand(target))); | 3053 generator.BeforeCall(__ CallSize(Operand(target))); |
3054 __ add(target, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 3054 __ add(target, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
3055 __ call(target); | 3055 __ call(target); |
3056 } | 3056 } |
3057 generator.AfterCall(); | 3057 generator.AfterCall(); |
3058 } | 3058 } |
3059 } | 3059 } |
3060 | 3060 |
3061 | 3061 |
3062 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | |
3063 DCHECK(ToRegister(instr->function()).is(edi)); | |
3064 DCHECK(ToRegister(instr->result()).is(eax)); | |
3065 | |
3066 // Change context. | |
3067 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | |
3068 | |
3069 // Always initialize new target and number of actual arguments. | |
3070 __ mov(edx, factory()->undefined_value()); | |
3071 __ mov(eax, instr->arity()); | |
3072 | |
3073 bool is_self_call = false; | |
3074 if (instr->hydrogen()->function()->IsConstant()) { | |
3075 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | |
3076 Handle<JSFunction> jsfun = | |
3077 Handle<JSFunction>::cast(fun_const->handle(isolate())); | |
3078 is_self_call = jsfun.is_identical_to(info()->closure()); | |
3079 } | |
3080 | |
3081 if (is_self_call) { | |
3082 __ CallSelf(); | |
3083 } else { | |
3084 __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset)); | |
3085 } | |
3086 | |
3087 RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT); | |
3088 } | |
3089 | |
3090 | |
3091 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3062 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
3092 Register input_reg = ToRegister(instr->value()); | 3063 Register input_reg = ToRegister(instr->value()); |
3093 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), | 3064 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
3094 factory()->heap_number_map()); | 3065 factory()->heap_number_map()); |
3095 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3066 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
3096 | 3067 |
3097 Label slow, allocated, done; | 3068 Label slow, allocated, done; |
3098 Register tmp = input_reg.is(eax) ? ecx : eax; | 3069 Register tmp = input_reg.is(eax) ? ecx : eax; |
3099 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; | 3070 Register tmp2 = tmp.is(ecx) ? edx : input_reg.is(ecx) ? edx : ecx; |
3100 | 3071 |
(...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5225 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context); | 5196 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), context); |
5226 } | 5197 } |
5227 | 5198 |
5228 | 5199 |
5229 #undef __ | 5200 #undef __ |
5230 | 5201 |
5231 } // namespace internal | 5202 } // namespace internal |
5232 } // namespace v8 | 5203 } // namespace v8 |
5233 | 5204 |
5234 #endif // V8_TARGET_ARCH_IA32 | 5205 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |