Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 9b0e8a4acd0f17f2c7e16d91afe04ac34170dbd8..3451cce9985de46dc5bfcbd43e55607dc78fcf0f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -11954,10 +11954,8 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT |
#endif // ENABLE_DISASSEMBLER |
-Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength( |
- Handle<JSObject> object, |
- int capacity, |
- int length, |
+Handle<FixedArray> JSObject::SetFastElementsCapacity( |
+ Handle<JSObject> object, int capacity, |
SetFastElementsCapacitySmiMode smi_mode) { |
// We should never end in here with a pixel or external array. |
DCHECK(!object->HasExternalArrayElements()); |
@@ -12012,6 +12010,15 @@ Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength( |
object->GetElementsKind(), new_elements); |
} |
+ return new_elements; |
+} |
+ |
+ |
+Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength( |
+ Handle<JSObject> object, int capacity, int length, |
+ SetFastElementsCapacitySmiMode smi_mode) { |
+ Handle<FixedArray> new_elements = |
+ SetFastElementsCapacity(object, capacity, smi_mode); |
if (object->IsJSArray()) { |
Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length)); |
} |
@@ -12019,9 +12026,8 @@ Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength( |
} |
-void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, |
- int capacity, |
- int length) { |
+Handle<FixedArrayBase> JSObject::SetFastDoubleElementsCapacity( |
+ Handle<JSObject> object, int capacity) { |
// We should never end in here with a pixel or external array. |
DCHECK(!object->HasExternalArrayElements()); |
@@ -12051,9 +12057,18 @@ void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object, |
object->GetElementsKind(), elems); |
} |
+ return elems; |
+} |
+ |
+ |
+Handle<FixedArrayBase> JSObject::SetFastDoubleElementsCapacityAndLength( |
+ Handle<JSObject> object, int capacity, int length) { |
+ Handle<FixedArrayBase> new_elements = |
+ SetFastDoubleElementsCapacity(object, capacity); |
if (object->IsJSArray()) { |
Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length)); |
} |
+ return new_elements; |
} |
@@ -13812,9 +13827,8 @@ void JSObject::GetElementsCapacityAndUsage(int* capacity, int* used) { |
} |
-bool JSObject::WouldConvertToSlowElements(Handle<Object> key) { |
- uint32_t index; |
- if (HasFastElements() && key->ToArrayIndex(&index)) { |
+bool JSObject::WouldConvertToSlowElements(uint32_t index) { |
+ if (HasFastElements()) { |
Handle<FixedArrayBase> backing_store(FixedArrayBase::cast(elements())); |
uint32_t capacity = static_cast<uint32_t>(backing_store->length()); |
if (index >= capacity) { |