Index: test/mjsunit/regress/regress-386034.js |
diff --git a/test/mjsunit/regress/regress-386034.js b/test/mjsunit/regress/regress-386034.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6a82933bd103e16c0e78f85c2e9c1879de993771 |
--- /dev/null |
+++ b/test/mjsunit/regress/regress-386034.js |
@@ -0,0 +1,36 @@ |
+// 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 |
+ |
+(function() { |
+ function f(x) { |
+ for (i = 0; i < 1; i++) { |
+ x.call(this); |
+ } |
+ } |
+ |
+ function g() {} |
+ |
+ f(g); |
+ f(g); |
+ %OptimizeFunctionOnNextCall(f); |
+ assertThrows(function() { f('whatever') }, TypeError); |
+})(); |
+ |
+(function() { |
+ function f(x) { |
+ var v = x; |
+ for (i = 0; i < 1; i++) { |
+ v.apply(this, arguments); |
+ } |
+ } |
+ |
+ function g() {} |
+ |
+ f(g); |
+ f(g); |
+ %OptimizeFunctionOnNextCall(f); |
+ assertThrows(function() { f('----'); }, TypeError); |
+})(); |