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

Unified Diff: src/factory.cc

Issue 1152093003: [strong] create strong array literals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback 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 e5ee73b30f9c667f9f9bb8c7c4cca44698def134..25f7c2633ca0b6ea7619d3e499dfbb7a72dd5b75 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1637,22 +1637,24 @@ 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));
}
-Handle<JSArray> Factory::NewJSArray(ElementsKind elements_kind,
- int length,
- int capacity,
+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;
}
@@ -1661,9 +1663,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