Commit 7332d106 authored by Adam Klein's avatar Adam Klein

Fix SharedFunctionInfo::name flattening nosnap failures

The name must be flattened before allocating the SFI to avoid the GC
seeing the uninitialized state.

BUG=v8:4659
LOG=n
TBR=rossberg@chromium.org

Review URL: https://codereview.chromium.org/1688043005 .

Cr-Commit-Position: refs/heads/master@{#33920}
parent f539f5c8
......@@ -2119,11 +2119,14 @@ Handle<JSMessageObject> Factory::NewJSMessageObject(
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
Handle<String> name, MaybeHandle<Code> maybe_code, bool is_constructor) {
// Function names are assumed to be flat elsewhere. Must flatten before
// allocating SharedFunctionInfo to avoid GC seeing the uninitialized SFI.
name = String::Flatten(name, TENURED);
Handle<Map> map = shared_function_info_map();
Handle<SharedFunctionInfo> share = New<SharedFunctionInfo>(map, OLD_SPACE);
// Set pointer fields.
name = String::Flatten(name, TENURED);
share->set_name(*name);
Handle<Code> code;
if (!maybe_code.ToHandle(&code)) {
......
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