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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
955 Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength()); | 955 Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength()); |
956 array->set_map_no_write_barrier(*block_context_map()); | 956 array->set_map_no_write_barrier(*block_context_map()); |
957 Handle<Context> context = Handle<Context>::cast(array); | 957 Handle<Context> context = Handle<Context>::cast(array); |
958 context->set_closure(*function); | 958 context->set_closure(*function); |
959 context->set_previous(*previous); | 959 context->set_previous(*previous); |
960 context->set_extension(*scope_info); | 960 context->set_extension(*scope_info); |
961 context->set_native_context(previous->native_context()); | 961 context->set_native_context(previous->native_context()); |
962 return context; | 962 return context; |
963 } | 963 } |
964 | 964 |
| 965 Handle<Context> Factory::NewPromiseResolvingFunctionContext(int length) { |
| 966 DCHECK_GE(length, Context::MIN_CONTEXT_SLOTS); |
| 967 Handle<FixedArray> array = NewFixedArray(length); |
| 968 array->set_map_no_write_barrier(*function_context_map()); |
| 969 Handle<Context> context = Handle<Context>::cast(array); |
| 970 context->set_extension(*the_hole_value()); |
| 971 return context; |
| 972 } |
965 | 973 |
966 Handle<Struct> Factory::NewStruct(InstanceType type) { | 974 Handle<Struct> Factory::NewStruct(InstanceType type) { |
967 CALL_HEAP_FUNCTION( | 975 CALL_HEAP_FUNCTION( |
968 isolate(), | 976 isolate(), |
969 isolate()->heap()->AllocateStruct(type), | 977 isolate()->heap()->AllocateStruct(type), |
970 Struct); | 978 Struct); |
971 } | 979 } |
972 | 980 |
973 Handle<PromiseResolveThenableJobInfo> Factory::NewPromiseResolveThenableJobInfo( | 981 Handle<PromiseResolveThenableJobInfo> Factory::NewPromiseResolveThenableJobInfo( |
974 Handle<JSReceiver> thenable, Handle<JSReceiver> then, | 982 Handle<JSReceiver> thenable, Handle<JSReceiver> then, |
(...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2707 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); | 2715 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
2708 iterator->set_initial_next(*next); | 2716 iterator->set_initial_next(*next); |
2709 iterator->set_array(*array); | 2717 iterator->set_array(*array); |
2710 iterator->set_index(0); | 2718 iterator->set_index(0); |
2711 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | 2719 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); |
2712 return iterator; | 2720 return iterator; |
2713 } | 2721 } |
2714 | 2722 |
2715 } // namespace internal | 2723 } // namespace internal |
2716 } // namespace v8 | 2724 } // namespace v8 |
OLD | NEW |