Fix %NeverOptimizeFunction() intrinsic.

Set a valid reason for disabling optimization when using
%NeverOptimizeFunction.

TEST=mjsunit/compiler/regress-445732
BUG=chromium:445732
LOG=y
TBR=machenbach@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#25949}
This commit is contained in:
bmeurer 2015-01-02 00:17:50 -08:00 committed by Commit bot
parent 643ed5b8be
commit a64ac4575a
2 changed files with 12 additions and 0 deletions

View File

@ -94,6 +94,7 @@ RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, function, 0);
function->shared()->set_disable_optimization_reason(kOptimizationDisabled);
function->shared()->set_optimization_disabled(true);
return isolate->heap()->undefined_value();
}

View File

@ -0,0 +1,11 @@
// Copyright 2014 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 --turbo-asm
"use asm";
%NeverOptimizeFunction(f);
function f() { }
f();