OLD | NEW |
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 6504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6515 } | 6515 } |
6516 } | 6516 } |
6517 HConstant* cell_constant = Add<HConstant>(cell); | 6517 HConstant* cell_constant = Add<HConstant>(cell); |
6518 auto access = HObjectAccess::ForPropertyCellValue(); | 6518 auto access = HObjectAccess::ForPropertyCellValue(); |
6519 if (cell_type == PropertyCellType::kConstantType) { | 6519 if (cell_type == PropertyCellType::kConstantType) { |
6520 switch (cell->GetConstantType()) { | 6520 switch (cell->GetConstantType()) { |
6521 case PropertyCellConstantType::kSmi: | 6521 case PropertyCellConstantType::kSmi: |
6522 access = access.WithRepresentation(Representation::Smi()); | 6522 access = access.WithRepresentation(Representation::Smi()); |
6523 break; | 6523 break; |
6524 case PropertyCellConstantType::kStableMap: { | 6524 case PropertyCellConstantType::kStableMap: { |
6525 // First check that the previous value of the {cell} still has the | 6525 // The map may no longer be stable, deopt if it's ever different from |
6526 // map that we are about to check the new {value} for. If not, then | 6526 // what is currently there, which will allow for restablization. |
6527 // the stable map assumption was invalidated and we cannot continue | 6527 Handle<Map> map(HeapObject::cast(cell->value())->map()); |
6528 // with the optimized code. | |
6529 Handle<HeapObject> cell_value(HeapObject::cast(cell->value())); | |
6530 Handle<Map> cell_value_map(cell_value->map()); | |
6531 HCheckMaps* cell_value_check = Add<HCheckMaps>( | |
6532 Add<HConstant>(cell_value, Representation::HeapObject()), | |
6533 cell_value_map); | |
6534 cell_value_check->ClearDependsOnFlag(kElementsKind); | |
6535 // Now check that the new {value} is a HeapObject with the same map. | |
6536 Add<HCheckHeapObject>(value); | 6528 Add<HCheckHeapObject>(value); |
6537 value = Add<HCheckMaps>(value, cell_value_map); | 6529 value = Add<HCheckMaps>(value, map); |
6538 access = access.WithRepresentation(Representation::HeapObject()); | 6530 access = access.WithRepresentation(Representation::HeapObject()); |
6539 break; | 6531 break; |
6540 } | 6532 } |
6541 } | 6533 } |
6542 } | 6534 } |
6543 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); | 6535 HInstruction* instr = Add<HStoreNamedField>(cell_constant, access, value); |
6544 instr->ClearChangesFlag(kInobjectFields); | 6536 instr->ClearChangesFlag(kInobjectFields); |
6545 instr->SetChangesFlag(kGlobalVars); | 6537 instr->SetChangesFlag(kGlobalVars); |
6546 if (instr->HasObservableSideEffects()) { | 6538 if (instr->HasObservableSideEffects()) { |
6547 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); | 6539 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |
(...skipping 6447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12995 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12987 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12996 } | 12988 } |
12997 | 12989 |
12998 #ifdef DEBUG | 12990 #ifdef DEBUG |
12999 graph_->Verify(false); // No full verify. | 12991 graph_->Verify(false); // No full verify. |
13000 #endif | 12992 #endif |
13001 } | 12993 } |
13002 | 12994 |
13003 } // namespace internal | 12995 } // namespace internal |
13004 } // namespace v8 | 12996 } // namespace v8 |
OLD | NEW |