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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 Handle<JSFunction> constructor( | 920 Handle<JSFunction> constructor( |
921 isolate()->native_context()->promise_function(), isolate()); | 921 isolate()->native_context()->promise_function(), isolate()); |
922 DCHECK(constructor->has_initial_map()); | 922 DCHECK(constructor->has_initial_map()); |
923 Handle<Map> map(constructor->initial_map(), isolate()); | 923 Handle<Map> map(constructor->initial_map(), isolate()); |
924 | 924 |
925 DCHECK(!map->is_prototype_map()); | 925 DCHECK(!map->is_prototype_map()); |
926 Handle<JSObject> promise_obj = NewJSObjectFromMap(map); | 926 Handle<JSObject> promise_obj = NewJSObjectFromMap(map); |
927 Handle<JSPromise> promise = Handle<JSPromise>::cast(promise_obj); | 927 Handle<JSPromise> promise = Handle<JSPromise>::cast(promise_obj); |
928 promise->set_status(v8::Promise::kPending); | 928 promise->set_status(v8::Promise::kPending); |
929 promise->set_flags(0); | 929 promise->set_flags(0); |
| 930 for (int i = 0; i < v8::Promise::kEmbedderFieldCount; i++) { |
| 931 promise->SetEmbedderField(i, Smi::kZero); |
| 932 } |
930 | 933 |
931 isolate()->RunPromiseHook(PromiseHookType::kInit, promise, undefined_value()); | 934 isolate()->RunPromiseHook(PromiseHookType::kInit, promise, undefined_value()); |
932 return promise; | 935 return promise; |
933 } | 936 } |
934 | 937 |
935 Handle<Context> Factory::NewNativeContext() { | 938 Handle<Context> Factory::NewNativeContext() { |
936 Handle<FixedArray> array = | 939 Handle<FixedArray> array = |
937 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); | 940 NewFixedArray(Context::NATIVE_CONTEXT_SLOTS, TENURED); |
938 array->set_map_no_write_barrier(*native_context_map()); | 941 array->set_map_no_write_barrier(*native_context_map()); |
939 Handle<Context> context = Handle<Context>::cast(array); | 942 Handle<Context> context = Handle<Context>::cast(array); |
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2952 Handle<AccessorInfo> prototype = | 2955 Handle<AccessorInfo> prototype = |
2953 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2956 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
2954 Descriptor d = Descriptor::AccessorConstant( | 2957 Descriptor d = Descriptor::AccessorConstant( |
2955 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2958 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
2956 map->AppendDescriptor(&d); | 2959 map->AppendDescriptor(&d); |
2957 } | 2960 } |
2958 } | 2961 } |
2959 | 2962 |
2960 } // namespace internal | 2963 } // namespace internal |
2961 } // namespace v8 | 2964 } // namespace v8 |
OLD | NEW |