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/objects.h" | 5 #include "src/objects.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <iomanip> | 8 #include <iomanip> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 11084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11095 DCHECK(new_code_map->get(i + kContextOffset)->IsNativeContext()); | 11095 DCHECK(new_code_map->get(i + kContextOffset)->IsNativeContext()); |
11096 Object* code = new_code_map->get(i + kCachedCodeOffset); | 11096 Object* code = new_code_map->get(i + kCachedCodeOffset); |
11097 if (code != isolate->heap()->undefined_value()) { | 11097 if (code != isolate->heap()->undefined_value()) { |
11098 DCHECK(code->IsCode()); | 11098 DCHECK(code->IsCode()); |
11099 DCHECK(Code::cast(code)->kind() == Code::OPTIMIZED_FUNCTION); | 11099 DCHECK(Code::cast(code)->kind() == Code::OPTIMIZED_FUNCTION); |
11100 } | 11100 } |
11101 DCHECK(new_code_map->get(i + kLiteralsOffset)->IsFixedArray()); | 11101 DCHECK(new_code_map->get(i + kLiteralsOffset)->IsFixedArray()); |
11102 DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi()); | 11102 DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi()); |
11103 } | 11103 } |
11104 #endif | 11104 #endif |
| 11105 |
| 11106 if (Heap::ShouldZapGarbage()) { |
| 11107 // Zap any old optimized code map for heap-verifier. |
| 11108 if (!shared->optimized_code_map()->IsSmi()) { |
| 11109 FixedArray* old_code_map = FixedArray::cast(shared->optimized_code_map()); |
| 11110 old_code_map->FillWithHoles(0, old_code_map->length()); |
| 11111 } |
| 11112 } |
| 11113 |
11105 shared->set_optimized_code_map(*new_code_map); | 11114 shared->set_optimized_code_map(*new_code_map); |
11106 } | 11115 } |
11107 | 11116 |
11108 | 11117 |
11109 void SharedFunctionInfo::ClearOptimizedCodeMap() { | 11118 void SharedFunctionInfo::ClearOptimizedCodeMap() { |
11110 FixedArray* code_map = FixedArray::cast(optimized_code_map()); | 11119 if (Heap::ShouldZapGarbage()) { |
11111 | 11120 // Zap any old optimized code map for heap-verifier. |
11112 // If the next map link slot is already used then the function was | 11121 if (!optimized_code_map()->IsSmi()) { |
11113 // enqueued with code flushing and we remove it now. | 11122 FixedArray* old_code_map = FixedArray::cast(optimized_code_map()); |
11114 if (!code_map->get(kNextMapIndex)->IsUndefined()) { | 11123 old_code_map->FillWithHoles(0, old_code_map->length()); |
11115 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); | 11124 } |
11116 flusher->EvictOptimizedCodeMap(this); | |
11117 } | 11125 } |
11118 | 11126 |
11119 DCHECK(code_map->get(kNextMapIndex)->IsUndefined()); | |
11120 set_optimized_code_map(Smi::FromInt(0)); | 11127 set_optimized_code_map(Smi::FromInt(0)); |
11121 } | 11128 } |
11122 | 11129 |
11123 | 11130 |
11124 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, | 11131 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, |
11125 const char* reason) { | 11132 const char* reason) { |
11126 DisallowHeapAllocation no_gc; | 11133 DisallowHeapAllocation no_gc; |
11127 if (optimized_code_map()->IsSmi()) return; | 11134 if (optimized_code_map()->IsSmi()) return; |
11128 | 11135 |
11129 Heap* heap = GetHeap(); | 11136 Heap* heap = GetHeap(); |
(...skipping 6750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17880 if (cell->value() != *new_value) { | 17887 if (cell->value() != *new_value) { |
17881 cell->set_value(*new_value); | 17888 cell->set_value(*new_value); |
17882 Isolate* isolate = cell->GetIsolate(); | 17889 Isolate* isolate = cell->GetIsolate(); |
17883 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17890 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17884 isolate, DependentCode::kPropertyCellChangedGroup); | 17891 isolate, DependentCode::kPropertyCellChangedGroup); |
17885 } | 17892 } |
17886 } | 17893 } |
17887 | 17894 |
17888 } // namespace internal | 17895 } // namespace internal |
17889 } // namespace v8 | 17896 } // namespace v8 |
OLD | NEW |