OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2603 function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ? rw_attribs | 2603 function_mode == FUNCTION_WITH_WRITEABLE_PROTOTYPE ? rw_attribs |
2604 : ro_attribs; | 2604 : ro_attribs; |
2605 Handle<AccessorInfo> prototype = | 2605 Handle<AccessorInfo> prototype = |
2606 Accessors::FunctionPrototypeInfo(isolate(), attribs); | 2606 Accessors::FunctionPrototypeInfo(isolate(), attribs); |
2607 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2607 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
2608 prototype, attribs); | 2608 prototype, attribs); |
2609 map->AppendDescriptor(&d); | 2609 map->AppendDescriptor(&d); |
2610 } | 2610 } |
2611 } | 2611 } |
2612 | 2612 |
2613 Handle<JSFixedArrayIterator> Factory::NewJSFixedArrayIterator( | |
2614 Handle<FixedArray> array) { | |
2615 // Create the "next" function. | |
2616 Handle<Code> code( | |
2617 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!
| |
2618 Handle<JSFunction> next = isolate()->factory()->NewFunctionWithoutPrototype( | |
2619 isolate()->factory()->next_string(), code, false); | |
2620 next->shared()->set_native(true); | |
2621 | |
2622 // Create the iterator. | |
2623 Handle<Map> map(isolate()->native_context()->fixed_array_iterator_map()); | |
2624 Handle<JSFixedArrayIterator> iterator = | |
2625 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | |
2626 iterator->set_next(*next); | |
2627 iterator->set_array(*array); | |
2628 iterator->set_index(0); | |
2629 return iterator; | |
2630 } | |
2631 | |
2613 } // namespace internal | 2632 } // namespace internal |
2614 } // namespace v8 | 2633 } // namespace v8 |
OLD | NEW |