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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 } | 1660 } |
1661 | 1661 |
1662 | 1662 |
1663 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { | 1663 void LCodeGen::DoMapEnumLength(LMapEnumLength* instr) { |
1664 Register result = ToRegister(instr->result()); | 1664 Register result = ToRegister(instr->result()); |
1665 Register map = ToRegister(instr->value()); | 1665 Register map = ToRegister(instr->value()); |
1666 __ EnumLength(result, map); | 1666 __ EnumLength(result, map); |
1667 } | 1667 } |
1668 | 1668 |
1669 | 1669 |
| 1670 void LCodeGen::DoDateField(LDateField* instr) { |
| 1671 Register object = ToRegister(instr->date()); |
| 1672 Register result = ToRegister(instr->result()); |
| 1673 Smi* index = instr->index(); |
| 1674 DCHECK(object.is(result)); |
| 1675 DCHECK(object.is(rax)); |
| 1676 |
| 1677 if (FLAG_debug_code) { |
| 1678 __ AssertNotSmi(object); |
| 1679 __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister); |
| 1680 __ Check(equal, kOperandIsNotADate); |
| 1681 } |
| 1682 |
| 1683 if (index->value() == 0) { |
| 1684 __ movp(result, FieldOperand(object, JSDate::kValueOffset)); |
| 1685 } else { |
| 1686 Label runtime, done; |
| 1687 if (index->value() < JSDate::kFirstUncachedField) { |
| 1688 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 1689 Operand stamp_operand = __ ExternalOperand(stamp); |
| 1690 __ movp(kScratchRegister, stamp_operand); |
| 1691 __ cmpp(kScratchRegister, FieldOperand(object, |
| 1692 JSDate::kCacheStampOffset)); |
| 1693 __ j(not_equal, &runtime, Label::kNear); |
| 1694 __ movp(result, FieldOperand(object, JSDate::kValueOffset + |
| 1695 kPointerSize * index->value())); |
| 1696 __ jmp(&done, Label::kNear); |
| 1697 } |
| 1698 __ bind(&runtime); |
| 1699 __ PrepareCallCFunction(2); |
| 1700 __ movp(arg_reg_1, object); |
| 1701 __ Move(arg_reg_2, index, Assembler::RelocInfoNone()); |
| 1702 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 1703 __ bind(&done); |
| 1704 } |
| 1705 } |
| 1706 |
| 1707 |
1670 Operand LCodeGen::BuildSeqStringOperand(Register string, | 1708 Operand LCodeGen::BuildSeqStringOperand(Register string, |
1671 LOperand* index, | 1709 LOperand* index, |
1672 String::Encoding encoding) { | 1710 String::Encoding encoding) { |
1673 if (index->IsConstantOperand()) { | 1711 if (index->IsConstantOperand()) { |
1674 int offset = ToInteger32(LConstantOperand::cast(index)); | 1712 int offset = ToInteger32(LConstantOperand::cast(index)); |
1675 if (encoding == String::TWO_BYTE_ENCODING) { | 1713 if (encoding == String::TWO_BYTE_ENCODING) { |
1676 offset *= kUC16Size; | 1714 offset *= kUC16Size; |
1677 } | 1715 } |
1678 STATIC_ASSERT(kCharSize == 1); | 1716 STATIC_ASSERT(kCharSize == 1); |
1679 return FieldOperand(string, SeqString::kHeaderSize + offset); | 1717 return FieldOperand(string, SeqString::kHeaderSize + offset); |
(...skipping 3981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5661 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5699 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5662 } | 5700 } |
5663 | 5701 |
5664 | 5702 |
5665 #undef __ | 5703 #undef __ |
5666 | 5704 |
5667 } // namespace internal | 5705 } // namespace internal |
5668 } // namespace v8 | 5706 } // namespace v8 |
5669 | 5707 |
5670 #endif // V8_TARGET_ARCH_X64 | 5708 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |