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

Side by Side Diff: src/objects.cc

Issue 1261453004: Check whether a typed array was neutered before writing to it (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 3304 matching lines...) Expand 10 before | Expand all | Expand 10 after
3315 if (!value->IsNumber() && !value->IsUndefined()) { 3315 if (!value->IsNumber() && !value->IsUndefined()) {
3316 ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), to_assign, 3316 ASSIGN_RETURN_ON_EXCEPTION(it->isolate(), to_assign,
3317 Execution::ToNumber(it->isolate(), value), 3317 Execution::ToNumber(it->isolate(), value),
3318 Object); 3318 Object);
3319 // ToNumber above might modify the receiver, causing the cached 3319 // ToNumber above might modify the receiver, causing the cached
3320 // holder_map to mismatch the actual holder->map() after this point. 3320 // holder_map to mismatch the actual holder->map() after this point.
3321 // Reload the map to be in consistent state. Other cached state cannot 3321 // Reload the map to be in consistent state. Other cached state cannot
3322 // have been invalidated since typed array elements cannot be reconfigured 3322 // have been invalidated since typed array elements cannot be reconfigured
3323 // in any way. 3323 // in any way.
3324 it->ReloadHolderMap(); 3324 it->ReloadHolderMap();
3325
3326 // We have to recheck the length. However, it can only change if the
3327 // underlying buffer was neutered, so just check that.
3328 if (Handle<JSArrayBufferView>::cast(receiver)->WasNeutered()) {
3329 return value;
3330 }
3325 } 3331 }
3326 } 3332 }
3327 3333
3328 // Possibly migrate to the most up-to-date map that will be able to store 3334 // Possibly migrate to the most up-to-date map that will be able to store
3329 // |value| under it->name(). 3335 // |value| under it->name().
3330 it->PrepareForDataProperty(to_assign); 3336 it->PrepareForDataProperty(to_assign);
3331 3337
3332 // Write the property value. 3338 // Write the property value.
3333 it->WriteDataValue(to_assign); 3339 it->WriteDataValue(to_assign);
3334 3340
(...skipping 12437 matching lines...) Expand 10 before | Expand all | Expand 10 after
15772 if (cell->value() != *new_value) { 15778 if (cell->value() != *new_value) {
15773 cell->set_value(*new_value); 15779 cell->set_value(*new_value);
15774 Isolate* isolate = cell->GetIsolate(); 15780 Isolate* isolate = cell->GetIsolate();
15775 cell->dependent_code()->DeoptimizeDependentCodeGroup( 15781 cell->dependent_code()->DeoptimizeDependentCodeGroup(
15776 isolate, DependentCode::kPropertyCellChangedGroup); 15782 isolate, DependentCode::kPropertyCellChangedGroup);
15777 } 15783 }
15778 } 15784 }
15779 15785
15780 } // namespace internal 15786 } // namespace internal
15781 } // namespace v8 15787 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698