Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index 5222bc9c718164d84857c6fa613fc5de4e7e52fe..5f80b4d52f15dde6268c568abace15302ef96e81 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -1676,6 +1676,27 @@ void MacroAssembler::AllocateOneByteSlicedString(Register result, |
} |
+void MacroAssembler::AllocateJSValue(Register result, Register constructor, |
+ Register value, Register scratch, |
+ Label* gc_required) { |
+ DCHECK(!result.is(constructor)); |
+ DCHECK(!result.is(scratch)); |
+ DCHECK(!result.is(value)); |
+ |
+ // Allocate JSValue in new space. |
+ Allocate(JSValue::kSize, result, scratch, no_reg, gc_required, TAG_OBJECT); |
+ |
+ // Initialize the JSValue. |
+ LoadGlobalFunctionInitialMap(constructor, scratch); |
+ mov(FieldOperand(result, HeapObject::kMapOffset), scratch); |
+ LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); |
+ mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); |
+ mov(FieldOperand(result, JSObject::kElementsOffset), scratch); |
+ mov(FieldOperand(result, JSValue::kValueOffset), value); |
+ STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
+} |
+ |
+ |
// Copy memory, byte-by-byte, from source to destination. Not optimized for |
// long or aligned copies. The contents of scratch and length are destroyed. |
// Source and destination are incremented by length. |