Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: test/mjsunit/regress/regress-seqstrsetchar-ex1.js

Issue 14895019: Fix code gen bug on arm and mips; SeqStringSetChar overwrites a register; Add better default PrintD… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Integrate feedback from code review. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | test/mjsunit/regress/regress-seqstrsetchar-ex2.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-seqstrsetchar-ex1.js
diff --git a/test/mjsunit/array-non-smi-length.js b/test/mjsunit/regress/regress-seqstrsetchar-ex1.js
similarity index 66%
copy from test/mjsunit/array-non-smi-length.js
copy to test/mjsunit/regress/regress-seqstrsetchar-ex1.js
index 23a25ee797bd68690ad2a7ce26a9135e23b486e2..047751328c5476852485bfa7fc0f3fde9758be2d 100644
--- a/test/mjsunit/array-non-smi-length.js
+++ b/test/mjsunit/regress/regress-seqstrsetchar-ex1.js
@@ -27,20 +27,34 @@
// Flags: --allow-natives-syntax
-function TestNonSmiArrayLength() {
- function f(a) {
- return a.length+1;
- }
+// stubbed version of ToNumber
+function ToNumber(x) {
+ return 311;
+}
- var a = [];
- a.length = 0xFFFF;
- assertSame(0x10000, f(a));
- assertSame(0x10000, f(a));
+// Reduced version of String.fromCharCode;
+// does not actually do the same calculation but exhibits untagging bug
+function StringFromCharCode(code) {
+ var n = %_ArgumentsLength();
+ var one_byte = %NewString(n, true);
+ var i;
+ for (i = 0; i < n; i++) {
+ var code = %_Arguments(i);
+ if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
+ if (code > 0xff) break;
+ }
- %OptimizeFunctionOnNextCall(f);
- a.length = 0xFFFFFFFF;
- assertSame(0x100000000, f(a));
+ var two_byte = %NewString(n - i, false);
+ for (var j = 0; i < n; i++, j++) {
+ var code = %_Arguments(i);
+ %_TwoByteSeqStringSetChar(two_byte, j, code);
+ }
+ return one_byte + two_byte;
}
-TestNonSmiArrayLength();
+StringFromCharCode(0xFFF, 0xFFF);
+StringFromCharCode(0x7C, 0x7C);
+%OptimizeFunctionOnNextCall(StringFromCharCode);
+StringFromCharCode(0x7C, 0x7C);
+StringFromCharCode(0xFFF, 0xFFF);
« no previous file with comments | « src/mips/lithium-mips.cc ('k') | test/mjsunit/regress/regress-seqstrsetchar-ex2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698