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

Side by Side Diff: src/string.js

Issue 1266013006: [stubs] Unify (and optimize) implementation of ToObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add missing support for %_ToObject in TurboFan and Crankshaft. Created 5 years, 4 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/runtime/runtime-symbol.cc ('k') | src/string-iterator.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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 } 1105 }
1106 1106
1107 1107
1108 // ------------------------------------------------------------------- 1108 // -------------------------------------------------------------------
1109 // String methods related to templates 1109 // String methods related to templates
1110 1110
1111 // ES6 Draft 03-17-2015, section 21.1.2.4 1111 // ES6 Draft 03-17-2015, section 21.1.2.4
1112 function StringRaw(callSite) { 1112 function StringRaw(callSite) {
1113 // TODO(caitp): Use rest parameters when implemented 1113 // TODO(caitp): Use rest parameters when implemented
1114 var numberOfSubstitutions = %_ArgumentsLength(); 1114 var numberOfSubstitutions = %_ArgumentsLength();
1115 var cooked = $toObject(callSite); 1115 var cooked = TO_OBJECT(callSite);
1116 var raw = $toObject(cooked.raw); 1116 var raw = TO_OBJECT(cooked.raw);
1117 var literalSegments = $toLength(raw.length); 1117 var literalSegments = $toLength(raw.length);
1118 if (literalSegments <= 0) return ""; 1118 if (literalSegments <= 0) return "";
1119 1119
1120 var result = $toString(raw[0]); 1120 var result = $toString(raw[0]);
1121 1121
1122 for (var i = 1; i < literalSegments; ++i) { 1122 for (var i = 1; i < literalSegments; ++i) {
1123 if (i < numberOfSubstitutions) { 1123 if (i < numberOfSubstitutions) {
1124 result += $toString(%_Arguments(i)); 1124 result += $toString(%_Arguments(i));
1125 } 1125 }
1126 result += $toString(raw[i]); 1126 result += $toString(raw[i]);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 to.StringIndexOf = StringIndexOfJS; 1200 to.StringIndexOf = StringIndexOfJS;
1201 to.StringLastIndexOf = StringLastIndexOfJS; 1201 to.StringLastIndexOf = StringLastIndexOfJS;
1202 to.StringMatch = StringMatchJS; 1202 to.StringMatch = StringMatchJS;
1203 to.StringReplace = StringReplace; 1203 to.StringReplace = StringReplace;
1204 to.StringSplit = StringSplitJS; 1204 to.StringSplit = StringSplitJS;
1205 to.StringSubstr = StringSubstr; 1205 to.StringSubstr = StringSubstr;
1206 to.StringSubstring = StringSubstring; 1206 to.StringSubstring = StringSubstring;
1207 }); 1207 });
1208 1208
1209 }) 1209 })
OLDNEW
« no previous file with comments | « src/runtime/runtime-symbol.cc ('k') | src/string-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698