Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: src/objects.cc

Issue 1193343002: Move SetFastDoubleElementsCapacity into GrowCapacityAndConvert (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index aea8c3ba92464212fa57ab705134e90cfa12cb5b..96ec232c78d3ae60c9f62921eb44467872f1cc5c 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11849,49 +11849,14 @@ Handle<FixedArray> JSObject::SetFastElementsCapacityAndLength(
}
-Handle<FixedArrayBase> JSObject::SetFastDoubleElementsCapacity(
- Handle<JSObject> object, int capacity) {
- // We should never end in here with a pixel or external array.
- DCHECK(!object->HasExternalArrayElements());
-
- Handle<FixedArrayBase> elems =
- object->GetIsolate()->factory()->NewFixedDoubleArray(capacity);
-
- ElementsKind elements_kind = object->GetElementsKind();
- CHECK(elements_kind != SLOPPY_ARGUMENTS_ELEMENTS);
- ElementsKind new_elements_kind = elements_kind;
- if (IsHoleyElementsKind(elements_kind)) {
- new_elements_kind = FAST_HOLEY_DOUBLE_ELEMENTS;
- } else {
- new_elements_kind = FAST_DOUBLE_ELEMENTS;
- }
-
- Handle<Map> new_map = GetElementsTransitionMap(object, new_elements_kind);
-
- Handle<FixedArrayBase> old_elements(object->elements());
+void JSObject::SetFastDoubleElementsCapacityAndLength(Handle<JSObject> object,
+ int capacity,
+ int length) {
ElementsAccessor* accessor = ElementsAccessor::ForKind(FAST_DOUBLE_ELEMENTS);
- accessor->CopyElements(object, elems, elements_kind);
-
- JSObject::ValidateElements(object);
- JSObject::SetMapAndElements(object, new_map, elems);
-
- if (FLAG_trace_elements_transitions) {
- PrintElementsTransition(stdout, object, elements_kind, old_elements,
- object->GetElementsKind(), elems);
- }
-
- return elems;
-}
-
-
-Handle<FixedArrayBase> JSObject::SetFastDoubleElementsCapacityAndLength(
- Handle<JSObject> object, int capacity, int length) {
- Handle<FixedArrayBase> new_elements =
- SetFastDoubleElementsCapacity(object, capacity);
+ accessor->GrowCapacityAndConvert(object, capacity);
if (object->IsJSArray()) {
Handle<JSArray>::cast(object)->set_length(Smi::FromInt(length));
}
- return new_elements;
}
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698