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

Side by Side Diff: src/string.js

Issue 561133005: Change the order of arguments of the (One|Two)ByteSeqStringSetChar intrinsic. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | src/uri.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file relies on the fact that the following declaration has been made 5 // This file relies on the fact that the following declaration has been made
6 // in runtime.js: 6 // in runtime.js:
7 // var $String = global.String; 7 // var $String = global.String;
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 return %_StringCharFromCode(code & 0xffff); 805 return %_StringCharFromCode(code & 0xffff);
806 } 806 }
807 807
808 var one_byte = %NewString(n, NEW_ONE_BYTE_STRING); 808 var one_byte = %NewString(n, NEW_ONE_BYTE_STRING);
809 var i; 809 var i;
810 for (i = 0; i < n; i++) { 810 for (i = 0; i < n; i++) {
811 var code = %_Arguments(i); 811 var code = %_Arguments(i);
812 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; 812 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
813 if (code < 0) code = code & 0xffff; 813 if (code < 0) code = code & 0xffff;
814 if (code > 0xff) break; 814 if (code > 0xff) break;
815 %_OneByteSeqStringSetChar(one_byte, i, code); 815 %_OneByteSeqStringSetChar(i, code, one_byte);
816 } 816 }
817 if (i == n) return one_byte; 817 if (i == n) return one_byte;
818 one_byte = %TruncateString(one_byte, i); 818 one_byte = %TruncateString(one_byte, i);
819 819
820 var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING); 820 var two_byte = %NewString(n - i, NEW_TWO_BYTE_STRING);
821 for (var j = 0; i < n; i++, j++) { 821 for (var j = 0; i < n; i++, j++) {
822 var code = %_Arguments(i); 822 var code = %_Arguments(i);
823 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff; 823 if (!%_IsSmi(code)) code = ToNumber(code) & 0xffff;
824 %_TwoByteSeqStringSetChar(two_byte, j, code); 824 %_TwoByteSeqStringSetChar(j, code, two_byte);
825 } 825 }
826 return one_byte + two_byte; 826 return one_byte + two_byte;
827 } 827 }
828 828
829 829
830 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 830 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
831 function HtmlEscape(str) { 831 function HtmlEscape(str) {
832 return TO_STRING_INLINE(str).replace(/"/g, "&quot;"); 832 return TO_STRING_INLINE(str).replace(/"/g, "&quot;");
833 } 833 }
834 834
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 "fixed", StringFixed, 975 "fixed", StringFixed,
976 "italics", StringItalics, 976 "italics", StringItalics,
977 "small", StringSmall, 977 "small", StringSmall,
978 "strike", StringStrike, 978 "strike", StringStrike,
979 "sub", StringSub, 979 "sub", StringSub,
980 "sup", StringSup 980 "sup", StringSup
981 )); 981 ));
982 } 982 }
983 983
984 SetUpString(); 984 SetUpString();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/uri.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698