Index: test/mjsunit/regress/string-set-char-deopt.js |
diff --git a/test/mjsunit/regress/binop-in-effect-context-deopt.js b/test/mjsunit/regress/string-set-char-deopt.js |
similarity index 65% |
copy from test/mjsunit/regress/binop-in-effect-context-deopt.js |
copy to test/mjsunit/regress/string-set-char-deopt.js |
index fb7280a0d1128c6baad81e759aad6b6bec3c6528..9f6d43453840e41d73c4a4f5702346d0fe6e16fa 100644 |
--- a/test/mjsunit/regress/binop-in-effect-context-deopt.js |
+++ b/test/mjsunit/regress/string-set-char-deopt.js |
@@ -27,39 +27,59 @@ |
// Flags: --allow-natives-syntax |
-(function BinopInEffectContextDeoptAndOsr() { |
- function f(a, deopt, osr) { |
- var result = (a + 10, "result"); |
- var dummy = deopt + 0; |
+(function OneByteSeqStringSetCharDeoptOsr() { |
+ function deopt() { |
+ %DeoptimizeFunction(f); |
+ } |
+ |
+ function f(string, osr) { |
+ var world = " world"; |
+ %_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48)); |
+ |
if (osr) while (%GetOptimizationStatus(f) == 2) {} |
- return result; |
+ |
+ return string + world; |
} |
- assertEquals("result", f(true, 3, false)); |
- assertEquals("result", f(true, 3, false)); |
+ assertEquals("Hello " + "world", f("hello", false)); |
%OptimizeFunctionOnNextCall(f); |
- assertEquals("result", f(true, "foo", true)); |
+ assertEquals("Hello " + "world", f("hello", true)); |
})(); |
-(function BinopInEffectContextLazyDeopt() { |
- function deopt_f() { |
+(function OneByteSeqStringSetCharDeopt() { |
+ function deopt() { |
%DeoptimizeFunction(f); |
- return "dummy"; |
} |
- function h() { |
- return { toString : deopt_f }; |
+ function g(x) { |
+ } |
+ |
+ function f(string) { |
+ g(%_OneByteSeqStringSetChar(string, 0, (deopt(), 0x48))); |
+ return string; |
+ } |
+ |
+ assertEquals("Hell" + "o", f("hello")); |
+ %OptimizeFunctionOnNextCall(f); |
+ assertEquals("Hell" + "o", f("hello")); |
+})(); |
+ |
+ |
+(function TwoByteSeqStringSetCharDeopt() { |
+ function deopt() { |
+ %DeoptimizeFunction(f); |
} |
function g(x) { |
} |
- function f() { |
- return g(void(h() + "")); |
- }; |
+ function f(string) { |
+ g(%_TwoByteSeqStringSetChar(string, 0, (deopt(), 0x48))); |
+ return string; |
+ } |
- f(); |
+ assertEquals("Hell" + "o", f("\u20ACello")); |
%OptimizeFunctionOnNextCall(f); |
- f(); |
+ assertEquals("Hell" + "o", f("\u20ACello")); |
})(); |