| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 // Allocate heap number in new space. | 1635 // Allocate heap number in new space. |
| 1636 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | 1636 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, |
| 1637 TAG_OBJECT); | 1637 TAG_OBJECT); |
| 1638 | 1638 |
| 1639 // Set the map. The other fields are left uninitialized. | 1639 // Set the map. The other fields are left uninitialized. |
| 1640 mov(FieldOperand(result, HeapObject::kMapOffset), | 1640 mov(FieldOperand(result, HeapObject::kMapOffset), |
| 1641 Immediate(isolate()->factory()->sliced_one_byte_string_map())); | 1641 Immediate(isolate()->factory()->sliced_one_byte_string_map())); |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 | 1644 |
| 1645 void MacroAssembler::AllocateJSValue(Register result, Register constructor, |
| 1646 Register value, Register scratch, |
| 1647 Label* gc_required) { |
| 1648 DCHECK(!result.is(constructor)); |
| 1649 DCHECK(!result.is(scratch)); |
| 1650 DCHECK(!result.is(value)); |
| 1651 |
| 1652 // Allocate JSValue in new space. |
| 1653 Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); |
| 1654 |
| 1655 // Initialize the JSValue. |
| 1656 LoadGlobalFunctionInitialMap(constructor, scratch); |
| 1657 mov(FieldOperand(result, HeapObject::kMapOffset), scratch); |
| 1658 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); |
| 1659 mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); |
| 1660 mov(FieldOperand(result, JSObject::kElementsOffset), scratch); |
| 1661 mov(FieldOperand(result, JSValue::kValueOffset), value); |
| 1662 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 1663 } |
| 1664 |
| 1665 |
| 1645 // Copy memory, byte-by-byte, from source to destination. Not optimized for | 1666 // Copy memory, byte-by-byte, from source to destination. Not optimized for |
| 1646 // long or aligned copies. The contents of scratch and length are destroyed. | 1667 // long or aligned copies. The contents of scratch and length are destroyed. |
| 1647 // Source and destination are incremented by length. | 1668 // Source and destination are incremented by length. |
| 1648 // Many variants of movsb, loop unrolling, word moves, and indexed operands | 1669 // Many variants of movsb, loop unrolling, word moves, and indexed operands |
| 1649 // have been tried here already, and this is fastest. | 1670 // have been tried here already, and this is fastest. |
| 1650 // A simpler loop is faster on small copies, but 30% slower on large ones. | 1671 // A simpler loop is faster on small copies, but 30% slower on large ones. |
| 1651 // The cld() instruction must have been emitted, to set the direction flag(), | 1672 // The cld() instruction must have been emitted, to set the direction flag(), |
| 1652 // before calling this function. | 1673 // before calling this function. |
| 1653 void MacroAssembler::CopyBytes(Register source, | 1674 void MacroAssembler::CopyBytes(Register source, |
| 1654 Register destination, | 1675 Register destination, |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2967 mov(eax, dividend); | 2988 mov(eax, dividend); |
| 2968 shr(eax, 31); | 2989 shr(eax, 31); |
| 2969 add(edx, eax); | 2990 add(edx, eax); |
| 2970 } | 2991 } |
| 2971 | 2992 |
| 2972 | 2993 |
| 2973 } // namespace internal | 2994 } // namespace internal |
| 2974 } // namespace v8 | 2995 } // namespace v8 |
| 2975 | 2996 |
| 2976 #endif // V8_TARGET_ARCH_X87 | 2997 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |