Commit 0b3d6f7a authored by verwaest's avatar verwaest Committed by Commit bot

Reload the map of typed arrays after performing ToNumber.

BUG=chromium:507980
LOG=n

Review URL: https://codereview.chromium.org/1234553002

Cr-Commit-Position: refs/heads/master@{#29570}
parent 40b64652
......@@ -101,6 +101,17 @@ void LookupIterator::ReloadPropertyInformation() {
}
void LookupIterator::ReloadHolderMap() {
DCHECK_EQ(DATA, state_);
DCHECK(IsElement());
DCHECK(JSObject::cast(*holder_)->HasExternalArrayElements() ||
JSObject::cast(*holder_)->HasFixedTypedArrayElements());
if (*holder_map_ != holder_->map()) {
holder_map_ = handle(holder_->map(), isolate_);
}
}
void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
DCHECK(state_ == DATA || state_ == ACCESSOR);
DCHECK(HolderIsReceiverOrHiddenPrototype());
......
......@@ -239,6 +239,7 @@ class LookupIterator final BASE_EMBEDDED {
Handle<Object> GetDataValue() const;
void WriteDataValue(Handle<Object> value);
void InternalizeName();
void ReloadHolderMap();
private:
enum class InterceptorState {
......
......@@ -3292,6 +3292,12 @@ MaybeHandle<Object> Object::SetDataProperty(LookupIterator* it,
ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), to_assign,
Execution::ToNumber(it->isolate(), value),
Object);
// ToNumber above might modify the receiver, causing the cached
// holder_map to mismatch the actual holder->map() after this point.
// Reload the map to be in consistent state. Other cached state cannot
// have been invalidated since typed array elements cannot be reconfigured
// in any way.
it->ReloadHolderMap();
}
}
......
// Copyright 2015 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.
__v_1 = new Float64Array(1);
__v_8 = { valueOf: function() { __v_13.y = "bar"; return 42; }};
__v_13 = __v_1;
__v_13[0] = __v_8;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment