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

Side by Side Diff: src/api.cc

Issue 2541283002: [promises] Port ResolvePromise to TF (Closed)
Patch Set: fix nits 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 | « no previous file | src/bootstrapper.cc » ('j') | src/js/promise.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 7220 matching lines...) Expand 10 before | Expand all | Expand 10 after
7231 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 7231 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
7232 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise); 7232 RETURN_TO_LOCAL_UNCHECKED(Then(context, handler), Promise);
7233 } 7233 }
7234 7234
7235 7235
7236 bool Promise::HasHandler() { 7236 bool Promise::HasHandler() {
7237 i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this); 7237 i::Handle<i::JSReceiver> promise = Utils::OpenHandle(this);
7238 i::Isolate* isolate = promise->GetIsolate(); 7238 i::Isolate* isolate = promise->GetIsolate();
7239 LOG_API(isolate, Promise, HasRejectHandler); 7239 LOG_API(isolate, Promise, HasRejectHandler);
7240 ENTER_V8(isolate); 7240 ENTER_V8(isolate);
7241 i::Handle<i::Symbol> key = isolate->factory()->promise_has_handler_symbol(); 7241 if (promise->IsJSPromise()) {
7242 return i::JSReceiver::GetDataProperty(promise, key)->IsTrue(isolate); 7242 i::Handle<i::JSPromise> js_promise = i::Handle<i::JSPromise>::cast(promise);
7243 return js_promise->has_handler();
7244 }
7245 return false;
7243 } 7246 }
7244 7247
7245 7248
7246 Local<Object> Proxy::GetTarget() { 7249 Local<Object> Proxy::GetTarget() {
7247 i::Handle<i::JSProxy> self = Utils::OpenHandle(this); 7250 i::Handle<i::JSProxy> self = Utils::OpenHandle(this);
7248 i::Handle<i::JSReceiver> target(self->target()); 7251 i::Handle<i::JSReceiver> target(self->target());
7249 return Utils::ToLocal(target); 7252 return Utils::ToLocal(target);
7250 } 7253 }
7251 7254
7252 7255
(...skipping 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after
9849 Address callback_address = 9852 Address callback_address =
9850 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9853 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9851 VMState<EXTERNAL> state(isolate); 9854 VMState<EXTERNAL> state(isolate);
9852 ExternalCallbackScope call_scope(isolate, callback_address); 9855 ExternalCallbackScope call_scope(isolate, callback_address);
9853 callback(info); 9856 callback(info);
9854 } 9857 }
9855 9858
9856 9859
9857 } // namespace internal 9860 } // namespace internal
9858 } // namespace v8 9861 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | src/js/promise.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698