Commit acf09252 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Force creation of initial maps upfront.

When encountering a JSFunction, generate its initial map (if
appropriate).  This ensures that we can depend on the initial
map during optimization.

We are not sure about the performance impact of this change, it
might cause regressions.

R=jarin@chromium.org, mslekova@chromium.org

Bug: v8:7790, chromium:875175
Change-Id: I4bbf62e30730f55a53d9bb7eee62c87d820616fb
Reviewed-on: https://chromium-review.googlesource.com/1180970Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55253}
parent 932faf95
......@@ -597,6 +597,8 @@ ObjectData* JSHeapBroker::GetOrCreateData(Handle<Object> object) {
// TODO(neis): Remove these Allow* once we serialize everything upfront.
AllowHandleAllocation handle_allocation;
AllowHandleDereference handle_dereference;
AllowHeapAllocation heap_allocation;
Prepare(object);
data = ObjectData::Serialize(this, object);
}
CHECK_NOT_NULL(data);
......@@ -1056,6 +1058,17 @@ CellRef ModuleRef::GetCell(int cell_index) {
broker()->isolate()));
}
void JSHeapBroker::Prepare(Handle<Object> object) {
if (object->IsJSFunction()) {
Handle<JSFunction> function = Handle<JSFunction>::cast(object);
if (function->has_prototype_slot() &&
(function->IsConstructor() ||
IsResumableFunction(function->shared()->kind()))) {
JSFunction::EnsureHasInitialMap(function);
}
}
}
ObjectRef::ObjectRef(JSHeapBroker* broker, Handle<Object> object) {
switch (broker->mode()) {
case JSHeapBroker::kSerialized:
......
......@@ -458,6 +458,8 @@ class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) {
// TODO(neis): Remove eventually.
HeapObjectType HeapObjectTypeFromMap(Map* map) const;
void Prepare(Handle<Object> object);
void AddData(Handle<Object> object, ObjectData* data);
Isolate* const isolate_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment