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

Side by Side Diff: src/builtins/builtins-string-gen.cc

Issue 2913783002: [builtins] Begin removing CodeFactory accessors (Closed)
Patch Set: V8_EXPORT_PRIVATE Created 3 years, 6 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/builtins/builtins-promise-gen.cc ('k') | src/code-factory.h » ('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 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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 #include "src/builtins/builtins-string-gen.h" 5 #include "src/builtins/builtins-string-gen.h"
6 6
7 #include "src/builtins/builtins-regexp-gen.h" 7 #include "src/builtins/builtins-regexp-gen.h"
8 #include "src/builtins/builtins-utils-gen.h" 8 #include "src/builtins/builtins-utils-gen.h"
9 #include "src/builtins/builtins.h" 9 #include "src/builtins/builtins.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 1137
1138 RequireObjectCoercible(context, receiver, "String.prototype.replace"); 1138 RequireObjectCoercible(context, receiver, "String.prototype.replace");
1139 1139
1140 // Redirect to replacer method if {search[@@replace]} is not undefined. 1140 // Redirect to replacer method if {search[@@replace]} is not undefined.
1141 1141
1142 MaybeCallFunctionAtSymbol( 1142 MaybeCallFunctionAtSymbol(
1143 context, search, isolate()->factory()->replace_symbol(), 1143 context, search, isolate()->factory()->replace_symbol(),
1144 [=]() { 1144 [=]() {
1145 Node* const subject_string = ToString_Inline(context, receiver); 1145 Node* const subject_string = ToString_Inline(context, receiver);
1146 1146
1147 Callable replace_callable = CodeFactory::RegExpReplace(isolate()); 1147 return CallBuiltin(Builtins::kRegExpReplace, context, search,
1148 return CallStub(replace_callable, context, search, subject_string, 1148 subject_string, replace);
1149 replace);
1150 }, 1149 },
1151 [=](Node* fn) { 1150 [=](Node* fn) {
1152 Callable call_callable = CodeFactory::Call(isolate()); 1151 Callable call_callable = CodeFactory::Call(isolate());
1153 return CallJS(call_callable, context, fn, search, receiver, replace); 1152 return CallJS(call_callable, context, fn, search, receiver, replace);
1154 }); 1153 });
1155 1154
1156 // Convert {receiver} and {search} to strings. 1155 // Convert {receiver} and {search} to strings.
1157 1156
1158 Callable indexof_callable = CodeFactory::StringIndexOf(isolate()); 1157 Callable indexof_callable = CodeFactory::StringIndexOf(isolate());
1159 1158
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 args.GetOptionalArgumentValue(kStart, UndefinedConstant()); 1297 args.GetOptionalArgumentValue(kStart, UndefinedConstant());
1299 Node* const end = args.GetOptionalArgumentValue(kEnd, UndefinedConstant()); 1298 Node* const end = args.GetOptionalArgumentValue(kEnd, UndefinedConstant());
1300 Node* const context = Parameter(BuiltinDescriptor::kContext); 1299 Node* const context = Parameter(BuiltinDescriptor::kContext);
1301 1300
1302 Node* const smi_zero = SmiConstant(0); 1301 Node* const smi_zero = SmiConstant(0);
1303 1302
1304 // 1. Let O be ? RequireObjectCoercible(this value). 1303 // 1. Let O be ? RequireObjectCoercible(this value).
1305 RequireObjectCoercible(context, receiver, "String.prototype.slice"); 1304 RequireObjectCoercible(context, receiver, "String.prototype.slice");
1306 1305
1307 // 2. Let S be ? ToString(O). 1306 // 2. Let S be ? ToString(O).
1308 Callable tostring_callable = CodeFactory::ToString(isolate()); 1307 Node* const subject_string =
1309 Node* const subject_string = CallStub(tostring_callable, context, receiver); 1308 CallBuiltin(Builtins::kToString, context, receiver);
1310 1309
1311 // 3. Let len be the number of elements in S. 1310 // 3. Let len be the number of elements in S.
1312 Node* const length = LoadStringLength(subject_string); 1311 Node* const length = LoadStringLength(subject_string);
1313 1312
1314 // Conversions and bounds-checks for {start}. 1313 // Conversions and bounds-checks for {start}.
1315 ConvertAndBoundsCheckStartArgument(context, &var_start, start, length); 1314 ConvertAndBoundsCheckStartArgument(context, &var_start, start, length);
1316 1315
1317 // 5. If end is undefined, let intEnd be len; 1316 // 5. If end is undefined, let intEnd be len;
1318 var_end.Bind(length); 1317 var_end.Bind(length);
1319 GotoIf(WordEqual(end, UndefinedConstant()), &out); 1318 GotoIf(WordEqual(end, UndefinedConstant()), &out);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 1377
1379 RequireObjectCoercible(context, receiver, "String.prototype.split"); 1378 RequireObjectCoercible(context, receiver, "String.prototype.split");
1380 1379
1381 // Redirect to splitter method if {separator[@@split]} is not undefined. 1380 // Redirect to splitter method if {separator[@@split]} is not undefined.
1382 1381
1383 MaybeCallFunctionAtSymbol( 1382 MaybeCallFunctionAtSymbol(
1384 context, separator, isolate()->factory()->split_symbol(), 1383 context, separator, isolate()->factory()->split_symbol(),
1385 [=]() { 1384 [=]() {
1386 Node* const subject_string = ToString_Inline(context, receiver); 1385 Node* const subject_string = ToString_Inline(context, receiver);
1387 1386
1388 Callable split_callable = CodeFactory::RegExpSplit(isolate()); 1387 return CallBuiltin(Builtins::kRegExpSplit, context, separator,
1389 return CallStub(split_callable, context, separator, subject_string, 1388 subject_string, limit);
1390 limit);
1391 }, 1389 },
1392 [=](Node* fn) { 1390 [=](Node* fn) {
1393 Callable call_callable = CodeFactory::Call(isolate()); 1391 Callable call_callable = CodeFactory::Call(isolate());
1394 return CallJS(call_callable, context, fn, separator, receiver, limit); 1392 return CallJS(call_callable, context, fn, separator, receiver, limit);
1395 }); 1393 });
1396 1394
1397 // String and integer conversions. 1395 // String and integer conversions.
1398 // TODO(jgruber): The old implementation used Uint32Max instead of SmiMax - 1396 // TODO(jgruber): The old implementation used Uint32Max instead of SmiMax -
1399 // but AFAIK there should not be a difference since arrays are capped at Smi 1397 // but AFAIK there should not be a difference since arrays are capped at Smi
1400 // lengths. 1398 // lengths.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context, 1819 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context,
1822 HeapConstant(factory()->NewStringFromAsciiChecked( 1820 HeapConstant(factory()->NewStringFromAsciiChecked(
1823 "String Iterator.prototype.next", TENURED)), 1821 "String Iterator.prototype.next", TENURED)),
1824 iterator); 1822 iterator);
1825 Unreachable(); 1823 Unreachable();
1826 } 1824 }
1827 } 1825 }
1828 1826
1829 } // namespace internal 1827 } // namespace internal
1830 } // namespace v8 1828 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-promise-gen.cc ('k') | src/code-factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698