Fix FastAssign for self-assignment
Storing a data property on |target| can change |source|'s map if |target| and |source| are the same object. BUG=chromium:716520 Review-Url: https://codereview.chromium.org/2855133006 Cr-Commit-Position: refs/heads/master@{#45097}
This commit is contained in:
parent
6548f76c92
commit
1f51f66f73
@ -2062,11 +2062,10 @@ MUST_USE_RESULT Maybe<bool> FastAssign(
|
||||
|
||||
if (use_set) {
|
||||
LookupIterator it(target, next_key, target);
|
||||
bool call_to_js = it.IsFound() && it.state() != LookupIterator::DATA;
|
||||
Maybe<bool> result = Object::SetProperty(
|
||||
&it, prop_value, STRICT, Object::CERTAINLY_NOT_STORE_FROM_KEYED);
|
||||
if (result.IsNothing()) return result;
|
||||
if (stable && call_to_js) stable = from->map() == *map;
|
||||
if (stable) stable = from->map() == *map;
|
||||
} else {
|
||||
if (excluded_properties != nullptr &&
|
||||
HasExcludedProperty(excluded_properties, next_key)) {
|
||||
|
21
test/mjsunit/regress/regress-crbug-716520.js
Normal file
21
test/mjsunit/regress/regress-crbug-716520.js
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
var __v_0 = {};
|
||||
var __v_8 = this;
|
||||
var __v_11 = -1073741825;
|
||||
__v_1 = this;
|
||||
try {
|
||||
} catch(e) {; }
|
||||
function __f_4() {}
|
||||
__f_4.prototype = __v_0;
|
||||
function __f_9() { return new __f_4().v; }
|
||||
__f_9(); __f_9();
|
||||
try {
|
||||
(function() {
|
||||
})();
|
||||
} catch(e) {; }
|
||||
Object.assign(__v_0, __v_1, __v_0);
|
||||
(function() {
|
||||
})();
|
Loading…
Reference in New Issue
Block a user