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

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2456763002: Merged: [compiler] Properly validate stable map assumption for globals. (Closed)
Patch Set: Created 4 years, 1 month 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 | « src/compiler/js-global-object-specialization.cc ('k') | src/runtime/runtime-utils.h » ('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 "src/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 6881 matching lines...) Expand 10 before | Expand all | Expand 10 after
6892 } 6892 }
6893 } 6893 }
6894 HConstant* cell_constant = Add<HConstant>(cell); 6894 HConstant* cell_constant = Add<HConstant>(cell);
6895 auto access = HObjectAccess::ForPropertyCellValue(); 6895 auto access = HObjectAccess::ForPropertyCellValue();
6896 if (cell_type == PropertyCellType::kConstantType) { 6896 if (cell_type == PropertyCellType::kConstantType) {
6897 switch (cell->GetConstantType()) { 6897 switch (cell->GetConstantType()) {
6898 case PropertyCellConstantType::kSmi: 6898 case PropertyCellConstantType::kSmi:
6899 access = access.WithRepresentation(Representation::Smi()); 6899 access = access.WithRepresentation(Representation::Smi());
6900 break; 6900 break;
6901 case PropertyCellConstantType::kStableMap: { 6901 case PropertyCellConstantType::kStableMap: {
6902 // The map may no longer be stable, deopt if it's ever different from 6902 // First check that the previous value of the {cell} still has the
6903 // what is currently there, which will allow for restablization. 6903 // map that we are about to check the new {value} for. If not, then
6904 Handle<Map> map(HeapObject::cast(cell->value())->map()); 6904 // the stable map assumption was invalidated and we cannot continue
6905 // with the optimized code.
6906 Handle<HeapObject> cell_value(HeapObject::cast(cell->value()));
6907 Handle<Map> cell_value_map(cell_value->map());
6908 if (!cell_value_map->is_stable()) {
6909 return Bailout(kUnstableConstantTypeHeapObject);
6910 }
6911 top_info()->dependencies()->AssumeMapStable(cell_value_map);
6912 // Now check that the new {value} is a HeapObject with the same map.
6905 Add<HCheckHeapObject>(value); 6913 Add<HCheckHeapObject>(value);
6906 value = Add<HCheckMaps>(value, map); 6914 value = Add<HCheckMaps>(value, cell_value_map);
6907 access = access.WithRepresentation(Representation::HeapObject()); 6915 access = access.WithRepresentation(Representation::HeapObject());
6908 break; 6916 break;
6909 } 6917 }
6910 } 6918 }
6911 } 6919 }
6912 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); 6920 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value);
6913 instr->ClearChangesFlag(kInobjectFields); 6921 instr->ClearChangesFlag(kInobjectFields);
6914 instr->SetChangesFlag(kGlobalVars); 6922 instr->SetChangesFlag(kGlobalVars);
6915 if (instr->HasObservableSideEffects()) { 6923 if (instr->HasObservableSideEffects()) {
6916 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 6924 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
(...skipping 6516 matching lines...) Expand 10 before | Expand all | Expand 10 after
13433 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13441 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13434 } 13442 }
13435 13443
13436 #ifdef DEBUG 13444 #ifdef DEBUG
13437 graph_->Verify(false); // No full verify. 13445 graph_->Verify(false); // No full verify.
13438 #endif 13446 #endif
13439 } 13447 }
13440 13448
13441 } // namespace internal 13449 } // namespace internal
13442 } // namespace v8 13450 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-global-object-specialization.cc ('k') | src/runtime/runtime-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698