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

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: Various changes. 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') | src/objects.h » ('J')
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 56c9641d4193afcb5b17bc05c8e6c9992a62d162..d6f953352cb83cb4b31256d029ffc5224f115877 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());
}
@@ -1653,8 +1643,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') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698