Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(439)

Side by Side Diff: src/code-stub-assembler.cc

Issue 2571663002: [promises] Refactor CreatePromise (Closed)
Patch Set: rename to allocatejspromise Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8227 matching lines...) Expand 10 before | Expand all | Expand 10 after
8238 } 8238 }
8239 8239
8240 Node* CodeStubAssembler::IsPromiseHookEnabled() { 8240 Node* CodeStubAssembler::IsPromiseHookEnabled() {
8241 Node* const is_promisehook_enabled = 8241 Node* const is_promisehook_enabled =
8242 Load(MachineType::Uint8(), 8242 Load(MachineType::Uint8(),
8243 ExternalConstant( 8243 ExternalConstant(
8244 ExternalReference::is_promisehook_enabled_address(isolate()))); 8244 ExternalReference::is_promisehook_enabled_address(isolate())));
8245 return WordNotEqual(is_promisehook_enabled, Int32Constant(0)); 8245 return WordNotEqual(is_promisehook_enabled, Int32Constant(0));
8246 } 8246 }
8247 8247
8248 Node* CodeStubAssembler::AllocateJSPromise(Node* context) {
8249 Node* const native_context = LoadNativeContext(context);
8250 Node* const promise_fun =
8251 LoadContextElement(native_context, Context::PROMISE_FUNCTION_INDEX);
8252 Node* const initial_map =
8253 LoadObjectField(promise_fun, JSFunction::kPrototypeOrInitialMapOffset);
8254 Node* const instance = AllocateJSObjectFromMap(initial_map);
8255
8256 return instance;
8257 }
8258
8259 void CodeStubAssembler::PromiseInit(Node* promise) {
8260 StoreObjectField(promise, JSPromise::kStatusOffset,
8261 SmiConstant(kPromisePending));
8262 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0));
8263 }
8264
8265 void CodeStubAssembler::PromiseSet(Node* promise, Node* status, Node* result) {
8266 CSA_ASSERT(this, TaggedIsSmi(status));
8267 StoreObjectField(promise, JSPromise::kStatusOffset, status);
8268 StoreObjectField(promise, JSPromise::kResultOffset, result);
8269 StoreObjectField(promise, JSPromise::kFlagsOffset, SmiConstant(0));
8270 }
8271
8248 } // namespace internal 8272 } // namespace internal
8249 } // namespace v8 8273 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | test/cctest/test-code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698