| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 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 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 // Allocate heap number in new space. | 1669 // Allocate heap number in new space. |
| 1670 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | 1670 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, |
| 1671 TAG_OBJECT); | 1671 TAG_OBJECT); |
| 1672 | 1672 |
| 1673 // Set the map. The other fields are left uninitialized. | 1673 // Set the map. The other fields are left uninitialized. |
| 1674 mov(FieldOperand(result, HeapObject::kMapOffset), | 1674 mov(FieldOperand(result, HeapObject::kMapOffset), |
| 1675 Immediate(isolate()->factory()->sliced_one_byte_string_map())); | 1675 Immediate(isolate()->factory()->sliced_one_byte_string_map())); |
| 1676 } | 1676 } |
| 1677 | 1677 |
| 1678 | 1678 |
| 1679 void MacroAssembler::AllocateJSValue(Register result, Register constructor, |
| 1680 Register value, Register scratch, |
| 1681 Label* gc_required) { |
| 1682 DCHECK(!result.is(constructor)); |
| 1683 DCHECK(!result.is(scratch)); |
| 1684 DCHECK(!result.is(value)); |
| 1685 |
| 1686 // Allocate JSValue in new space. |
| 1687 Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); |
| 1688 |
| 1689 // Initialize the JSValue. |
| 1690 LoadGlobalFunctionInitialMap(constructor, scratch); |
| 1691 mov(FieldOperand(result, HeapObject::kMapOffset), scratch); |
| 1692 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); |
| 1693 mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); |
| 1694 mov(FieldOperand(result, JSObject::kElementsOffset), scratch); |
| 1695 mov(FieldOperand(result, JSValue::kValueOffset), value); |
| 1696 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 1697 } |
| 1698 |
| 1699 |
| 1679 // Copy memory, byte-by-byte, from source to destination. Not optimized for | 1700 // Copy memory, byte-by-byte, from source to destination. Not optimized for |
| 1680 // long or aligned copies. The contents of scratch and length are destroyed. | 1701 // long or aligned copies. The contents of scratch and length are destroyed. |
| 1681 // Source and destination are incremented by length. | 1702 // Source and destination are incremented by length. |
| 1682 // Many variants of movsb, loop unrolling, word moves, and indexed operands | 1703 // Many variants of movsb, loop unrolling, word moves, and indexed operands |
| 1683 // have been tried here already, and this is fastest. | 1704 // have been tried here already, and this is fastest. |
| 1684 // A simpler loop is faster on small copies, but 30% slower on large ones. | 1705 // A simpler loop is faster on small copies, but 30% slower on large ones. |
| 1685 // The cld() instruction must have been emitted, to set the direction flag(), | 1706 // The cld() instruction must have been emitted, to set the direction flag(), |
| 1686 // before calling this function. | 1707 // before calling this function. |
| 1687 void MacroAssembler::CopyBytes(Register source, | 1708 void MacroAssembler::CopyBytes(Register source, |
| 1688 Register destination, | 1709 Register destination, |
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3095 mov(eax, dividend); | 3116 mov(eax, dividend); |
| 3096 shr(eax, 31); | 3117 shr(eax, 31); |
| 3097 add(edx, eax); | 3118 add(edx, eax); |
| 3098 } | 3119 } |
| 3099 | 3120 |
| 3100 | 3121 |
| 3101 } // namespace internal | 3122 } // namespace internal |
| 3102 } // namespace v8 | 3123 } // namespace v8 |
| 3103 | 3124 |
| 3104 #endif // V8_TARGET_ARCH_IA32 | 3125 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |