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

Unified Diff: src/elements.cc

Issue 11818021: Allocation Info Tracking, continued. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: A partial delta against Toon's previous review Created 7 years, 10 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/builtins.cc ('k') | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index 78dba8567ba2d3316637da0082b9a7b878fccc7e..9deef60619312c58e03cca5d3f8e9c63aff54dfa 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -1985,35 +1985,26 @@ MUST_USE_RESULT MaybeObject* ArrayConstructInitializeElements(
if (obj->IsSmi()) {
int len = Smi::cast(obj)->value();
if (len > 0 && len < JSObject::kInitialMaxFastElementArray) {
- FixedArrayBase* fixed_array;
ElementsKind elements_kind = array->GetElementsKind();
- {
- MaybeObject* maybe_obj;
- if (IsFastDoubleElementsKind(elements_kind)) {
- maybe_obj = heap->AllocateFixedDoubleArrayWithHoles(len);
- } else {
- maybe_obj = heap->AllocateFixedArrayWithHoles(len);
- }
- if (!maybe_obj->To(&fixed_array)) return maybe_obj;
- }
+ MaybeObject* maybe_array = array->Initialize(len, len);
+ if (maybe_array->IsFailure()) return maybe_array;
+
if (!IsFastHoleyElementsKind(elements_kind)) {
elements_kind = GetHoleyElementsKind(elements_kind);
- MaybeObject* maybe_array =
- array->TransitionElementsKind(elements_kind);
+ maybe_array = array->TransitionElementsKind(elements_kind);
if (maybe_array->IsFailure()) return maybe_array;
}
- // We do not use SetContent to skip the unnecessary elements type check.
- array->set_elements(fixed_array);
- array->set_length(Smi::cast(obj));
+
return array;
} else if (len == 0) {
return array->Initialize(JSArray::kPreallocatedArrayElements);
}
}
+
// Take the argument as the length.
- { MaybeObject* maybe_obj = array->Initialize(0);
- if (!maybe_obj->ToObject(&obj)) return maybe_obj;
- }
+ MaybeObject* maybe_obj = array->Initialize(0);
+ if (!maybe_obj->To(&obj)) return maybe_obj;
+
return array->SetElementsLength((*args)[0]);
}
@@ -2029,7 +2020,6 @@ MUST_USE_RESULT MaybeObject* ArrayConstructInitializeElements(
ALLOW_CONVERTED_DOUBLE_ELEMENTS);
if (maybe_object->IsFailure()) return maybe_object;
-
// Allocate an appropriately typed elements array.
MaybeObject* maybe_elms;
ElementsKind elements_kind = array->GetElementsKind();
« no previous file with comments | « src/builtins.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698