Reviewers: Yang,

Message:
Hi Yang,
Here is a small OSR issue. PTAL, thx!
--Michael

Description:
When flag --nouse-osr is set, don't allow osr from hidden runtime calls.

BUG=379770
[email protected]
LOG=N

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+70, -3 lines):
  M src/runtime.cc
  A test/mjsunit/regress/regress-379770.js


Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 5971e33082b083d6292d2957dd5ef02b1e6fb04f..a8c4e5f90923aeeca6c094795e904b45a0f43877 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8616,9 +8616,11 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
       // 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()) {
@@ -8713,6 +8715,7 @@ static bool IsSuitableForOnStackReplacement(Isolate* isolate,
 RUNTIME_FUNCTION(Runtime_CompileForOnStackReplacement) {
   HandleScope scope(isolate);
   ASSERT(args.length() == 1);
+  ASSERT(FLAG_use_osr);
   CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
   Handle<Code> caller_code(function->shared()->code());

Index: test/mjsunit/regress/regress-379770.js
diff --git a/test/mjsunit/regress/regress-379770.js b/test/mjsunit/regress/regress-379770.js
new file mode 100644
index 0000000000000000000000000000000000000000..8c9747b423e64c5c8ce1614e3023028af9bfbb89
--- /dev/null
+++ b/test/mjsunit/regress/regress-379770.js
@@ -0,0 +1,64 @@
+// 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 --expose-gc
+%SetFlags("--deopt-every-n-times=10 --nouse-osr");
+function runNearStackLimit(f) {
+  function t() {
+    try {
+      t();
+    } catch(e) {
+      f();
+    }
+  };
+  try {
+    t();
+  } catch(e) {
+  }
+}
+
+function twoarg(a,b) {}
+
+var __v_0 = undefined;
+var __v_1 = {};
+var __v_2 = {};
+var __v_3 = {};
+var __v_4 = {};
+var __v_5 = {};
+var __v_7 = {};
+var __v_28 = undefined;
+var __v_29 = {};
+
+function __f_20(t, limit) {
+  var __v_11 = 1;
+  for (var __v_14 in t) {
+    if (t.hasOwnProperty(__v_14)) {
+      for (var __v_6 = 0; __v_6 < t[__v_14].length; __v_6++) {
+        __v_11 += t[__v_14][__v_6];
+        if (__v_6 === limit) {
+          %OptimizeFunctionOnNextCall(__f_20, "osr");
+        }
+      }
+      __v_11 += __v_14;
+    }
+  }
+  return __v_11;
+}
+
+function __f_18() {
+  with ({}) {}
+  var __v_8 = new Array(20);
+  gc();
+  for (var __v_6 = 0; __v_6 < __v_8.length; __v_6++) {
+    __v_8[__v_6] = __v_6 + 1;
+  }
+  __v_8.push(":");
+
+  runNearStackLimit(function() {
+    twoarg("211:x1234567891011121314151617181920:y",
+      __f_20({__v_14: __v_8, y: __v_8}, (__v_8.length / 2) | 0));
+  });
+
+}
+
+__f_18();


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