Commit d2e424af authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Avoid unintentional optimization of hot builtins by TurboFan.

R=titzer@chromium.org
TEST=mjsunit/regress/regress-crbug-451016
BUG=chromium:451016
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#26229}
parent 3dc77aac
......@@ -40,6 +40,7 @@ namespace internal {
"BinaryStub_GenerateFloatingPointCode") \
V(kBothRegistersWereSmisInSelectNonSmi, \
"Both registers were smis in SelectNonSmi") \
V(kBuiltinFunctionCannotBeOptimized, "Builtin function cannot be optimized") \
V(kCallToAJavaScriptRuntimeFunction, \
"Call to a JavaScript runtime function") \
V(kCannotTranslatePositionInChangedArea, \
......
......@@ -2510,6 +2510,10 @@ bool Genesis::InstallJSBuiltins(Handle<JSBuiltinsObject> builtins) {
Handle<Object> function_object = Object::GetProperty(
isolate(), builtins, Builtins::GetName(id)).ToHandleChecked();
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
// TODO(mstarzinger): This is just a temporary hack to make TurboFan work,
// the correct solution is to restore the context register after invoking
// builtins from full-codegen.
function->shared()->DisableOptimization(kBuiltinFunctionCannotBeOptimized);
builtins->set_javascript_builtin(id, *function);
if (!Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) {
return false;
......
......@@ -272,7 +272,6 @@ class Builtins {
return names_[index];
}
static int GetArgumentsCount(JavaScript id) { return javascript_argc_[id]; }
Handle<Code> GetCode(JavaScript id, bool* resolved);
static int NumberOfJavaScriptBuiltins() { return id_count; }
bool is_initialized() const { return initialized_; }
......
......@@ -777,7 +777,13 @@ Handle<Code> Pipeline::GenerateCode() {
// TODO(mstarzinger): This is just a temporary hack to make TurboFan work,
// the correct solution is to restore the context register after invoking
// builtins from full-codegen.
if (isolate()->bootstrapper()->IsActive()) return Handle<Code>::null();
Handle<SharedFunctionInfo> shared = info()->shared_info();
if (isolate()->bootstrapper()->IsActive() ||
shared->disable_optimization_reason() ==
kBuiltinFunctionCannotBeOptimized) {
shared->DisableOptimization(kBuiltinFunctionCannotBeOptimized);
return Handle<Code>::null();
}
ZonePool zone_pool(isolate());
SmartPointer<PipelineStatistics> pipeline_statistics;
......
// 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: --turbo-filter=STRICT_EQUALS
var value = NaN;
for (i = 0; i < 256; i++) {
value === "A" || value === "B";
}
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