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 } |
2508 } | 2519 } |
2509 | 2520 |
2510 | 2521 |
2511 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { | 2522 void LCodeGen::DoStoreContextSlot(LStoreContextSlot* instr) { |
2512 Register context = ToRegister(instr->context()); | 2523 Register context = ToRegister(instr->context()); |
2513 Register value = ToRegister(instr->value()); | 2524 Register value = ToRegister(instr->value()); |
| 2525 |
2514 Operand target = ContextOperand(context, instr->slot_index()); | 2526 Operand target = ContextOperand(context, instr->slot_index()); |
2515 | 2527 |
| 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 } |
2516 __ movp(target, value); | 2537 __ movp(target, value); |
| 2538 |
2517 if (instr->hydrogen()->NeedsWriteBarrier()) { | 2539 if (instr->hydrogen()->NeedsWriteBarrier()) { |
2518 SmiCheck check_needed = | 2540 SmiCheck check_needed = |
2519 instr->hydrogen()->value()->type().IsHeapObject() | 2541 instr->hydrogen()->value()->type().IsHeapObject() |
2520 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 2542 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
2521 int offset = Context::SlotOffset(instr->slot_index()); | 2543 int offset = Context::SlotOffset(instr->slot_index()); |
2522 Register scratch = ToRegister(instr->temp()); | 2544 Register scratch = ToRegister(instr->temp()); |
2523 __ RecordWriteContextSlot(context, | 2545 __ RecordWriteContextSlot(context, |
2524 offset, | 2546 offset, |
2525 value, | 2547 value, |
2526 scratch, | 2548 scratch, |
2527 kSaveFPRegs, | 2549 kSaveFPRegs, |
2528 EMIT_REMEMBERED_SET, | 2550 EMIT_REMEMBERED_SET, |
2529 check_needed); | 2551 check_needed); |
2530 } | 2552 } |
| 2553 |
| 2554 __ bind(&skip_assignment); |
2531 } | 2555 } |
2532 | 2556 |
2533 | 2557 |
2534 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { | 2558 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { |
2535 HObjectAccess access = instr->hydrogen()->access(); | 2559 HObjectAccess access = instr->hydrogen()->access(); |
2536 int offset = access.offset(); | 2560 int offset = access.offset(); |
2537 | 2561 |
2538 if (access.IsExternalMemory()) { | 2562 if (access.IsExternalMemory()) { |
2539 Register result = ToRegister(instr->result()); | 2563 Register result = ToRegister(instr->result()); |
2540 if (instr->object()->IsConstantOperand()) { | 2564 if (instr->object()->IsConstantOperand()) { |
(...skipping 2868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5409 __ bind(deferred->exit()); | 5433 __ bind(deferred->exit()); |
5410 __ bind(&done); | 5434 __ bind(&done); |
5411 } | 5435 } |
5412 | 5436 |
5413 #undef __ | 5437 #undef __ |
5414 | 5438 |
5415 } // namespace internal | 5439 } // namespace internal |
5416 } // namespace v8 | 5440 } // namespace v8 |
5417 | 5441 |
5418 #endif // V8_TARGET_ARCH_X64 | 5442 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |