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

Side by Side Diff: src/uri.js

Issue 6973063: Extend GCMole with poor man's data flow analysis to catch dead raw pointer vars. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 result[index++] = (value >> 10) + 0xd7c0; 159 result[index++] = (value >> 10) + 0xd7c0;
160 result[index++] = (value & 0x3ff) + 0xdc00; 160 result[index++] = (value & 0x3ff) + 0xdc00;
161 return index; 161 return index;
162 } 162 }
163 } 163 }
164 164
165 165
166 // ECMA-262, section 15.1.3 166 // ECMA-262, section 15.1.3
167 function Encode(uri, unescape) { 167 function Encode(uri, unescape) {
168 var uriLength = uri.length; 168 var uriLength = uri.length;
169 var result = new $Array(uriLength); 169 // We are going to pass result to %StringFromCharCodeArray
170 // which does not expect any getters/setters installed
171 // on the incoming array.
172 var result = new InternalArray(uriLength);
170 var index = 0; 173 var index = 0;
171 for (var k = 0; k < uriLength; k++) { 174 for (var k = 0; k < uriLength; k++) {
172 var cc1 = uri.charCodeAt(k); 175 var cc1 = uri.charCodeAt(k);
173 if (unescape(cc1)) { 176 if (unescape(cc1)) {
174 result[index++] = cc1; 177 result[index++] = cc1;
175 } else { 178 } else {
176 if (cc1 >= 0xDC00 && cc1 <= 0xDFFF) throw new $URIError("URI malformed"); 179 if (cc1 >= 0xDC00 && cc1 <= 0xDFFF) throw new $URIError("URI malformed");
177 if (cc1 < 0xD800 || cc1 > 0xDBFF) { 180 if (cc1 < 0xD800 || cc1 > 0xDBFF) {
178 index = URIEncodeSingle(cc1, result, index); 181 index = URIEncodeSingle(cc1, result, index);
179 } else { 182 } else {
180 k++; 183 k++;
181 if (k == uriLength) throw new $URIError("URI malformed"); 184 if (k == uriLength) throw new $URIError("URI malformed");
182 var cc2 = uri.charCodeAt(k); 185 var cc2 = uri.charCodeAt(k);
183 if (cc2 < 0xDC00 || cc2 > 0xDFFF) throw new $URIError("URI malformed"); 186 if (cc2 < 0xDC00 || cc2 > 0xDFFF) throw new $URIError("URI malformed");
184 index = URIEncodePair(cc1, cc2, result, index); 187 index = URIEncodePair(cc1, cc2, result, index);
185 } 188 }
186 } 189 }
187 } 190 }
188 return %StringFromCharCodeArray(result); 191 return %StringFromCharCodeArray(result);
189 } 192 }
190 193
191 194
192 // ECMA-262, section 15.1.3 195 // ECMA-262, section 15.1.3
193 function Decode(uri, reserved) { 196 function Decode(uri, reserved) {
194 var uriLength = uri.length; 197 var uriLength = uri.length;
195 var result = new $Array(uriLength); 198 // We are going to pass result to %StringFromCharCodeArray
199 // which does not expect any getters/setters installed
200 // on the incoming array.
201 var result = new InternalArray(uriLength);
196 var index = 0; 202 var index = 0;
197 for (var k = 0; k < uriLength; k++) { 203 for (var k = 0; k < uriLength; k++) {
198 var ch = uri.charAt(k); 204 var ch = uri.charAt(k);
199 if (ch == '%') { 205 if (ch == '%') {
200 if (k + 2 >= uriLength) throw new $URIError("URI malformed"); 206 if (k + 2 >= uriLength) throw new $URIError("URI malformed");
201 var cc = URIHexCharsToCharCode(uri.charCodeAt(++k), uri.charCodeAt(++k)); 207 var cc = URIHexCharsToCharCode(uri.charCodeAt(++k), uri.charCodeAt(++k));
202 if (cc >> 7) { 208 if (cc >> 7) {
203 var n = 0; 209 var n = 0;
204 while (((cc << ++n) & 0x80) != 0) ; 210 while (((cc << ++n) & 0x80) != 0) ;
205 if (n == 1 || n > 4) throw new $URIError("URI malformed"); 211 if (n == 1 || n > 4) throw new $URIError("URI malformed");
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 "escape", URIEscape, 399 "escape", URIEscape,
394 "unescape", URIUnescape, 400 "unescape", URIUnescape,
395 "decodeURI", URIDecode, 401 "decodeURI", URIDecode,
396 "decodeURIComponent", URIDecodeComponent, 402 "decodeURIComponent", URIDecodeComponent,
397 "encodeURI", URIEncode, 403 "encodeURI", URIEncode,
398 "encodeURIComponent", URIEncodeComponent 404 "encodeURIComponent", URIEncodeComponent
399 )); 405 ));
400 } 406 }
401 407
402 SetupURI(); 408 SetupURI();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698