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

Unified Diff: src/factory.cc

Issue 1151853003: [strong] create strong array literals Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix a test Created 5 years, 7 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/factory.h ('k') | src/full-codegen.cc » ('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 e25e6c2c3584a0a8fcfe9c1f4c8df1cabc7ec7f2..70565faadae3ef5499dbe6b4ec3a5696f935dff1 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1632,12 +1632,15 @@ Handle<JSObject> Factory::NewJSObjectFromMap(
Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind,
+ ObjectStrength strength,
PretenureFlag pretenure) {
- Context* native_context = isolate()->context()->native_context();
- JSFunction* array_function = native_context->array_function();
- Map* map = array_function->initial_map();
- Map* transition_map = isolate()->get_initial_js_array_map(elements_kind);
- if (transition_map != NULL) map = transition_map;
+ Map* map = isolate()->get_initial_js_array_map(elements_kind, strength);
+ if (map == nullptr) {
+ DCHECK(strength == WEAK);
+ Context* native_context = isolate()->context()->native_context();
+ JSFunction* array_function = native_context->array_function();
+ map = array_function->initial_map();
+ }
return Handle<JSArray>::cast(NewJSObjectFromMap(handle(map), pretenure));
}
@@ -1645,9 +1648,10 @@ Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind,
Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind,
int length,
int capacity,
+ ObjectStrength strength,
ArrayStorageAllocationMode mode,
PretenureFlag pretenure) {
- Handle<JSArray> array = NewJSArray(elements_kind, pretenure);
+ Handle<JSArray> array = NewJSArray(elements_kind, strength, pretenure);
NewJSArrayStorage(array, length, capacity, mode);
return array;
}
@@ -1656,9 +1660,10 @@ Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind,
Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements,
ElementsKind elements_kind,
int length,
+ ObjectStrength strength,
PretenureFlag pretenure) {
DCHECK(length <= elements->length());
- Handle<JSArray> array = NewJSArray(elements_kind, pretenure);
+ Handle<JSArray> array = NewJSArray(elements_kind, strength, pretenure);
array->set_elements(*elements);
array->set_length(Smi::FromInt(length));
« no previous file with comments | « src/factory.h ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698