Reviewers: Michael Starzinger,

Message:
This fix fully expands the removed JSFunction::IsOptimizable from
https://codereview.chromium.org/1146423002. I am not sure whether this is the
right fix, but it seems to work.

Description:
Exclude non-optimizable functions from OptimizeFunctionOnNextCall.

BUG=chromium:491481
[email protected]
LOG=n

Please review this at https://codereview.chromium.org/1143223004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -5 lines):
  M src/runtime/runtime-test.cc
  A + test/mjsunit/regress/regress-491481.js


Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index c281b6fd0418d41afd026b3ac11db49364601f84..2c38f12eb77c47f8606d9354d67d575f498d4e51 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -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();
Index: test/mjsunit/regress/regress-491481.js
diff --git a/test/mjsunit/regress/regress-449070.js b/test/mjsunit/regress/regress-491481.js
similarity index 61%
copy from test/mjsunit/regress/regress-449070.js
copy to test/mjsunit/regress/regress-491481.js
index 7a0f0a838cdd25817ab6a2d8f63c1ef9fbe6e526..196b6aeb79fdab0618164b58bb4c0e007056bccb 100644
--- a/test/mjsunit/regress/regress-449070.js
+++ b/test/mjsunit/regress/regress-491481.js
@@ -1,10 +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 {
-  %NormalizeElements(this);
-} catch(e) {
-}
+%OptimizeFunctionOnNextCall(print);
+try {
+  __f_16();
+} catch(e) { print(e); }
+try {
+  __f_10();
+} catch(e) {; }
+} catch(e) {}


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to