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

Side by Side Diff: src/objects.cc

Issue 945403008: Invalidate property cells for non-existent properties properly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch for landing. Created 5 years, 10 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 | test/cctest/cctest.status » ('j') | 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 <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 15316 matching lines...) Expand 10 before | Expand all | Expand 10 after
15327 Isolate* isolate = global->GetIsolate(); 15327 Isolate* isolate = global->GetIsolate();
15328 int entry = global->property_dictionary()->FindEntry(name); 15328 int entry = global->property_dictionary()->FindEntry(name);
15329 if (entry != NameDictionary::kNotFound) { 15329 if (entry != NameDictionary::kNotFound) {
15330 Handle<PropertyCell> cell( 15330 Handle<PropertyCell> cell(
15331 PropertyCell::cast(global->property_dictionary()->ValueAt(entry))); 15331 PropertyCell::cast(global->property_dictionary()->ValueAt(entry)));
15332 15332
15333 Handle<Object> value(cell->value(), isolate); 15333 Handle<Object> value(cell->value(), isolate);
15334 Handle<PropertyCell> new_cell = isolate->factory()->NewPropertyCell(value); 15334 Handle<PropertyCell> new_cell = isolate->factory()->NewPropertyCell(value);
15335 global->property_dictionary()->ValueAtPut(entry, *new_cell); 15335 global->property_dictionary()->ValueAtPut(entry, *new_cell);
15336 15336
15337 Handle<Object> hole = global->GetIsolate()->factory()->the_hole_value(); 15337 Handle<Object> hole = isolate->factory()->the_hole_value();
15338 PropertyCell::SetValueInferType(cell, hole); 15338 if (*hole != *value) {
15339 PropertyCell::SetValueInferType(cell, hole);
15340 } else {
15341 // If property value was the hole, set it to any other value,
15342 // to ensure that LoadNonexistent ICs execute a miss.
15343 Handle<Object> undefined = isolate->factory()->undefined_value();
15344 PropertyCell::SetValueInferType(cell, undefined);
15345 }
15339 } 15346 }
15340 } 15347 }
15341 15348
15342 15349
15343 Handle<PropertyCell> GlobalObject::EnsurePropertyCell( 15350 Handle<PropertyCell> GlobalObject::EnsurePropertyCell(
15344 Handle<GlobalObject> global, Handle<Name> name) { 15351 Handle<GlobalObject> global, Handle<Name> name) {
15345 DCHECK(!global->HasFastProperties()); 15352 DCHECK(!global->HasFastProperties());
15346 int entry = global->property_dictionary()->FindEntry(name); 15353 int entry = global->property_dictionary()->FindEntry(name);
15347 if (entry == NameDictionary::kNotFound) { 15354 if (entry == NameDictionary::kNotFound) {
15348 Isolate* isolate = global->GetIsolate(); 15355 Isolate* isolate = global->GetIsolate();
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after
17160 CompilationInfo* info) { 17167 CompilationInfo* info) {
17161 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17168 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17162 handle(cell->dependent_code(), info->isolate()), 17169 handle(cell->dependent_code(), info->isolate()),
17163 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17170 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17164 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17171 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17165 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17172 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17166 cell, info->zone()); 17173 cell, info->zone());
17167 } 17174 }
17168 17175
17169 } } // namespace v8::internal 17176 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698