Fix %NeverOptimizeFunction() intrinsic.
authorbmeurer <bmeurer@chromium.org>
Fri, 2 Jan 2015 08:17:50 +0000 (00:17 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 2 Jan 2015 08:18:01 +0000 (08:18 +0000)
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}

src/runtime/runtime-test.cc
test/mjsunit/compiler/regress-445732.js [new file with mode: 0644]

index 9faa2dc..b4b90e2 100644 (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();
 }
diff --git a/test/mjsunit/compiler/regress-445732.js b/test/mjsunit/compiler/regress-445732.js
new file mode 100644 (file)
index 0000000..199a29a
--- /dev/null
@@ -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();