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

Unified Diff: src/runtime/runtime-object.cc

Issue 1489423002: [proxies] Make Object.{freeze,seal} behave correctly for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add some tests. 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/runtime/runtime-classes.cc ('k') | test/mjsunit/es7/object-observe.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index bf13fbc45818f4d324b787dbaaadd5c1d4345230..b185287cd2b5c721efe12dd5cb639268f906378c 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -334,30 +334,24 @@ RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) {
RUNTIME_FUNCTION(Runtime_ObjectFreeze) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- // %ObjectFreeze is a fast path and these cases are handled elsewhere.
- RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() &&
- !object->map()->is_observed() && !object->IsJSProxy());
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Freeze(object));
- return *result;
+ MAYBE_RETURN(
+ JSReceiver::SetIntegrityLevel(object, FROZEN, Object::THROW_ON_ERROR),
+ isolate->heap()->exception());
+ return *object;
}
RUNTIME_FUNCTION(Runtime_ObjectSeal) {
HandleScope scope(isolate);
DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
-
- // %ObjectSeal is a fast path and these cases are handled elsewhere.
- RUNTIME_ASSERT(!object->HasSloppyArgumentsElements() &&
- !object->map()->is_observed() && !object->IsJSProxy());
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
- Handle<Object> result;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, JSObject::Seal(object));
- return *result;
+ MAYBE_RETURN(
+ JSReceiver::SetIntegrityLevel(object, SEALED, Object::THROW_ON_ERROR),
+ isolate->heap()->exception());
+ return *object;
}
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | test/mjsunit/es7/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698