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

Side by Side Diff: src/js/string.js

Issue 2126453002: [intrinsic] Drop the %_ValueOf intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix noi18n build (narf) Created 4 years, 5 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/js/prologue.js ('k') | src/js/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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 19 matching lines...) Expand all
30 IsRegExp = from.IsRegExp; 30 IsRegExp = from.IsRegExp;
31 MakeRangeError = from.MakeRangeError; 31 MakeRangeError = from.MakeRangeError;
32 MakeTypeError = from.MakeTypeError; 32 MakeTypeError = from.MakeTypeError;
33 MaxSimple = from.MaxSimple; 33 MaxSimple = from.MaxSimple;
34 MinSimple = from.MinSimple; 34 MinSimple = from.MinSimple;
35 RegExpInitialize = from.RegExpInitialize; 35 RegExpInitialize = from.RegExpInitialize;
36 }); 36 });
37 37
38 //------------------------------------------------------------------- 38 //-------------------------------------------------------------------
39 39
40 // ECMA-262 section 15.5.4.2
41 function StringToString() {
42 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
43 throw MakeTypeError(kNotGeneric, 'String.prototype.toString');
44 }
45 return %_ValueOf(this);
46 }
47
48
49 // ECMA-262 section 15.5.4.3
50 function StringValueOf() {
51 if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
52 throw MakeTypeError(kNotGeneric, 'String.prototype.valueOf');
53 }
54 return %_ValueOf(this);
55 }
56
57
58 // ECMA-262, section 15.5.4.6 40 // ECMA-262, section 15.5.4.6
59 function StringConcat(other /* and more */) { // length == 1 41 function StringConcat(other /* and more */) { // length == 1
60 "use strict"; 42 "use strict";
61 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat"); 43 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat");
62 var s = TO_STRING(this); 44 var s = TO_STRING(this);
63 var len = arguments.length; 45 var len = arguments.length;
64 for (var i = 0; i < len; ++i) { 46 for (var i = 0; i < len; ++i) {
65 s = s + TO_STRING(arguments[i]); 47 s = s + TO_STRING(arguments[i]);
66 } 48 }
67 return s; 49 return s;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 731
750 // ------------------------------------------------------------------- 732 // -------------------------------------------------------------------
751 733
752 // Set up the non-enumerable functions on the String object. 734 // Set up the non-enumerable functions on the String object.
753 utils.InstallFunctions(GlobalString, DONT_ENUM, [ 735 utils.InstallFunctions(GlobalString, DONT_ENUM, [
754 "raw", StringRaw 736 "raw", StringRaw
755 ]); 737 ]);
756 738
757 // Set up the non-enumerable functions on the String prototype object. 739 // Set up the non-enumerable functions on the String prototype object.
758 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ 740 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [
759 "valueOf", StringValueOf,
760 "toString", StringToString,
761 "codePointAt", StringCodePointAt, 741 "codePointAt", StringCodePointAt,
762 "concat", StringConcat, 742 "concat", StringConcat,
763 "endsWith", StringEndsWith, 743 "endsWith", StringEndsWith,
764 "includes", StringIncludes, 744 "includes", StringIncludes,
765 "indexOf", StringIndexOf, 745 "indexOf", StringIndexOf,
766 "lastIndexOf", StringLastIndexOf, 746 "lastIndexOf", StringLastIndexOf,
767 "localeCompare", StringLocaleCompareJS, 747 "localeCompare", StringLocaleCompareJS,
768 "match", StringMatchJS, 748 "match", StringMatchJS,
769 "normalize", StringNormalize, 749 "normalize", StringNormalize,
770 "repeat", StringRepeat, 750 "repeat", StringRepeat,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 to.StringLastIndexOf = StringLastIndexOf; 784 to.StringLastIndexOf = StringLastIndexOf;
805 to.StringMatch = StringMatchJS; 785 to.StringMatch = StringMatchJS;
806 to.StringReplace = StringReplace; 786 to.StringReplace = StringReplace;
807 to.StringSlice = StringSlice; 787 to.StringSlice = StringSlice;
808 to.StringSplit = StringSplitJS; 788 to.StringSplit = StringSplitJS;
809 to.StringSubstr = StringSubstr; 789 to.StringSubstr = StringSubstr;
810 to.StringSubstring = StringSubstring; 790 to.StringSubstring = StringSubstring;
811 }); 791 });
812 792
813 }) 793 })
OLDNEW
« no previous file with comments | « src/js/prologue.js ('k') | src/js/symbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698