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

Unified Diff: src/objects-inl.h

Issue 1497483004: [proxies] Make Array.isArray respect proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/array-isarray.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 586e23d55921db8be5636c5a2a982ac57b9c8d8d..e524ed40247f9d584a3ff764e2cdca75e3874b0e 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -179,6 +179,23 @@ bool Object::IsUniqueName() const {
}
+Maybe<bool> Object::IsArray() const {
Benedikt Meurer 2015/12/03 10:38:53 Mhm, given that this can throw, we probably should
jochen (gone - plz use gerrit) 2015/12/03 10:40:53 there needs to be a way to figure out whether some
+ if (this->IsJSArray()) return Just(true);
+ if (this->IsJSProxy()) {
+ const JSProxy* proxy = JSProxy::cast(this);
+ if (proxy->IsRevoked()) {
+ Isolate* isolate = proxy->GetIsolate();
+ isolate->Throw(*isolate->factory()->NewTypeError(
+ MessageTemplate::kProxyRevoked,
+ isolate->factory()->NewStringFromAsciiChecked("IsArray")));
+ return Nothing<bool>();
+ }
+ return proxy->target()->IsArray();
+ }
+ return Just(false);
+}
+
+
bool Object::IsCallable() const {
return Object::IsHeapObject() && HeapObject::cast(this)->map()->is_callable();
}
« no previous file with comments | « src/objects.cc ('k') | test/mjsunit/array-isarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698