Commit 1b16678f authored by verwaest's avatar verwaest Committed by Commit bot

Properly handle non-JSFunction constructors in CanRetainOtherContext

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27379}
parent 11fb202f
...@@ -438,6 +438,9 @@ bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, ...@@ -438,6 +438,9 @@ bool TypeFeedbackOracle::CanRetainOtherContext(Map* map,
} }
constructor = map->GetConstructor(); constructor = map->GetConstructor();
if (constructor->IsNull()) return false; if (constructor->IsNull()) return false;
// If the constructor is not null or a JSFunction, we have to conservatively
// assume that it may retain a native context.
if (!constructor->IsJSFunction()) return true;
JSFunction* function = JSFunction::cast(constructor); JSFunction* function = JSFunction::cast(constructor);
return CanRetainOtherContext(function, native_context); return CanRetainOtherContext(function, native_context);
} }
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function f() { return f.x; }
f.__proto__ = null;
f.prototype = "";
f();
f();
%OptimizeFunctionOnNextCall(f);
f();
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