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

Unified Diff: src/factory.cc

Issue 2126613002: making heap verification more aggressive (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: adding additional validation Created 4 years, 5 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 | « no previous file | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 4140159f9312ffb8ce5c83fa4a536997c99fd8cf..48118fc78e19e35d7f4561c126c3b1df8ae6add5 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1647,19 +1647,29 @@ void Factory::NewJSArrayStorage(Handle<JSArray> array,
Handle<FixedArrayBase> elms;
ElementsKind elements_kind = array->GetElementsKind();
if (IsFastDoubleElementsKind(elements_kind)) {
- if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) {
- elms = NewFixedDoubleArray(capacity);
- } else {
- DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
- elms = NewFixedDoubleArrayWithHoles(capacity);
+ switch (mode) {
+ case DONT_INITIALIZE_ARRAY_ELEMENTS:
+ elms = NewFixedDoubleArray(capacity);
+ break;
+ case INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE:
+ elms = NewFixedDoubleArrayWithHoles(capacity);
+ break;
+ case INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED:
+ UNREACHABLE();
+ break;
}
} else {
DCHECK(IsFastSmiOrObjectElementsKind(elements_kind));
- if (mode == DONT_INITIALIZE_ARRAY_ELEMENTS) {
- elms = NewUninitializedFixedArray(capacity);
- } else {
- DCHECK(mode == INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
- elms = NewFixedArrayWithHoles(capacity);
+ switch (mode) {
+ case DONT_INITIALIZE_ARRAY_ELEMENTS:
+ elms = NewUninitializedFixedArray(capacity);
+ break;
+ case INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE:
+ elms = NewFixedArrayWithHoles(capacity);
+ break;
+ case INITIALIZE_ARRAY_ELEMENTS_WITH_UNDEFINED:
+ elms = NewFixedArray(capacity);
+ break;
}
}
« no previous file with comments | « no previous file | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698