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/builtins/builtins-constructor.h" | 10 #include "src/builtins/builtins-constructor.h" |
(...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 __ addp(rsp, reg); | 2498 __ addp(rsp, reg); |
2499 __ jmp(return_addr_reg); | 2499 __ jmp(return_addr_reg); |
2500 } | 2500 } |
2501 } | 2501 } |
2502 | 2502 |
2503 | 2503 |
2504 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2504 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2505 Register context = ToRegister(instr->context()); | 2505 Register context = ToRegister(instr->context()); |
2506 Register result = ToRegister(instr->result()); | 2506 Register result = ToRegister(instr->result()); |
2507 __ movp(result, ContextOperand(context, instr->slot_index())); | 2507 __ movp(result, ContextOperand(context, instr->slot_index())); |
2508 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2509 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | |
2510 if (instr->hydrogen()->DeoptimizesOnHole()) { | |
2511 DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); | |
2512 } else { | |
2513 Label is_not_hole; | |
2514 __ j(not_equal, &is_not_hole, Label::kNear); | |
2515 __ LoadRoot(result, Heap::kUndefinedValueRootIndex); | |
2516 __ bind(&is_not_hole); | |
2517 } | |
2518 } | |
2519 } | 2508 } |
2520 | 2509 |
2521 | 2510 |
2522 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2511 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2523 Register context = ToRegister(instr->context()); | 2512 Register context = ToRegister(instr->context()); |
2524 Register value = ToRegister(instr->value()); | 2513 Register value = ToRegister(instr->value()); |
2525 | |
2526 Operand target = ContextOperand(context, instr->slot_index()); | 2514 Operand target = ContextOperand(context, instr->slot_index()); |
2527 | 2515 |
2528 Label skip_assignment; | |
2529 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2530 __ CompareRoot(target, Heap::kTheHoleValueRootIndex); | |
2531 if (instr->hydrogen()->DeoptimizesOnHole()) { | |
2532 DeoptimizeIf(equal, instr, DeoptimizeReason::kHole); | |
2533 } else { | |
2534 __ j(not_equal, &skip_assignment); | |
2535 } | |
2536 } | |
2537 __ movp(target, value); | 2516 __ movp(target, value); |
2538 | |
2539 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2517 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2540 SmiCheck check_needed = | 2518 SmiCheck check_needed = |
2541 instr->hydrogen()->value()->type().IsHeapObject() | 2519 instr->hydrogen()->value()->type().IsHeapObject() |
2542 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2520 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2543 int offset = Context::SlotOffset(instr->slot_index()); | 2521 int offset = Context::SlotOffset(instr->slot_index()); |
2544 Register scratch = ToRegister(instr->temp()); | 2522 Register scratch = ToRegister(instr->temp()); |
2545 __ RecordWriteContextSlot(context, | 2523 __ RecordWriteContextSlot(context, |
2546 offset, | 2524 offset, |
2547 value, | 2525 value, |
2548 scratch, | 2526 scratch, |
2549 kSaveFPRegs, | 2527 kSaveFPRegs, |
2550 EMIT_REMEMBERED_SET, | 2528 EMIT_REMEMBERED_SET, |
2551 check_needed); | 2529 check_needed); |
2552 } | 2530 } |
2553 | |
2554 __ bind(&skip_assignment); | |
2555 } | 2531 } |
2556 | 2532 |
2557 | 2533 |
2558 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2534 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2559 HObjectAccess access = instr->hydrogen()->access(); | 2535 HObjectAccess access = instr->hydrogen()->access(); |
2560 int offset = access.offset(); | 2536 int offset = access.offset(); |
2561 | 2537 |
2562 if (access.IsExternalMemory()) { | 2538 if (access.IsExternalMemory()) { |
2563 Register result = ToRegister(instr->result()); | 2539 Register result = ToRegister(instr->result()); |
2564 if (instr->object()->IsConstantOperand()) { | 2540 if (instr->object()->IsConstantOperand()) { |
(...skipping 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5433 __ bind(deferred->exit()); | 5409 __ bind(deferred->exit()); |
5434 __ bind(&done); | 5410 __ bind(&done); |
5435 } | 5411 } |
5436 | 5412 |
5437 #undef __ | 5413 #undef __ |
5438 | 5414 |
5439 } // namespace internal | 5415 } // namespace internal |
5440 } // namespace v8 | 5416 } // namespace v8 |
5441 | 5417 |
5442 #endif // V8_TARGET_ARCH_X64 | 5418 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |