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