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

Side by Side Diff: src/objects.cc

Issue 1086063003: Correctly handle clearing of deprecated field types. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 unified diff | Download patch
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 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 new_field_type, 2382 new_field_type,
2383 isolate)->NowIs(old_field_type)); 2383 isolate)->NowIs(old_field_type));
2384 return; 2384 return;
2385 } 2385 }
2386 2386
2387 // Determine the field owner. 2387 // Determine the field owner.
2388 Handle<Map> field_owner(map->FindFieldOwner(modify_index), isolate); 2388 Handle<Map> field_owner(map->FindFieldOwner(modify_index), isolate);
2389 Handle<DescriptorArray> descriptors( 2389 Handle<DescriptorArray> descriptors(
2390 field_owner->instance_descriptors(), isolate); 2390 field_owner->instance_descriptors(), isolate);
2391 DCHECK_EQ(*old_field_type, descriptors->GetFieldType(modify_index)); 2391 DCHECK_EQ(*old_field_type, descriptors->GetFieldType(modify_index));
2392 bool old_field_type_was_cleared =
2393 old_field_type->Is(HeapType::None()) && old_representation.IsHeapObject();
2392 2394
2393 // Determine the generalized new field type. 2395 // Determine the generalized new field type. Conservatively assume type Any
2394 new_field_type = Map::GeneralizeFieldType( 2396 // for cleared field types because the cleared type could have been a
2395 old_field_type, new_field_type, isolate); 2397 // deprecated map and there still could be live instances with a non-
2398 // deprecated version of the map.
2399 new_field_type =
2400 old_field_type_was_cleared
2401 ? HeapType::Any(isolate)
2402 : Map::GeneralizeFieldType(old_field_type, new_field_type, isolate);
2396 2403
2397 PropertyDetails details = descriptors->GetDetails(modify_index); 2404 PropertyDetails details = descriptors->GetDetails(modify_index);
2398 Handle<Name> name(descriptors->GetKey(modify_index)); 2405 Handle<Name> name(descriptors->GetKey(modify_index));
2399 2406
2400 Handle<Object> wrapped_type(WrapType(new_field_type)); 2407 Handle<Object> wrapped_type(WrapType(new_field_type));
2401 field_owner->UpdateFieldType(modify_index, name, new_representation, 2408 field_owner->UpdateFieldType(modify_index, name, new_representation,
2402 wrapped_type); 2409 wrapped_type);
2403 field_owner->dependent_code()->DeoptimizeDependentCodeGroup( 2410 field_owner->dependent_code()->DeoptimizeDependentCodeGroup(
2404 isolate, DependentCode::kFieldTypeGroup); 2411 isolate, DependentCode::kFieldTypeGroup);
2405 2412
(...skipping 14645 matching lines...) Expand 10 before | Expand all | Expand 10 after
17051 CompilationInfo* info) { 17058 CompilationInfo* info) {
17052 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17059 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17053 handle(cell->dependent_code(), info->isolate()), 17060 handle(cell->dependent_code(), info->isolate()),
17054 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17061 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17055 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17062 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17056 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17063 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17057 cell, info->zone()); 17064 cell, info->zone());
17058 } 17065 }
17059 17066
17060 } } // namespace v8::internal 17067 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-4027.js » ('j') | test/mjsunit/regress/regress-4027.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698