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

Unified Diff: src/api.cc

Issue 2812613002: [api] Expose instanceof through v8::Value::InstanceOf. (Closed)
Patch Set: test Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/counters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index be65add4b2515be163dfbef4c6442204c120681a..794f7b4a84cfa7c6a48aca1173fd26cbed6582c7 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -4094,6 +4094,18 @@ Local<String> Value::TypeOf(v8::Isolate* external_isolate) {
return Utils::ToLocal(i::Object::TypeOf(isolate, Utils::OpenHandle(this)));
}
+Maybe<bool> Value::InstanceOf(v8::Local<v8::Context> context,
+ v8::Local<v8::Object> object) {
+ PREPARE_FOR_EXECUTION_PRIMITIVE(context, Value, InstanceOf, bool);
+ auto left = Utils::OpenHandle(this);
+ auto right = Utils::OpenHandle(*object);
+ i::Handle<i::Object> result;
+ has_pending_exception =
+ !i::Object::InstanceOf(isolate, left, right).ToHandle(&result);
+ RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
+ return Just(result->IsTrue(isolate));
+}
+
Maybe<bool> v8::Object::Set(v8::Local<v8::Context> context,
v8::Local<Value> key, v8::Local<Value> value) {
PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, Set, bool);
@@ -5287,7 +5299,6 @@ Local<v8::Value> Function::GetBoundFunction() const {
return v8::Undefined(reinterpret_cast<v8::Isolate*>(self->GetIsolate()));
}
-
int Name::GetIdentityHash() {
auto self = Utils::OpenHandle(this);
return static_cast<int>(self->Hash());
« no previous file with comments | « include/v8.h ('k') | src/counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698