| 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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength()); | 991 Handle<FixedArray> array = NewFixedArray(scope_info->ContextLength()); |
| 992 array->set_map_no_write_barrier(*block_context_map()); | 992 array->set_map_no_write_barrier(*block_context_map()); |
| 993 Handle<Context> context = Handle<Context>::cast(array); | 993 Handle<Context> context = Handle<Context>::cast(array); |
| 994 context->set_closure(*function); | 994 context->set_closure(*function); |
| 995 context->set_previous(*previous); | 995 context->set_previous(*previous); |
| 996 context->set_extension(*scope_info); | 996 context->set_extension(*scope_info); |
| 997 context->set_native_context(previous->native_context()); | 997 context->set_native_context(previous->native_context()); |
| 998 return context; | 998 return context; |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 Handle<Context> Factory::NewPromiseResolvingFunctionContext(int length) { | |
| 1002 DCHECK_GE(length, Context::MIN_CONTEXT_SLOTS); | |
| 1003 Handle<FixedArray> array = NewFixedArray(length); | |
| 1004 array->set_map_no_write_barrier(*function_context_map()); | |
| 1005 Handle<Context> context = Handle<Context>::cast(array); | |
| 1006 context->set_extension(*the_hole_value()); | |
| 1007 return context; | |
| 1008 } | |
| 1009 | |
| 1010 Handle<Struct> Factory::NewStruct(InstanceType type) { | 1001 Handle<Struct> Factory::NewStruct(InstanceType type) { |
| 1011 CALL_HEAP_FUNCTION( | 1002 CALL_HEAP_FUNCTION( |
| 1012 isolate(), | 1003 isolate(), |
| 1013 isolate()->heap()->AllocateStruct(type), | 1004 isolate()->heap()->AllocateStruct(type), |
| 1014 Struct); | 1005 Struct); |
| 1015 } | 1006 } |
| 1016 | 1007 |
| 1017 Handle<PromiseReactionJobInfo> Factory::NewPromiseReactionJobInfo( | |
| 1018 Handle<Object> value, Handle<Object> tasks, Handle<Object> deferred_promise, | |
| 1019 Handle<Object> deferred_on_resolve, Handle<Object> deferred_on_reject, | |
| 1020 Handle<Context> context) { | |
| 1021 Handle<PromiseReactionJobInfo> result = Handle<PromiseReactionJobInfo>::cast( | |
| 1022 NewStruct(PROMISE_REACTION_JOB_INFO_TYPE)); | |
| 1023 result->set_value(*value); | |
| 1024 result->set_tasks(*tasks); | |
| 1025 result->set_deferred_promise(*deferred_promise); | |
| 1026 result->set_deferred_on_resolve(*deferred_on_resolve); | |
| 1027 result->set_deferred_on_reject(*deferred_on_reject); | |
| 1028 result->set_debug_id(kDebugPromiseFirstID); | |
| 1029 result->set_context(*context); | |
| 1030 return result; | |
| 1031 } | |
| 1032 | |
| 1033 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( | 1008 Handle<AliasedArgumentsEntry> Factory::NewAliasedArgumentsEntry( |
| 1034 int aliased_context_slot) { | 1009 int aliased_context_slot) { |
| 1035 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( | 1010 Handle<AliasedArgumentsEntry> entry = Handle<AliasedArgumentsEntry>::cast( |
| 1036 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); | 1011 NewStruct(ALIASED_ARGUMENTS_ENTRY_TYPE)); |
| 1037 entry->set_aliased_context_slot(aliased_context_slot); | 1012 entry->set_aliased_context_slot(aliased_context_slot); |
| 1038 return entry; | 1013 return entry; |
| 1039 } | 1014 } |
| 1040 | 1015 |
| 1041 | 1016 |
| 1042 Handle<AccessorInfo> Factory::NewAccessorInfo() { | 1017 Handle<AccessorInfo> Factory::NewAccessorInfo() { |
| (...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2803 Handle<AccessorInfo> prototype = | 2778 Handle<AccessorInfo> prototype = |
| 2804 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2779 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
| 2805 Descriptor d = Descriptor::AccessorConstant( | 2780 Descriptor d = Descriptor::AccessorConstant( |
| 2806 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2781 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
| 2807 map->AppendDescriptor(&d); | 2782 map->AppendDescriptor(&d); |
| 2808 } | 2783 } |
| 2809 } | 2784 } |
| 2810 | 2785 |
| 2811 } // namespace internal | 2786 } // namespace internal |
| 2812 } // namespace v8 | 2787 } // namespace v8 |
| OLD | NEW |