| 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/ast/ast.h" | 9 #include "src/ast/ast.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 { | 2757 { |
| 2758 // Add prototype. | 2758 // Add prototype. |
| 2759 Handle<AccessorInfo> prototype = | 2759 Handle<AccessorInfo> prototype = |
| 2760 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2760 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
| 2761 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), | 2761 AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), |
| 2762 prototype, rw_attribs); | 2762 prototype, rw_attribs); |
| 2763 map->AppendDescriptor(&d); | 2763 map->AppendDescriptor(&d); |
| 2764 } | 2764 } |
| 2765 } | 2765 } |
| 2766 | 2766 |
| 2767 Handle<JSFixedArrayIterator> Factory::NewJSFixedArrayIterator( | |
| 2768 Handle<FixedArray> array) { | |
| 2769 // Create the "next" function (must be unique per iterator object). | |
| 2770 Handle<Code> code( | |
| 2771 isolate()->builtins()->builtin(Builtins::kFixedArrayIteratorNext)); | |
| 2772 // TODO(neis): Don't create a new SharedFunctionInfo each time. | |
| 2773 Handle<JSFunction> next = isolate()->factory()->NewFunctionWithoutPrototype( | |
| 2774 isolate()->factory()->next_string(), code, false); | |
| 2775 next->shared()->set_native(true); | |
| 2776 | |
| 2777 // Create the iterator. | |
| 2778 Handle<Map> map(isolate()->native_context()->fixed_array_iterator_map()); | |
| 2779 Handle<JSFixedArrayIterator> iterator = | |
| 2780 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | |
| 2781 iterator->set_initial_next(*next); | |
| 2782 iterator->set_array(*array); | |
| 2783 iterator->set_index(0); | |
| 2784 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | |
| 2785 return iterator; | |
| 2786 } | |
| 2787 | |
| 2788 } // namespace internal | 2767 } // namespace internal |
| 2789 } // namespace v8 | 2768 } // namespace v8 |
| OLD | NEW |