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

Unified Diff: src/factory.cc

Issue 2348493003: [builtins] move String.prototype[@@iterator] to C++ builtin (Closed)
Patch Set: 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
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index f7e1c746dd49f79fe31d6ffbb11aab5f24785557..2bb3bda8cfc391ecf0e85f04506d1528da810b32 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -734,6 +734,20 @@ Handle<ExternalOneByteString> Factory::NewNativeSourceString(
return external_string;
}
+Handle<JSStringIterator> Factory::NewJSStringIterator() {
+ Handle<Map> map(isolate()->native_context()->string_iterator_map());
+ CALL_HEAP_FUNCTION(isolate(),
+ isolate()->heap()->AllocateJSObjectFromMap(*map),
+ JSStringIterator);
+}
+
+Handle<JSStringIterator> Factory::NewJSStringIterator(Handle<String> string) {
+ Handle<JSStringIterator> iterator = NewJSStringIterator();
+ iterator->set_string(*String::Flatten(string));
Benedikt Meurer 2016/09/15 17:34:33 I'm not sure that GCmole will like this.
+ iterator->set_index(Smi::FromInt(0));
+
+ return iterator;
+}
Handle<Symbol> Factory::NewSymbol() {
CALL_HEAP_FUNCTION(
@@ -1732,6 +1746,14 @@ 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));
+ JSIteratorResult::Initialize(js_iter_result, value, ToBoolean(done));
+ return js_iter_result;
+}
Handle<JSMap> Factory::NewJSMap() {
Handle<Map> map(isolate()->native_context()->js_map_map());

Powered by Google App Engine
This is Rietveld 408576698