| 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 11871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11882 } | 11882 } |
| 11883 | 11883 |
| 11884 | 11884 |
| 11885 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( | 11885 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( |
| 11886 Handle<SharedFunctionInfo> shared, Handle<Code> code) { | 11886 Handle<SharedFunctionInfo> shared, Handle<Code> code) { |
| 11887 Isolate* isolate = shared->GetIsolate(); | 11887 Isolate* isolate = shared->GetIsolate(); |
| 11888 if (isolate->serializer_enabled()) return; | 11888 if (isolate->serializer_enabled()) return; |
| 11889 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 11889 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 11890 // Empty code maps are unsupported. | 11890 // Empty code maps are unsupported. |
| 11891 if (shared->OptimizedCodeMapIsCleared()) return; | 11891 if (shared->OptimizedCodeMapIsCleared()) return; |
| 11892 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(code); | 11892 shared->optimized_code_map()->set(kSharedCodeIndex, *code); |
| 11893 shared->optimized_code_map()->set(kSharedCodeIndex, *cell); | |
| 11894 } | 11893 } |
| 11895 | 11894 |
| 11896 | 11895 |
| 11897 void SharedFunctionInfo::AddToOptimizedCodeMap( | 11896 void SharedFunctionInfo::AddToOptimizedCodeMap( |
| 11898 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, | 11897 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, |
| 11899 Handle<HeapObject> code, Handle<LiteralsArray> literals, | 11898 Handle<HeapObject> code, Handle<LiteralsArray> literals, |
| 11900 BailoutId osr_ast_id) { | 11899 BailoutId osr_ast_id) { |
| 11901 Isolate* isolate = shared->GetIsolate(); | 11900 Isolate* isolate = shared->GetIsolate(); |
| 11902 if (isolate->serializer_enabled()) return; | 11901 if (isolate->serializer_enabled()) return; |
| 11903 DCHECK(*code == isolate->heap()->undefined_value() || | 11902 DCHECK(*code == isolate->heap()->undefined_value() || |
| 11904 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); | 11903 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); |
| 11905 DCHECK(*code == isolate->heap()->undefined_value() || | 11904 DCHECK(*code == isolate->heap()->undefined_value() || |
| 11906 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); | 11905 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); |
| 11907 DCHECK(native_context->IsNativeContext()); | 11906 DCHECK(native_context->IsNativeContext()); |
| 11908 STATIC_ASSERT(kEntryLength == 4); | 11907 STATIC_ASSERT(kEntryLength == 4); |
| 11909 Handle<FixedArray> new_code_map; | 11908 Handle<FixedArray> new_code_map; |
| 11910 int entry; | 11909 int entry; |
| 11911 | |
| 11912 if (shared->OptimizedCodeMapIsCleared()) { | 11910 if (shared->OptimizedCodeMapIsCleared()) { |
| 11913 new_code_map = isolate->factory()->NewFixedArray(kInitialLength, TENURED); | 11911 new_code_map = isolate->factory()->NewFixedArray(kInitialLength, TENURED); |
| 11914 new_code_map->set(kSharedCodeIndex, *isolate->factory()->empty_weak_cell(), | |
| 11915 SKIP_WRITE_BARRIER); | |
| 11916 entry = kEntriesStart; | 11912 entry = kEntriesStart; |
| 11917 } else { | 11913 } else { |
| 11918 Handle<FixedArray> old_code_map(shared->optimized_code_map(), isolate); | 11914 Handle<FixedArray> old_code_map(shared->optimized_code_map(), isolate); |
| 11919 entry = shared->SearchOptimizedCodeMapEntry(*native_context, osr_ast_id); | 11915 entry = shared->SearchOptimizedCodeMapEntry(*native_context, osr_ast_id); |
| 11920 if (entry > kSharedCodeIndex) { | 11916 if (entry > kSharedCodeIndex) { |
| 11921 // Found an existing context-specific entry, it must not contain any code. | 11917 // Found an existing context-specific entry, it must not contain any code. |
| 11922 DCHECK(WeakCell::cast(old_code_map->get(entry + kCachedCodeOffset)) | 11918 DCHECK_EQ(isolate->heap()->undefined_value(), |
| 11923 ->cleared()); | 11919 old_code_map->get(entry + kCachedCodeOffset)); |
| 11924 // Just set the code and literals to the entry. | 11920 // Just set the code and literals to the entry. |
| 11925 Handle<WeakCell> code_cell = code->IsUndefined() | 11921 old_code_map->set(entry + kCachedCodeOffset, *code); |
| 11926 ? isolate->factory()->empty_weak_cell() | 11922 old_code_map->set(entry + kLiteralsOffset, *literals); |
| 11927 : isolate->factory()->NewWeakCell(code); | |
| 11928 Handle<WeakCell> literals_cell = | |
| 11929 isolate->factory()->NewWeakCell(literals); | |
| 11930 old_code_map->set(entry + kCachedCodeOffset, *code_cell); | |
| 11931 old_code_map->set(entry + kLiteralsOffset, *literals_cell); | |
| 11932 return; | 11923 return; |
| 11933 } | 11924 } |
| 11934 | 11925 |
| 11935 // Can we reuse an entry? | 11926 // Copy old optimized code map and append one new entry. |
| 11936 DCHECK(entry < kEntriesStart); | 11927 new_code_map = isolate->factory()->CopyFixedArrayAndGrow( |
| 11937 int length = old_code_map->length(); | 11928 old_code_map, kEntryLength, TENURED); |
| 11938 for (int i = kEntriesStart; i < length; i += kEntryLength) { | 11929 // TODO(mstarzinger): Temporary workaround. The allocation above might have |
| 11939 if (WeakCell::cast(old_code_map->get(i + kContextOffset))->cleared()) { | 11930 // flushed the optimized code map and the copy we created is full of holes. |
| 11940 entry = i; | 11931 // For now we just give up on adding the entry and pretend it got flushed. |
| 11941 break; | 11932 if (shared->OptimizedCodeMapIsCleared()) return; |
| 11942 } | 11933 entry = old_code_map->length(); |
| 11943 } | |
| 11944 | |
| 11945 if (entry < kEntriesStart) { | |
| 11946 // Copy old optimized code map and append one new entry. | |
| 11947 new_code_map = isolate->factory()->CopyFixedArrayAndGrow( | |
| 11948 old_code_map, kEntryLength, TENURED); | |
| 11949 // TODO(mstarzinger): Temporary workaround. The allocation above might | |
| 11950 // have flushed the optimized code map and the copy we created is full of | |
| 11951 // holes. For now we just give up on adding the entry and pretend it got | |
| 11952 // flushed. | |
| 11953 if (shared->OptimizedCodeMapIsCleared()) return; | |
| 11954 entry = old_code_map->length(); | |
| 11955 } | |
| 11956 } | 11934 } |
| 11957 | 11935 new_code_map->set(entry + kContextOffset, *native_context); |
| 11958 Handle<WeakCell> code_cell = code->IsUndefined() | 11936 new_code_map->set(entry + kCachedCodeOffset, *code); |
| 11959 ? isolate->factory()->empty_weak_cell() | 11937 new_code_map->set(entry + kLiteralsOffset, *literals); |
| 11960 : isolate->factory()->NewWeakCell(code); | |
| 11961 Handle<WeakCell> literals_cell = isolate->factory()->NewWeakCell(literals); | |
| 11962 WeakCell* context_cell = native_context->self_weak_cell(); | |
| 11963 | |
| 11964 new_code_map->set(entry + kContextOffset, context_cell); | |
| 11965 new_code_map->set(entry + kCachedCodeOffset, *code_cell); | |
| 11966 new_code_map->set(entry + kLiteralsOffset, *literals_cell); | |
| 11967 new_code_map->set(entry + kOsrAstIdOffset, Smi::FromInt(osr_ast_id.ToInt())); | 11938 new_code_map->set(entry + kOsrAstIdOffset, Smi::FromInt(osr_ast_id.ToInt())); |
| 11968 | 11939 |
| 11969 #ifdef DEBUG | 11940 #ifdef DEBUG |
| 11970 for (int i = kEntriesStart; i < new_code_map->length(); i += kEntryLength) { | 11941 for (int i = kEntriesStart; i < new_code_map->length(); i += kEntryLength) { |
| 11971 WeakCell* cell = WeakCell::cast(new_code_map->get(i + kContextOffset)); | 11942 DCHECK(new_code_map->get(i + kContextOffset)->IsNativeContext()); |
| 11972 DCHECK(cell->cleared() || cell->value()->IsNativeContext()); | 11943 Object* code = new_code_map->get(i + kCachedCodeOffset); |
| 11973 cell = WeakCell::cast(new_code_map->get(i + kCachedCodeOffset)); | 11944 if (code != isolate->heap()->undefined_value()) { |
| 11974 DCHECK(cell->cleared() || | 11945 DCHECK(code->IsCode()); |
| 11975 (cell->value()->IsCode() && | 11946 DCHECK(Code::cast(code)->kind() == Code::OPTIMIZED_FUNCTION); |
| 11976 Code::cast(cell->value())->kind() == Code::OPTIMIZED_FUNCTION)); | 11947 } |
| 11977 cell = WeakCell::cast(new_code_map->get(i + kLiteralsOffset)); | 11948 DCHECK(new_code_map->get(i + kLiteralsOffset)->IsFixedArray()); |
| 11978 DCHECK(cell->cleared() || cell->value()->IsFixedArray()); | |
| 11979 DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi()); | 11949 DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi()); |
| 11980 } | 11950 } |
| 11981 #endif | 11951 #endif |
| 11982 | 11952 |
| 11983 // Zap any old optimized code map. | 11953 // Zap any old optimized code map. |
| 11984 if (!shared->OptimizedCodeMapIsCleared()) { | 11954 if (!shared->OptimizedCodeMapIsCleared()) { |
| 11985 FixedArray* old_code_map = shared->optimized_code_map(); | 11955 FixedArray* old_code_map = shared->optimized_code_map(); |
| 11986 old_code_map->FillWithHoles(0, old_code_map->length()); | 11956 old_code_map->FillWithHoles(0, old_code_map->length()); |
| 11987 } | 11957 } |
| 11988 | 11958 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 12005 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, | 11975 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, |
| 12006 const char* reason) { | 11976 const char* reason) { |
| 12007 DisallowHeapAllocation no_gc; | 11977 DisallowHeapAllocation no_gc; |
| 12008 if (OptimizedCodeMapIsCleared()) return; | 11978 if (OptimizedCodeMapIsCleared()) return; |
| 12009 | 11979 |
| 12010 Heap* heap = GetHeap(); | 11980 Heap* heap = GetHeap(); |
| 12011 FixedArray* code_map = optimized_code_map(); | 11981 FixedArray* code_map = optimized_code_map(); |
| 12012 int dst = kEntriesStart; | 11982 int dst = kEntriesStart; |
| 12013 int length = code_map->length(); | 11983 int length = code_map->length(); |
| 12014 for (int src = kEntriesStart; src < length; src += kEntryLength) { | 11984 for (int src = kEntriesStart; src < length; src += kEntryLength) { |
| 12015 DCHECK(WeakCell::cast(code_map->get(src))->cleared() || | 11985 DCHECK(code_map->get(src)->IsNativeContext()); |
| 12016 WeakCell::cast(code_map->get(src))->value()->IsNativeContext()); | 11986 if (code_map->get(src + kCachedCodeOffset) == optimized_code) { |
| 12017 if (WeakCell::cast(code_map->get(src + kCachedCodeOffset))->value() == | |
| 12018 optimized_code) { | |
| 12019 BailoutId osr(Smi::cast(code_map->get(src + kOsrAstIdOffset))->value()); | 11987 BailoutId osr(Smi::cast(code_map->get(src + kOsrAstIdOffset))->value()); |
| 12020 if (FLAG_trace_opt) { | 11988 if (FLAG_trace_opt) { |
| 12021 PrintF("[evicting entry from optimizing code map (%s) for ", reason); | 11989 PrintF("[evicting entry from optimizing code map (%s) for ", reason); |
| 12022 ShortPrint(); | 11990 ShortPrint(); |
| 12023 if (osr.IsNone()) { | 11991 if (osr.IsNone()) { |
| 12024 PrintF("]\n"); | 11992 PrintF("]\n"); |
| 12025 } else { | 11993 } else { |
| 12026 PrintF(" (osr ast id %d)]\n", osr.ToInt()); | 11994 PrintF(" (osr ast id %d)]\n", osr.ToInt()); |
| 12027 } | 11995 } |
| 12028 } | 11996 } |
| 12029 if (!osr.IsNone()) { | 11997 if (!osr.IsNone()) { |
| 12030 // Evict the src entry by not copying it to the dst entry. | 11998 // Evict the src entry by not copying it to the dst entry. |
| 12031 continue; | 11999 continue; |
| 12032 } | 12000 } |
| 12033 // In case of non-OSR entry just clear the code in order to proceed | 12001 // In case of non-OSR entry just clear the code in order to proceed |
| 12034 // sharing literals. | 12002 // sharing literals. |
| 12035 code_map->set(src + kCachedCodeOffset, heap->empty_weak_cell(), | 12003 code_map->set_undefined(src + kCachedCodeOffset); |
| 12036 SKIP_WRITE_BARRIER); | |
| 12037 } | 12004 } |
| 12038 | 12005 |
| 12039 // Keep the src entry by copying it to the dst entry. | 12006 // Keep the src entry by copying it to the dst entry. |
| 12040 if (dst != src) { | 12007 if (dst != src) { |
| 12041 code_map->set(dst + kContextOffset, code_map->get(src + kContextOffset)); | 12008 code_map->set(dst + kContextOffset, code_map->get(src + kContextOffset)); |
| 12042 code_map->set(dst + kCachedCodeOffset, | 12009 code_map->set(dst + kCachedCodeOffset, |
| 12043 code_map->get(src + kCachedCodeOffset)); | 12010 code_map->get(src + kCachedCodeOffset)); |
| 12044 code_map->set(dst + kLiteralsOffset, | 12011 code_map->set(dst + kLiteralsOffset, |
| 12045 code_map->get(src + kLiteralsOffset)); | 12012 code_map->get(src + kLiteralsOffset)); |
| 12046 code_map->set(dst + kOsrAstIdOffset, | 12013 code_map->set(dst + kOsrAstIdOffset, |
| 12047 code_map->get(src + kOsrAstIdOffset)); | 12014 code_map->get(src + kOsrAstIdOffset)); |
| 12048 } | 12015 } |
| 12049 dst += kEntryLength; | 12016 dst += kEntryLength; |
| 12050 } | 12017 } |
| 12051 if (WeakCell::cast(code_map->get(kSharedCodeIndex))->value() == | 12018 if (code_map->get(kSharedCodeIndex) == optimized_code) { |
| 12052 optimized_code) { | |
| 12053 // Evict context-independent code as well. | 12019 // Evict context-independent code as well. |
| 12054 code_map->set(kSharedCodeIndex, heap->empty_weak_cell(), | 12020 code_map->set_undefined(kSharedCodeIndex); |
| 12055 SKIP_WRITE_BARRIER); | |
| 12056 if (FLAG_trace_opt) { | 12021 if (FLAG_trace_opt) { |
| 12057 PrintF("[evicting entry from optimizing code map (%s) for ", reason); | 12022 PrintF("[evicting entry from optimizing code map (%s) for ", reason); |
| 12058 ShortPrint(); | 12023 ShortPrint(); |
| 12059 PrintF(" (context-independent code)]\n"); | 12024 PrintF(" (context-independent code)]\n"); |
| 12060 } | 12025 } |
| 12061 } | 12026 } |
| 12062 if (dst != length) { | 12027 if (dst != length) { |
| 12063 // Always trim even when array is cleared because of heap verifier. | 12028 // Always trim even when array is cleared because of heap verifier. |
| 12064 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map, | 12029 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map, |
| 12065 length - dst); | 12030 length - dst); |
| 12066 if (code_map->length() == kEntriesStart && | 12031 if (code_map->length() == kEntriesStart && |
| 12067 WeakCell::cast(code_map->get(kSharedCodeIndex))->cleared()) { | 12032 code_map->get(kSharedCodeIndex)->IsUndefined()) { |
| 12068 ClearOptimizedCodeMap(); | 12033 ClearOptimizedCodeMap(); |
| 12069 } | 12034 } |
| 12070 } | 12035 } |
| 12071 } | 12036 } |
| 12072 | 12037 |
| 12073 | 12038 |
| 12074 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) { | 12039 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) { |
| 12075 FixedArray* code_map = optimized_code_map(); | 12040 FixedArray* code_map = optimized_code_map(); |
| 12076 DCHECK(shrink_by % kEntryLength == 0); | 12041 DCHECK(shrink_by % kEntryLength == 0); |
| 12077 DCHECK(shrink_by <= code_map->length() - kEntriesStart); | 12042 DCHECK(shrink_by <= code_map->length() - kEntriesStart); |
| 12078 // Always trim even when array is cleared because of heap verifier. | 12043 // Always trim even when array is cleared because of heap verifier. |
| 12079 GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map, | 12044 GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map, |
| 12080 shrink_by); | 12045 shrink_by); |
| 12081 if (code_map->length() == kEntriesStart && | 12046 if (code_map->length() == kEntriesStart && |
| 12082 WeakCell::cast(code_map->get(kSharedCodeIndex))->cleared()) { | 12047 code_map->get(kSharedCodeIndex)->IsUndefined()) { |
| 12083 ClearOptimizedCodeMap(); | 12048 ClearOptimizedCodeMap(); |
| 12084 } | 12049 } |
| 12085 } | 12050 } |
| 12086 | 12051 |
| 12087 | 12052 |
| 12088 static void GetMinInobjectSlack(Map* map, void* data) { | 12053 static void GetMinInobjectSlack(Map* map, void* data) { |
| 12089 int slack = map->unused_property_fields(); | 12054 int slack = map->unused_property_fields(); |
| 12090 if (*reinterpret_cast<int*>(data) > slack) { | 12055 if (*reinterpret_cast<int*>(data) > slack) { |
| 12091 *reinterpret_cast<int*>(data) = slack; | 12056 *reinterpret_cast<int*>(data) = slack; |
| 12092 } | 12057 } |
| (...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13317 | 13282 |
| 13318 int SharedFunctionInfo::SearchOptimizedCodeMapEntry(Context* native_context, | 13283 int SharedFunctionInfo::SearchOptimizedCodeMapEntry(Context* native_context, |
| 13319 BailoutId osr_ast_id) { | 13284 BailoutId osr_ast_id) { |
| 13320 DisallowHeapAllocation no_gc; | 13285 DisallowHeapAllocation no_gc; |
| 13321 DCHECK(native_context->IsNativeContext()); | 13286 DCHECK(native_context->IsNativeContext()); |
| 13322 if (!OptimizedCodeMapIsCleared()) { | 13287 if (!OptimizedCodeMapIsCleared()) { |
| 13323 FixedArray* optimized_code_map = this->optimized_code_map(); | 13288 FixedArray* optimized_code_map = this->optimized_code_map(); |
| 13324 int length = optimized_code_map->length(); | 13289 int length = optimized_code_map->length(); |
| 13325 Smi* osr_ast_id_smi = Smi::FromInt(osr_ast_id.ToInt()); | 13290 Smi* osr_ast_id_smi = Smi::FromInt(osr_ast_id.ToInt()); |
| 13326 for (int i = kEntriesStart; i < length; i += kEntryLength) { | 13291 for (int i = kEntriesStart; i < length; i += kEntryLength) { |
| 13327 if (WeakCell::cast(optimized_code_map->get(i + kContextOffset)) | 13292 if (optimized_code_map->get(i + kContextOffset) == native_context && |
| 13328 ->value() == native_context && | |
| 13329 optimized_code_map->get(i + kOsrAstIdOffset) == osr_ast_id_smi) { | 13293 optimized_code_map->get(i + kOsrAstIdOffset) == osr_ast_id_smi) { |
| 13330 return i; | 13294 return i; |
| 13331 } | 13295 } |
| 13332 } | 13296 } |
| 13333 Object* shared_code = | 13297 Object* shared_code = optimized_code_map->get(kSharedCodeIndex); |
| 13334 WeakCell::cast(optimized_code_map->get(kSharedCodeIndex))->value(); | |
| 13335 if (shared_code->IsCode() && osr_ast_id.IsNone()) { | 13298 if (shared_code->IsCode() && osr_ast_id.IsNone()) { |
| 13336 return kSharedCodeIndex; | 13299 return kSharedCodeIndex; |
| 13337 } | 13300 } |
| 13338 } | 13301 } |
| 13339 return -1; | 13302 return -1; |
| 13340 } | 13303 } |
| 13341 | 13304 |
| 13342 | 13305 |
| 13343 CodeAndLiterals SharedFunctionInfo::SearchOptimizedCodeMap( | 13306 CodeAndLiterals SharedFunctionInfo::SearchOptimizedCodeMap( |
| 13344 Context* native_context, BailoutId osr_ast_id) { | 13307 Context* native_context, BailoutId osr_ast_id) { |
| 13345 CodeAndLiterals result = {nullptr, nullptr}; | 13308 CodeAndLiterals result = {nullptr, nullptr}; |
| 13346 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); | 13309 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); |
| 13347 if (entry != kNotFound) { | 13310 if (entry != kNotFound) { |
| 13348 FixedArray* code_map = optimized_code_map(); | 13311 FixedArray* code_map = optimized_code_map(); |
| 13349 if (entry == kSharedCodeIndex) { | 13312 if (entry == kSharedCodeIndex) { |
| 13350 // We know the weak cell isn't cleared because we made sure of it in | 13313 result = {Code::cast(code_map->get(kSharedCodeIndex)), nullptr}; |
| 13351 // SearchOptimizedCodeMapEntry and performed no allocations since that | 13314 |
| 13352 // call. | |
| 13353 result = { | |
| 13354 Code::cast(WeakCell::cast(code_map->get(kSharedCodeIndex))->value()), | |
| 13355 nullptr}; | |
| 13356 } else { | 13315 } else { |
| 13357 DCHECK_LE(entry + kEntryLength, code_map->length()); | 13316 DCHECK_LE(entry + kEntryLength, code_map->length()); |
| 13358 WeakCell* cell = WeakCell::cast(code_map->get(entry + kCachedCodeOffset)); | 13317 Object* code = code_map->get(entry + kCachedCodeOffset); |
| 13359 WeakCell* literals_cell = | 13318 result = {code->IsUndefined() ? nullptr : Code::cast(code), |
| 13360 WeakCell::cast(code_map->get(entry + kLiteralsOffset)); | 13319 LiteralsArray::cast(code_map->get(entry + kLiteralsOffset))}; |
| 13361 | |
| 13362 result = {cell->cleared() ? nullptr : Code::cast(cell->value()), | |
| 13363 literals_cell->cleared() | |
| 13364 ? nullptr | |
| 13365 : LiteralsArray::cast(literals_cell->value())}; | |
| 13366 } | 13320 } |
| 13367 } | 13321 } |
| 13368 if (FLAG_trace_opt && !OptimizedCodeMapIsCleared() && | 13322 if (FLAG_trace_opt && !OptimizedCodeMapIsCleared() && |
| 13369 result.code == nullptr) { | 13323 result.code == nullptr) { |
| 13370 PrintF("[didn't find optimized code in optimized code map for "); | 13324 PrintF("[didn't find optimized code in optimized code map for "); |
| 13371 ShortPrint(); | 13325 ShortPrint(); |
| 13372 PrintF("]\n"); | 13326 PrintF("]\n"); |
| 13373 } | 13327 } |
| 13374 return result; | 13328 return result; |
| 13375 } | 13329 } |
| (...skipping 5805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19181 if (cell->value() != *new_value) { | 19135 if (cell->value() != *new_value) { |
| 19182 cell->set_value(*new_value); | 19136 cell->set_value(*new_value); |
| 19183 Isolate* isolate = cell->GetIsolate(); | 19137 Isolate* isolate = cell->GetIsolate(); |
| 19184 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19138 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19185 isolate, DependentCode::kPropertyCellChangedGroup); | 19139 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19186 } | 19140 } |
| 19187 } | 19141 } |
| 19188 | 19142 |
| 19189 } // namespace internal | 19143 } // namespace internal |
| 19190 } // namespace v8 | 19144 } // namespace v8 |
| OLD | NEW |