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( | |
966 Handle<JSFunction> function, Handle<Cell> already_visited, | |
967 Handle<JSObject> promise, Handle<Object> debug_event) { | |
968 Handle<FixedArray> array = NewFixedArray(Context::MIN_CONTEXT_SLOTS + 3); | |
969 array->set_map_no_write_barrier(*function_context_map()); | |
970 Handle<Context> context = Handle<Context>::cast(array); | |
971 context->set_closure(*function); | |
972 context->set_previous(function->context()); | |
973 context->set_extension(*the_hole_value()); | |
974 context->set_native_context(function->native_context()); | |
975 context->set(4, *already_visited); | |
976 context->set(5, *promise); | |
977 context->set(6, *debug_event); | |
adamk
2016/11/08 18:09:55
Looks like if you let the caller do the setting, y
gsathya
2016/11/08 20:03:19
NewDebugEvaluateContext and NewCatchContext have a
| |
978 return context; | |
979 } | |
965 | 980 |
966 Handle<Struct> Factory::NewStruct(InstanceType type) { | 981 Handle<Struct> Factory::NewStruct(InstanceType type) { |
967 CALL_HEAP_FUNCTION( | 982 CALL_HEAP_FUNCTION( |
968 isolate(), | 983 isolate(), |
969 isolate()->heap()->AllocateStruct(type), | 984 isolate()->heap()->AllocateStruct(type), |
970 Struct); | 985 Struct); |
971 } | 986 } |
972 | 987 |
973 Handle<PromiseResolveThenableJobInfo> Factory::NewPromiseResolveThenableJobInfo( | 988 Handle<PromiseResolveThenableJobInfo> Factory::NewPromiseResolveThenableJobInfo( |
974 Handle<JSReceiver> thenable, Handle<JSReceiver> then, | 989 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)); | 2722 Handle<JSFixedArrayIterator>::cast(NewJSObjectFromMap(map)); |
2708 iterator->set_initial_next(*next); | 2723 iterator->set_initial_next(*next); |
2709 iterator->set_array(*array); | 2724 iterator->set_array(*array); |
2710 iterator->set_index(0); | 2725 iterator->set_index(0); |
2711 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); | 2726 iterator->InObjectPropertyAtPut(JSFixedArrayIterator::kNextIndex, *next); |
2712 return iterator; | 2727 return iterator; |
2713 } | 2728 } |
2714 | 2729 |
2715 } // namespace internal | 2730 } // namespace internal |
2716 } // namespace v8 | 2731 } // namespace v8 |
OLD | NEW |