Exclude non-optimizable functions from OptimizeFunctionOnNextCall.
authorjarin <jarin@chromium.org>
Tue, 26 May 2015 08:46:57 +0000 (01:46 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 26 May 2015 08:47:04 +0000 (08:47 +0000)
BUG=chromium:491481
R=mstarzinger@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#28614}

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

index c281b6f..2c38f12 100644 (file)
@@ -88,7 +88,8 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
   // The following assertion was lifted from the DCHECK inside
   // JSFunction::MarkForOptimization().
   RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
-                 !function->shared()->optimization_disabled());
+                 (function->code()->kind() == Code::FUNCTION &&
+                  !function->shared()->optimization_disabled()));
 
   // If the function is already optimized, just return.
   if (function->IsOptimized()) return isolate->heap()->undefined_value();
diff --git a/test/mjsunit/regress/regress-491481.js b/test/mjsunit/regress/regress-491481.js
new file mode 100644 (file)
index 0000000..196b6ae
--- /dev/null
@@ -0,0 +1,15 @@
+// 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
+
+try {
+%OptimizeFunctionOnNextCall(print);
+try {
+  __f_16();
+} catch(e) { print(e); }
+try {
+  __f_10();
+} catch(e) {; }
+} catch(e) {}