OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 8297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8308 shared_info); | 8308 shared_info); |
8309 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kContextOffset, context); | 8309 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kContextOffset, context); |
8310 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kCodeEntryOffset, code_entry, | 8310 StoreObjectFieldNoWriteBarrier(fun, JSFunction::kCodeEntryOffset, code_entry, |
8311 MachineType::PointerRepresentation()); | 8311 MachineType::PointerRepresentation()); |
8312 StoreObjectFieldRoot(fun, JSFunction::kNextFunctionLinkOffset, | 8312 StoreObjectFieldRoot(fun, JSFunction::kNextFunctionLinkOffset, |
8313 Heap::kUndefinedValueRootIndex); | 8313 Heap::kUndefinedValueRootIndex); |
8314 | 8314 |
8315 return fun; | 8315 return fun; |
8316 } | 8316 } |
8317 | 8317 |
8318 Node* CodeStubAssembler::AllocateJSPromise(Node* context) { | |
8319 Node* const native_context = LoadNativeContext(context); | |
8320 Node* const promise_fun = | |
8321 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX); | |
8322 Node* const initial_map = | |
8323 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset); | |
8324 Node* const instance = AllocateJSObjectFromMap(initial_map); | |
8325 | |
8326 return instance; | |
8327 } | |
8328 | |
8329 void CodeStubAssembler::PromiseInit(Node* promise) { | |
8330 StoreObjectField(promise, JSPromise::kStatusOffset, | |
8331 SmiConstant(v8::Promise::kPending)); | |
8332 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); | |
8333 } | |
8334 | |
8335 void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) { | |
8336 CSA_ASSERT(this, TaggedIsSmi(status)); | |
8337 StoreObjectField(promise, JSPromise::kStatusOffset, status); | |
8338 StoreObjectField(promise, JSPromise::kResultOffset, result); | |
8339 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0)); | |
8340 } | |
8341 | |
8342 Node* CodeStubAssembler::AllocatePromiseReactionJobInfo( | 8318 Node* CodeStubAssembler::AllocatePromiseReactionJobInfo( |
8343 Node* promise, Node* value, Node* tasks, Node* deferred_promise, | 8319 Node* promise, Node* value, Node* tasks, Node* deferred_promise, |
8344 Node* deferred_on_resolve, Node* deferred_on_reject, Node* context) { | 8320 Node* deferred_on_resolve, Node* deferred_on_reject, Node* context) { |
8345 Node* const result = Allocate(PromiseReactionJobInfo::kSize); | 8321 Node* const result = Allocate(PromiseReactionJobInfo::kSize); |
8346 StoreMapNoWriteBarrier(result, Heap::kPromiseReactionJobInfoMapRootIndex); | 8322 StoreMapNoWriteBarrier(result, Heap::kPromiseReactionJobInfoMapRootIndex); |
8347 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kValueOffset, | 8323 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kValueOffset, |
8348 value); | 8324 value); |
8349 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kPromiseOffset, | 8325 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kPromiseOffset, |
8350 promise); | 8326 promise); |
8351 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kTasksOffset, | 8327 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kTasksOffset, |
(...skipping 11 matching lines...) Expand all Loading... |
8363 StoreObjectFieldNoWriteBarrier(result, | 8339 StoreObjectFieldNoWriteBarrier(result, |
8364 PromiseReactionJobInfo::kDebugNameOffset, | 8340 PromiseReactionJobInfo::kDebugNameOffset, |
8365 SmiConstant(kDebugNotActive)); | 8341 SmiConstant(kDebugNotActive)); |
8366 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8342 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
8367 context); | 8343 context); |
8368 return result; | 8344 return result; |
8369 } | 8345 } |
8370 | 8346 |
8371 } // namespace internal | 8347 } // namespace internal |
8372 } // namespace v8 | 8348 } // namespace v8 |
OLD | NEW |