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

Side by Side Diff: src/string.js

Issue 1009443002: Hide Symbol implementation in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/mirror-debugger.js ('k') | src/symbol.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 var $stringCharAt; 5 var $stringCharAt;
6 var $stringIndexOf; 6 var $stringIndexOf;
7 var $stringSubstring; 7 var $stringSubstring;
8 8
9 (function() { 9 (function() {
10 10
11 %CheckIsBootstrapping(); 11 %CheckIsBootstrapping();
12 12
13 var GlobalArray = global.Array; 13 var GlobalArray = global.Array;
14 var GlobalRegExp = global.RegExp; 14 var GlobalRegExp = global.RegExp;
15 var GlobalString = global.String; 15 var GlobalString = global.String;
16 16
17 //------------------------------------------------------------------- 17 //-------------------------------------------------------------------
18 18
19 function StringConstructor(x) { 19 function StringConstructor(x) {
20 if (%_ArgumentsLength() == 0) x = ''; 20 if (%_ArgumentsLength() == 0) x = '';
21 if (%_IsConstructCall()) { 21 if (%_IsConstructCall()) {
22 %_SetValueOf(this, TO_STRING_INLINE(x)); 22 %_SetValueOf(this, TO_STRING_INLINE(x));
23 } else { 23 } else {
24 return IS_SYMBOL(x) ? 24 return IS_SYMBOL(x) ?
25 %_CallFunction(x, SymbolToString) : TO_STRING_INLINE(x); 25 %_CallFunction(x, $symbolToString) : TO_STRING_INLINE(x);
26 } 26 }
27 } 27 }
28 28
29 29
30 // ECMA-262 section 15.5.4.2 30 // ECMA-262 section 15.5.4.2
31 function StringToString() { 31 function StringToString() {
32 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) { 32 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
33 throw new $TypeError('String.prototype.toString is not generic'); 33 throw new $TypeError('String.prototype.toString is not generic');
34 } 34 }
35 return %_ValueOf(this); 35 return %_ValueOf(this);
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 "strike", StringStrike, 984 "strike", StringStrike,
985 "sub", StringSub, 985 "sub", StringSub,
986 "sup", StringSup 986 "sup", StringSup
987 )); 987 ));
988 988
989 $stringCharAt = StringCharAt; 989 $stringCharAt = StringCharAt;
990 $stringIndexOf = StringIndexOfJS; 990 $stringIndexOf = StringIndexOfJS;
991 $stringSubstring = StringSubstring; 991 $stringSubstring = StringSubstring;
992 992
993 })(); 993 })();
OLDNEW
« no previous file with comments | « src/mirror-debugger.js ('k') | src/symbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698