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

Unified Diff: src/factory.cc

Issue 2348493003: [builtins] move String.prototype[@@iterator] to C++ builtin (Closed)
Patch Set: V8 (rebase + fix bytecode expectations) Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 776a18c01b59bb9ce8781129f76d5802ed4e1894..0abf9ad217938b23a89d1f6c9fbba09e7d54c48b 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -599,6 +599,19 @@ MaybeHandle<String> Factory::NewConsString(Handle<String> left,
return result;
}
+Handle<String> Factory::NewSurrogatePairString(uint16_t lead, uint16_t trail) {
+ DCHECK_GE(lead, 0xD800);
+ DCHECK_LE(lead, 0xDBFF);
+ DCHECK_GE(trail, 0xDC00);
+ DCHECK_LE(trail, 0xDFFF);
+
+ Handle<SeqTwoByteString> str =
+ isolate()->factory()->NewRawTwoByteString(2).ToHandleChecked();
+ uc16* dest = str->GetChars();
+ dest[0] = lead;
+ dest[1] = trail;
+ return str;
+}
Handle<String> Factory::NewProperSubString(Handle<String> str,
int begin,
@@ -733,6 +746,17 @@ Handle<ExternalOneByteString> Factory::NewNativeSourceString(
return external_string;
}
+Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) {
+ Handle<Map> map(isolate()->native_context()->string_iterator_map(),
+ isolate());
+ Handle<String> flat_string = String::Flatten(string);
+ Handle<JSStringIterator> iterator =
+ Handle<JSStringIterator>::cast(NewJSObjectFromMap(map));
+ iterator->set_string(*flat_string);
+ iterator->set_index(0);
+
+ return iterator;
+}
Handle<Symbol> Factory::NewSymbol() {
CALL_HEAP_FUNCTION(
@@ -1764,6 +1788,15 @@ Handle<JSDataView> Factory::NewJSDataView() {
JSDataView);
}
+Handle<JSIteratorResult> Factory::NewJSIteratorResult(Handle<Object> value,
+ bool done) {
+ Handle<Map> map(isolate()->native_context()->iterator_result_map());
+ Handle<JSIteratorResult> js_iter_result =
+ Handle<JSIteratorResult>::cast(NewJSObjectFromMap(map));
+ js_iter_result->set_value(*value);
+ js_iter_result->set_done(*ToBoolean(done));
+ return js_iter_result;
+}
Handle<JSMap> Factory::NewJSMap() {
Handle<Map> map(isolate()->native_context()->js_map_map());
« no previous file with comments | « src/factory.h ('k') | src/heap/objects-visiting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698