Revision: 21622
Author:   [email protected]
Date:     Tue Jun  3 07:45:40 2014 UTC
Log: When flag --nouse-osr is set, don't allow osr from hidden runtime calls.

BUG=379770
[email protected]
LOG=N

Review URL: https://codereview.chromium.org/310773003
http://code.google.com/p/v8/source/detail?r=21622

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-379770.js
Modified:
 /branches/bleeding_edge/src/runtime.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-379770.js Tue Jun 3 07:45:40 2014 UTC
@@ -0,0 +1,26 @@
+// 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 --nostress-opt
+// Flags: --nouse-osr
+
+function foo(obj) {
+  var counter = 1;
+  for (var i = 0; i < obj.length; i++) {
+    %OptimizeFunctionOnNextCall(foo, "osr");
+  }
+  counter += obj;
+  return counter;
+}
+
+function bar() {
+  var a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
+  for (var i = 0; i < 100; i++ ) {
+    foo(a);
+  }
+}
+
+try {
+  bar();
+} catch (e) {
+}
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Tue Jun  3 00:53:16 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Tue Jun  3 07:45:40 2014 UTC
@@ -8624,9 +8624,11 @@
       // Start patching from the currently patched loop nesting level.
       int current_level = unoptimized->allow_osr_at_loop_nesting_level();
       ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level));
- for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) {
-        unoptimized->set_allow_osr_at_loop_nesting_level(i);
-        isolate->runtime_profiler()->AttemptOnStackReplacement(*function);
+      if (FLAG_use_osr) {
+ for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) {
+          unoptimized->set_allow_osr_at_loop_nesting_level(i);
+ isolate->runtime_profiler()->AttemptOnStackReplacement(*function);
+        }
       }
     } else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) &&
                isolate->concurrent_recompilation_enabled()) {
@@ -8727,6 +8729,8 @@
   // We're not prepared to handle a function with arguments object.
   ASSERT(!function->shared()->uses_arguments());

+  RUNTIME_ASSERT(FLAG_use_osr);
+
   // Passing the PC in the javascript frame from the caller directly is
   // not GC safe, so we walk the stack to get it.
   JavaScriptFrameIterator it(isolate);

--
--
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