Index: src/layout-descriptor-inl.h |
diff --git a/src/layout-descriptor-inl.h b/src/layout-descriptor-inl.h |
index ba76704d5fc1f5c8883838a61de046268129c0d9..e682cd6eeb672874890c3bc0f39d28a6eaf4fb60 100644 |
--- a/src/layout-descriptor-inl.h |
+++ b/src/layout-descriptor-inl.h |
@@ -22,7 +22,7 @@ Handle<LayoutDescriptor> LayoutDescriptor::New(Isolate* isolate, int length) { |
} |
length = GetSlowModeBackingStoreLength(length); |
return Handle<LayoutDescriptor>::cast( |
- isolate->factory()->NewFixedTypedArray(length, kExternalUint32Array)); |
+ isolate->factory()->NewJSTypedArray(UINT32_ELEMENTS, length)); |
} |
@@ -48,7 +48,7 @@ bool LayoutDescriptor::GetIndexes(int field_index, int* layout_word_index, |
} |
*layout_word_index = field_index / kNumberOfBits; |
- CHECK((!IsSmi() && (*layout_word_index < length())) || |
+ CHECK((!IsSmi() && (*layout_word_index < Smi::cast(length())->value())) || |
(IsSmi() && (*layout_word_index < 1))); |
*layout_bit_index = field_index % kNumberOfBits; |
@@ -123,7 +123,20 @@ bool LayoutDescriptor::IsSlowLayout() { return !IsSmi(); } |
int LayoutDescriptor::capacity() { |
- return IsSlowLayout() ? (length() * kNumberOfBits) : kSmiValueSize; |
+ return IsSlowLayout() ? (Smi::cast(length())->value() * kNumberOfBits) |
+ : kSmiValueSize; |
+} |
+ |
+ |
+uint32_t LayoutDescriptor::get_scalar(int index) { |
+ DCHECK(IsSlowLayout()); |
+ return GcSafeElements()->get_scalar(index); |
+} |
+ |
+ |
+void LayoutDescriptor::set(int index, uint32_t value) { |
+ DCHECK(IsSlowLayout()); |
+ GcSafeElements()->set(index, value); |
} |
@@ -214,6 +227,16 @@ LayoutDescriptor* LayoutDescriptor::Initialize( |
} |
+FixedTypedArray<Uint32ArrayTraits>* LayoutDescriptor::GcSafeElements() { |
+ MapWord map_word = HeapObject::cast(elements())->map_word(); |
+ if (map_word.IsForwardingAddress()) { |
+ return FixedTypedArray<Uint32ArrayTraits>::cast( |
+ map_word.ToForwardingAddress()); |
+ } |
+ return FixedTypedArray<Uint32ArrayTraits>::cast(elements()); |
+} |
+ |
+ |
// InobjectPropertiesHelper is a helper class for querying whether inobject |
// property at offset is Double or not. |
LayoutDescriptorHelper::LayoutDescriptorHelper(Map* map) |