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

Unified Diff: src/builtins.cc

Issue 1905933002: MigrateInstance(target) before Object.assign(target, ...) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-object-assign-deprecated.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 20de25b8bc02917c429009d089cddf8e21248716..a74218c5455684feb4f8061909de13d2b33390ca 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -1635,6 +1635,14 @@ MUST_USE_RESULT Maybe<bool> FastAssign(Handle<JSReceiver> to,
String::cast(*next_source)->length() == 0);
}
+ // If the target is deprecated, the object will be updated on first store. If
+ // the source for that store equals the target, this will invalidate the
+ // cached representation of the source. Preventively upgrade the target.
+ // Do this on each iteration since any property load could cause deprecation.
+ if (to->map()->is_deprecated()) {
+ JSObject::MigrateInstance(Handle<JSObject>::cast(to));
+ }
+
Isolate* isolate = to->GetIsolate();
Handle<Map> map(JSReceiver::cast(*next_source)->map(), isolate);
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-object-assign-deprecated.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698