Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 877818a29b7bd4884b5933dab196c194caaf4922..c6db2b8dcb13e36fa5e25ffdaee69ed3e9d0f6c2 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -2610,5 +2610,24 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map, |
} |
} |
+Handle<JSFixedArrayIterator> Factory::NewJSFixedArrayIterator( |
+ Handle<FixedArray> array) { |
+ // Create the "next" function. |
+ Handle<Code> code( |
+ isolate()->builtins()->builtin(Builtins::kFixedArrayIteratorNext)); |
Benedikt Meurer
2016/10/12 03:24:05
This is pretty inefficient, as you create a new Sh
neis
2016/10/13 07:37:21
Right, thanks!
|
+ Handle<JSFunction> next = isolate()->factory()->NewFunctionWithoutPrototype( |
+ isolate()->factory()->next_string(), code, false); |
+ next->shared()->set_native(true); |
+ |
+ // Create the iterator. |
+ Handle<Map> map(isolate()->native_context()->fixed_array_iterator_map()); |
+ Handle<JSFixedArrayIterator> iterator = |
+ Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
+ iterator->set_next(*next); |
+ iterator->set_array(*array); |
+ iterator->set_index(0); |
+ return iterator; |
+} |
+ |
} // namespace internal |
} // namespace v8 |