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

Unified Diff: src/builtins.cc

Issue 1441043002: [proxies] Implement [[PreventExtensions]] and [[IsExtensible]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 | « no previous file | src/js/v8natives.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 3e56ca4f47c5e2fcef0ada9ae69257f7fd420938..38be3ec8bf15e8a750e53c313b549a77cc1864e5 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1621,20 +1621,10 @@ BUILTIN(ReflectIsExtensible) {
"Reflect.isExtensible")));
}
- // TODO(neis): For now, we ignore proxies. Once proxies are fully
- // implemented, do something like the following:
- /*
- Maybe<bool> maybe = JSReceiver::IsExtensible(
- Handle<JSReceiver>::cast(target));
- if (!maybe.IsJust()) return isolate->heap()->exception();
- return *isolate->factory()->ToBoolean(maybe.FromJust());
- */
-
- if (target->IsJSObject()) {
- return *isolate->factory()->ToBoolean(
- JSObject::IsExtensible(Handle<JSObject>::cast(target)));
- }
- return *isolate->factory()->false_value();
+ Maybe<bool> result =
+ JSReceiver::IsExtensible(Handle<JSReceiver>::cast(target));
+ MAYBE_RETURN(result, isolate->heap()->exception());
+ return *isolate->factory()->ToBoolean(result.FromJust());
}
@@ -1676,8 +1666,8 @@ BUILTIN(ReflectPreventExtensions) {
Maybe<bool> result = JSReceiver::PreventExtensions(
Handle<JSReceiver>::cast(target), Object::DONT_THROW);
- return result.IsJust() ? *isolate->factory()->ToBoolean(result.FromJust())
- : isolate->heap()->exception();
+ MAYBE_RETURN(result, isolate->heap()->exception());
+ return *isolate->factory()->ToBoolean(result.FromJust());
}
« no previous file with comments | « no previous file | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698