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

Side by Side Diff: src/api.cc

Issue 2365833002: Add method on Value::IsAsyncFunction to detect async functions (Closed)
Patch Set: format Created 4 years, 3 months 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 | « include/v8.h ('k') | test/cctest/test-api.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 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 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 bool Value::IsNativeError() const { 3377 bool Value::IsNativeError() const {
3378 return Utils::OpenHandle(this)->IsJSError(); 3378 return Utils::OpenHandle(this)->IsJSError();
3379 } 3379 }
3380 3380
3381 3381
3382 bool Value::IsRegExp() const { 3382 bool Value::IsRegExp() const {
3383 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3383 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3384 return obj->IsJSRegExp(); 3384 return obj->IsJSRegExp();
3385 } 3385 }
3386 3386
3387 bool Value::IsAsyncFunction() const {
3388 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3389 if (!obj->IsJSFunction()) return false;
3390 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(obj);
3391 return func->shared()->is_async();
3392 }
3387 3393
3388 bool Value::IsGeneratorFunction() const { 3394 bool Value::IsGeneratorFunction() const {
3389 i::Handle<i::Object> obj = Utils::OpenHandle(this); 3395 i::Handle<i::Object> obj = Utils::OpenHandle(this);
3390 if (!obj->IsJSFunction()) return false; 3396 if (!obj->IsJSFunction()) return false;
3391 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(obj); 3397 i::Handle<i::JSFunction> func = i::Handle<i::JSFunction>::cast(obj);
3392 return func->shared()->is_generator(); 3398 return func->shared()->is_generator();
3393 } 3399 }
3394 3400
3395 3401
3396 bool Value::IsGeneratorObject() const { 3402 bool Value::IsGeneratorObject() const {
(...skipping 6056 matching lines...) Expand 10 before | Expand all | Expand 10 after
9453 Address callback_address = 9459 Address callback_address =
9454 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9460 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9455 VMState<EXTERNAL> state(isolate); 9461 VMState<EXTERNAL> state(isolate);
9456 ExternalCallbackScope call_scope(isolate, callback_address); 9462 ExternalCallbackScope call_scope(isolate, callback_address);
9457 callback(info); 9463 callback(info);
9458 } 9464 }
9459 9465
9460 9466
9461 } // namespace internal 9467 } // namespace internal
9462 } // namespace v8 9468 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698