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

Unified Diff: src/objects.cc

Issue 1143623002: [strong] Implement per-object restrictions behaviour for prototype setting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: in test, make sure type feedback is reset for each object Created 5 years, 7 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
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index ecb5bf1b5164265ae48d7f4be04d01181a7c8c65..e2c49772aed8154f48bed6e4c22dedb520816dff 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12606,6 +12606,13 @@ MaybeHandle<Object> JSObject::SetPrototype(Handle<JSObject> object,
#endif
Isolate* isolate = object->GetIsolate();
+ // Strong objects may not have their prototype set via __proto__ or
+ // setPrototypeOf.
+ if (from_javascript && object->map()->is_strong()) {
+ THROW_NEW_ERROR(isolate,
+ NewTypeError(MessageTemplate::kStrongSetProto, object),
+ Object);
+ }
Heap* heap = isolate->heap();
// Silently ignore the change if value is not a JSObject or null.
// SpiderMonkey behaves this way.

Powered by Google App Engine
This is Rietveld 408576698