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

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

Issue 2117273002: Revert of [intrinsic] Drop the %_ValueOf intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
40 // ECMA-262, section 15.5.4.6 58 // ECMA-262, section 15.5.4.6
41 function StringConcat(other /* and more */) { // length == 1 59 function StringConcat(other /* and more */) { // length == 1
42 "use strict"; 60 "use strict";
43 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat"); 61 CHECK_OBJECT_COERCIBLE(this, "String.prototype.concat");
44 var s = TO_STRING(this); 62 var s = TO_STRING(this);
45 var len = arguments.length; 63 var len = arguments.length;
46 for (var i = 0; i < len; ++i) { 64 for (var i = 0; i < len; ++i) {
47 s = s + TO_STRING(arguments[i]); 65 s = s + TO_STRING(arguments[i]);
48 } 66 }
49 return s; 67 return s;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 749
732 // ------------------------------------------------------------------- 750 // -------------------------------------------------------------------
733 751
734 // Set up the non-enumerable functions on the String object. 752 // Set up the non-enumerable functions on the String object.
735 utils.InstallFunctions(GlobalString, DONT_ENUM, [ 753 utils.InstallFunctions(GlobalString, DONT_ENUM, [
736 "raw", StringRaw 754 "raw", StringRaw
737 ]); 755 ]);
738 756
739 // Set up the non-enumerable functions on the String prototype object. 757 // Set up the non-enumerable functions on the String prototype object.
740 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [ 758 utils.InstallFunctions(GlobalString.prototype, DONT_ENUM, [
759 "valueOf", StringValueOf,
760 "toString", StringToString,
741 "codePointAt", StringCodePointAt, 761 "codePointAt", StringCodePointAt,
742 "concat", StringConcat, 762 "concat", StringConcat,
743 "endsWith", StringEndsWith, 763 "endsWith", StringEndsWith,
744 "includes", StringIncludes, 764 "includes", StringIncludes,
745 "indexOf", StringIndexOf, 765 "indexOf", StringIndexOf,
746 "lastIndexOf", StringLastIndexOf, 766 "lastIndexOf", StringLastIndexOf,
747 "localeCompare", StringLocaleCompareJS, 767 "localeCompare", StringLocaleCompareJS,
748 "match", StringMatchJS, 768 "match", StringMatchJS,
749 "normalize", StringNormalize, 769 "normalize", StringNormalize,
750 "repeat", StringRepeat, 770 "repeat", StringRepeat,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 to.StringLastIndexOf = StringLastIndexOf; 804 to.StringLastIndexOf = StringLastIndexOf;
785 to.StringMatch = StringMatchJS; 805 to.StringMatch = StringMatchJS;
786 to.StringReplace = StringReplace; 806 to.StringReplace = StringReplace;
787 to.StringSlice = StringSlice; 807 to.StringSlice = StringSlice;
788 to.StringSplit = StringSplitJS; 808 to.StringSplit = StringSplitJS;
789 to.StringSubstr = StringSubstr; 809 to.StringSubstr = StringSubstr;
790 to.StringSubstring = StringSubstring; 810 to.StringSubstring = StringSubstring;
791 }); 811 });
792 812
793 }) 813 })
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