OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.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 3245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3256 Register target = ToRegister(instr->target()); | 3256 Register target = ToRegister(instr->target()); |
3257 generator.BeforeCall(__ CallSize(target)); | 3257 generator.BeforeCall(__ CallSize(target)); |
3258 __ addp(target, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 3258 __ addp(target, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
3259 __ call(target); | 3259 __ call(target); |
3260 } | 3260 } |
3261 generator.AfterCall(); | 3261 generator.AfterCall(); |
3262 } | 3262 } |
3263 } | 3263 } |
3264 | 3264 |
3265 | 3265 |
3266 void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) { | |
3267 DCHECK(ToRegister(instr->function()).is(rdi)); | |
3268 DCHECK(ToRegister(instr->result()).is(rax)); | |
3269 | |
3270 // Change context. | |
3271 __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | |
3272 | |
3273 // Always initialize new target and number of actual arguments. | |
3274 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | |
3275 __ Set(rax, instr->arity()); | |
3276 | |
3277 LPointerMap* pointers = instr->pointer_map(); | |
3278 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | |
3279 | |
3280 bool is_self_call = false; | |
3281 if (instr->hydrogen()->function()->IsConstant()) { | |
3282 Handle<JSFunction> jsfun = Handle<JSFunction>::null(); | |
3283 HConstant* fun_const = HConstant::cast(instr->hydrogen()->function()); | |
3284 jsfun = Handle<JSFunction>::cast(fun_const->handle(isolate())); | |
3285 is_self_call = jsfun.is_identical_to(info()->closure()); | |
3286 } | |
3287 | |
3288 if (is_self_call) { | |
3289 __ CallSelf(); | |
3290 } else { | |
3291 Operand target = FieldOperand(rdi, JSFunction::kCodeEntryOffset); | |
3292 generator.BeforeCall(__ CallSize(target)); | |
3293 __ Call(target); | |
3294 } | |
3295 generator.AfterCall(); | |
3296 } | |
3297 | |
3298 | |
3299 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { | 3266 void LCodeGen::DoDeferredMathAbsTaggedHeapNumber(LMathAbs* instr) { |
3300 Register input_reg = ToRegister(instr->value()); | 3267 Register input_reg = ToRegister(instr->value()); |
3301 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 3268 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
3302 Heap::kHeapNumberMapRootIndex); | 3269 Heap::kHeapNumberMapRootIndex); |
3303 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 3270 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
3304 | 3271 |
3305 Label slow, allocated, done; | 3272 Label slow, allocated, done; |
3306 Register tmp = input_reg.is(rax) ? rcx : rax; | 3273 Register tmp = input_reg.is(rax) ? rcx : rax; |
3307 Register tmp2 = tmp.is(rcx) ? rdx : input_reg.is(rcx) ? rdx : rcx; | 3274 Register tmp2 = tmp.is(rcx) ? rdx : input_reg.is(rcx) ? rdx : rcx; |
3308 | 3275 |
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5547 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), context); | 5514 __ movp(Operand(rbp, StandardFrameConstants::kContextOffset), context); |
5548 } | 5515 } |
5549 | 5516 |
5550 | 5517 |
5551 #undef __ | 5518 #undef __ |
5552 | 5519 |
5553 } // namespace internal | 5520 } // namespace internal |
5554 } // namespace v8 | 5521 } // namespace v8 |
5555 | 5522 |
5556 #endif // V8_TARGET_ARCH_X64 | 5523 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |