Index: test/mjsunit/arguments-apply-deopt.js |
diff --git a/test/mjsunit/regress/regress-crbug-150545.js b/test/mjsunit/arguments-apply-deopt.js |
similarity index 66% |
copy from test/mjsunit/regress/regress-crbug-150545.js |
copy to test/mjsunit/arguments-apply-deopt.js |
index 8238d2fa0d36ffd40be60628d333f5dcb1f0ba51..b7251af5aa1567087d7bb9d333dc1fed2f3ecb89 100644 |
--- a/test/mjsunit/regress/regress-crbug-150545.js |
+++ b/test/mjsunit/arguments-apply-deopt.js |
@@ -27,29 +27,51 @@ |
// Flags: --allow-natives-syntax |
-// Test that we do not generate OSR entry points that have an arguments |
-// stack height different from zero. The OSR machinery cannot generate |
-// frames for that. |
- |
-(function() { |
- "use strict"; |
- |
- var instantReturn = false; |
- function inner() { |
- if (instantReturn) return; |
- assertSame(3, arguments.length); |
- assertSame(1, arguments[0]); |
- assertSame(2, arguments[1]); |
- assertSame(3, arguments[2]); |
+(function ApplyArgumentsDeoptInReceiverMapCheck() { |
+ function invoker(h, r) { |
+ return function XXXXX() { |
+ var res = h.apply({ fffffff : r(this) }, arguments); |
+ return res; |
+ }; |
} |
- function outer() { |
- inner(1,2,3); |
- // Trigger OSR, if optimization is not disabled. |
- if (%GetOptimizationStatus(outer) != 4) { |
- while (%GetOptimizationCount(outer) == 0) {} |
- } |
+ var y = invoker(m, selfOf); |
+ |
+ function selfOf(c) { |
+ var sssss = c.self_; |
+ return sssss; |
+ } |
+ |
+ function m() { |
+ return this.fffffff; |
} |
- outer(); |
+ y.apply({ self_ : 3 }); |
+ y.apply({ self_ : 3 }); |
+ y.apply({ self_ : 3 }); |
+ |
+ %OptimizeFunctionOnNextCall(y); |
+ |
+ assertEquals(y.apply({ self_ : 3, uuu : 4 }), 3); |
+})(); |
+ |
+(function ApplyArgumentsDeoptInReceiverExplicit() { |
+ function f() { return this + 21; } |
+ |
+ function deopt() { |
+ %DeoptimizeFunction(XXXXX); |
+ return 21; |
+ } |
+ |
+ function XXXXX() { |
+ return f.apply(deopt(), arguments); |
+ }; |
+ |
+ XXXXX(); |
+ XXXXX(); |
+ XXXXX(); |
+ |
+ %OptimizeFunctionOnNextCall(XXXXX); |
+ |
+ assertEquals(42, XXXXX()); |
})(); |