Chromium Code Reviews| 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 11397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11408 } | 11408 } |
| 11409 | 11409 |
| 11410 | 11410 |
| 11411 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( | 11411 void SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap( |
| 11412 Handle<SharedFunctionInfo> shared, Handle<Code> code) { | 11412 Handle<SharedFunctionInfo> shared, Handle<Code> code) { |
| 11413 Isolate* isolate = shared->GetIsolate(); | 11413 Isolate* isolate = shared->GetIsolate(); |
| 11414 if (isolate->serializer_enabled()) return; | 11414 if (isolate->serializer_enabled()) return; |
| 11415 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); | 11415 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION); |
| 11416 // Empty code maps are unsupported. | 11416 // Empty code maps are unsupported. |
| 11417 if (shared->OptimizedCodeMapIsCleared()) return; | 11417 if (shared->OptimizedCodeMapIsCleared()) return; |
| 11418 shared->optimized_code_map()->set(kSharedCodeIndex, *code); | 11418 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(code); |
| 11419 shared->optimized_code_map()->set(kSharedCodeIndex, *cell); | |
| 11419 } | 11420 } |
| 11420 | 11421 |
| 11421 | 11422 |
| 11422 void SharedFunctionInfo::AddToOptimizedCodeMap( | 11423 void SharedFunctionInfo::AddToOptimizedCodeMap( |
| 11423 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, | 11424 Handle<SharedFunctionInfo> shared, Handle<Context> native_context, |
| 11424 Handle<HeapObject> code, Handle<LiteralsArray> literals, | 11425 Handle<HeapObject> code, Handle<LiteralsArray> literals, |
| 11425 BailoutId osr_ast_id) { | 11426 BailoutId osr_ast_id) { |
| 11426 Isolate* isolate = shared->GetIsolate(); | 11427 Isolate* isolate = shared->GetIsolate(); |
| 11427 if (isolate->serializer_enabled()) return; | 11428 if (isolate->serializer_enabled()) return; |
| 11428 DCHECK(*code == isolate->heap()->undefined_value() || | 11429 DCHECK(*code == isolate->heap()->undefined_value() || |
| 11429 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); | 11430 !shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code); |
| 11430 DCHECK(*code == isolate->heap()->undefined_value() || | 11431 DCHECK(*code == isolate->heap()->undefined_value() || |
| 11431 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); | 11432 Code::cast(*code)->kind() == Code::OPTIMIZED_FUNCTION); |
| 11432 DCHECK(native_context->IsNativeContext()); | 11433 DCHECK(native_context->IsNativeContext()); |
| 11433 STATIC_ASSERT(kEntryLength == 4); | 11434 STATIC_ASSERT(kEntryLength == 4); |
| 11434 Handle<FixedArray> new_code_map; | 11435 Handle<FixedArray> new_code_map; |
| 11435 int entry; | 11436 int entry; |
| 11436 if (shared->OptimizedCodeMapIsCleared()) { | 11437 if (shared->OptimizedCodeMapIsCleared()) { |
| 11437 new_code_map = isolate->factory()->NewFixedArray(kInitialLength, TENURED); | 11438 new_code_map = isolate->factory()->NewFixedArray(kInitialLength, TENURED); |
| 11439 new_code_map->set(kSharedCodeIndex, *isolate->factory()->empty_weak_cell(), | |
| 11440 SKIP_WRITE_BARRIER); | |
|
ulan
2015/11/27 10:03:18
Either
1) keep the write barrier
2) or add empty_w
mvstanton
2015/12/01 11:28:15
Nice! I'll do 2), because I'd like to believe I ca
| |
| 11438 entry = kEntriesStart; | 11441 entry = kEntriesStart; |
| 11439 } else { | 11442 } else { |
| 11440 Handle<FixedArray> old_code_map(shared->optimized_code_map(), isolate); | 11443 Handle<FixedArray> old_code_map(shared->optimized_code_map(), isolate); |
| 11441 entry = shared->SearchOptimizedCodeMapEntry(*native_context, osr_ast_id); | 11444 entry = shared->SearchOptimizedCodeMapEntry(*native_context, osr_ast_id); |
| 11442 if (entry > kSharedCodeIndex) { | 11445 if (entry > kSharedCodeIndex) { |
| 11443 // Found an existing context-specific entry, it must not contain any code. | 11446 // Found an existing context-specific entry, it must not contain any code. |
| 11444 DCHECK_EQ(isolate->heap()->undefined_value(), | 11447 DCHECK(WeakCell::cast(old_code_map->get(entry + kCachedCodeOffset)) |
| 11445 old_code_map->get(entry + kCachedCodeOffset)); | 11448 ->cleared()); |
| 11446 // Just set the code and literals to the entry. | 11449 // Just set the code and literals to the entry. |
| 11447 old_code_map->set(entry + kCachedCodeOffset, *code); | 11450 Handle<WeakCell> code_cell = code->IsUndefined() |
| 11448 old_code_map->set(entry + kLiteralsOffset, *literals); | 11451 ? isolate->factory()->empty_weak_cell() |
| 11452 : isolate->factory()->NewWeakCell(code); | |
| 11453 Handle<WeakCell> literals_cell = | |
| 11454 isolate->factory()->NewWeakCell(literals); | |
| 11455 old_code_map->set(entry + kCachedCodeOffset, *code_cell); | |
| 11456 old_code_map->set(entry + kLiteralsOffset, *literals_cell); | |
| 11449 return; | 11457 return; |
| 11450 } | 11458 } |
| 11451 | 11459 |
| 11452 // Copy old optimized code map and append one new entry. | 11460 // Copy old optimized code map and append one new entry. |
|
ulan
2015/11/27 10:03:18
Should we try to compact the array before growing
mvstanton
2015/12/01 11:28:15
I'll do a search for a hole. If there is a cleared
| |
| 11453 new_code_map = isolate->factory()->CopyFixedArrayAndGrow( | 11461 new_code_map = isolate->factory()->CopyFixedArrayAndGrow( |
| 11454 old_code_map, kEntryLength, TENURED); | 11462 old_code_map, kEntryLength, TENURED); |
| 11455 // TODO(mstarzinger): Temporary workaround. The allocation above might have | 11463 // TODO(mstarzinger): Temporary workaround. The allocation above might have |
| 11456 // flushed the optimized code map and the copy we created is full of holes. | 11464 // flushed the optimized code map and the copy we created is full of holes. |
| 11457 // For now we just give up on adding the entry and pretend it got flushed. | 11465 // For now we just give up on adding the entry and pretend it got flushed. |
| 11458 if (shared->OptimizedCodeMapIsCleared()) return; | 11466 if (shared->OptimizedCodeMapIsCleared()) return; |
| 11459 entry = old_code_map->length(); | 11467 entry = old_code_map->length(); |
| 11460 } | 11468 } |
| 11461 new_code_map->set(entry + kContextOffset, *native_context); | 11469 |
| 11462 new_code_map->set(entry + kCachedCodeOffset, *code); | 11470 Handle<WeakCell> code_cell = code->IsUndefined() |
| 11463 new_code_map->set(entry + kLiteralsOffset, *literals); | 11471 ? isolate->factory()->empty_weak_cell() |
| 11472 : isolate->factory()->NewWeakCell(code); | |
| 11473 Handle<WeakCell> literals_cell = isolate->factory()->NewWeakCell(literals); | |
| 11474 WeakCell* context_cell = native_context->self_weak_cell(); | |
| 11475 | |
| 11476 new_code_map->set(entry + kContextOffset, context_cell); | |
| 11477 new_code_map->set(entry + kCachedCodeOffset, *code_cell); | |
| 11478 new_code_map->set(entry + kLiteralsOffset, *literals_cell); | |
| 11464 new_code_map->set(entry + kOsrAstIdOffset, Smi::FromInt(osr_ast_id.ToInt())); | 11479 new_code_map->set(entry + kOsrAstIdOffset, Smi::FromInt(osr_ast_id.ToInt())); |
| 11465 | 11480 |
| 11466 #ifdef DEBUG | 11481 #ifdef DEBUG |
| 11467 for (int i = kEntriesStart; i < new_code_map->length(); i += kEntryLength) { | 11482 for (int i = kEntriesStart; i < new_code_map->length(); i += kEntryLength) { |
| 11468 DCHECK(new_code_map->get(i + kContextOffset)->IsNativeContext()); | 11483 WeakCell* cell = WeakCell::cast(new_code_map->get(i + kContextOffset)); |
| 11469 Object* code = new_code_map->get(i + kCachedCodeOffset); | 11484 DCHECK(cell->cleared() || cell->value()->IsNativeContext()); |
| 11470 if (code != isolate->heap()->undefined_value()) { | 11485 cell = WeakCell::cast(new_code_map->get(i + kCachedCodeOffset)); |
| 11471 DCHECK(code->IsCode()); | 11486 DCHECK(cell->cleared() || |
| 11472 DCHECK(Code::cast(code)->kind() == Code::OPTIMIZED_FUNCTION); | 11487 (cell->value()->IsCode() && |
| 11473 } | 11488 Code::cast(cell->value())->kind() == Code::OPTIMIZED_FUNCTION)); |
| 11474 DCHECK(new_code_map->get(i + kLiteralsOffset)->IsFixedArray()); | 11489 cell = WeakCell::cast(new_code_map->get(i + kLiteralsOffset)); |
| 11490 DCHECK(cell->cleared() || cell->value()->IsFixedArray()); | |
| 11475 DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi()); | 11491 DCHECK(new_code_map->get(i + kOsrAstIdOffset)->IsSmi()); |
| 11476 } | 11492 } |
| 11477 #endif | 11493 #endif |
| 11478 | 11494 |
| 11479 // Zap any old optimized code map. | 11495 // Zap any old optimized code map. |
| 11480 if (!shared->OptimizedCodeMapIsCleared()) { | 11496 if (!shared->OptimizedCodeMapIsCleared()) { |
| 11481 FixedArray* old_code_map = shared->optimized_code_map(); | 11497 FixedArray* old_code_map = shared->optimized_code_map(); |
| 11482 old_code_map->FillWithHoles(0, old_code_map->length()); | 11498 old_code_map->FillWithHoles(0, old_code_map->length()); |
| 11483 } | 11499 } |
| 11484 | 11500 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 11501 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, | 11517 void SharedFunctionInfo::EvictFromOptimizedCodeMap(Code* optimized_code, |
| 11502 const char* reason) { | 11518 const char* reason) { |
| 11503 DisallowHeapAllocation no_gc; | 11519 DisallowHeapAllocation no_gc; |
| 11504 if (OptimizedCodeMapIsCleared()) return; | 11520 if (OptimizedCodeMapIsCleared()) return; |
| 11505 | 11521 |
| 11506 Heap* heap = GetHeap(); | 11522 Heap* heap = GetHeap(); |
| 11507 FixedArray* code_map = optimized_code_map(); | 11523 FixedArray* code_map = optimized_code_map(); |
| 11508 int dst = kEntriesStart; | 11524 int dst = kEntriesStart; |
| 11509 int length = code_map->length(); | 11525 int length = code_map->length(); |
| 11510 for (int src = kEntriesStart; src < length; src += kEntryLength) { | 11526 for (int src = kEntriesStart; src < length; src += kEntryLength) { |
| 11511 DCHECK(code_map->get(src)->IsNativeContext()); | 11527 DCHECK(WeakCell::cast(code_map->get(src))->cleared() || |
| 11512 if (code_map->get(src + kCachedCodeOffset) == optimized_code) { | 11528 WeakCell::cast(code_map->get(src))->value()->IsNativeContext()); |
| 11529 if (WeakCell::cast(code_map->get(src + kCachedCodeOffset))->value() == | |
| 11530 optimized_code) { | |
| 11513 BailoutId osr(Smi::cast(code_map->get(src + kOsrAstIdOffset))->value()); | 11531 BailoutId osr(Smi::cast(code_map->get(src + kOsrAstIdOffset))->value()); |
| 11514 if (FLAG_trace_opt) { | 11532 if (FLAG_trace_opt) { |
| 11515 PrintF("[evicting entry from optimizing code map (%s) for ", reason); | 11533 PrintF("[evicting entry from optimizing code map (%s) for ", reason); |
| 11516 ShortPrint(); | 11534 ShortPrint(); |
| 11517 if (osr.IsNone()) { | 11535 if (osr.IsNone()) { |
| 11518 PrintF("]\n"); | 11536 PrintF("]\n"); |
| 11519 } else { | 11537 } else { |
| 11520 PrintF(" (osr ast id %d)]\n", osr.ToInt()); | 11538 PrintF(" (osr ast id %d)]\n", osr.ToInt()); |
| 11521 } | 11539 } |
| 11522 } | 11540 } |
| 11523 if (!osr.IsNone()) { | 11541 if (!osr.IsNone()) { |
| 11524 // Evict the src entry by not copying it to the dst entry. | 11542 // Evict the src entry by not copying it to the dst entry. |
| 11525 continue; | 11543 continue; |
| 11526 } | 11544 } |
| 11527 // In case of non-OSR entry just clear the code in order to proceed | 11545 // In case of non-OSR entry just clear the code in order to proceed |
| 11528 // sharing literals. | 11546 // sharing literals. |
| 11529 code_map->set_undefined(src + kCachedCodeOffset); | 11547 code_map->set(src + kCachedCodeOffset, heap->empty_weak_cell(), |
| 11548 SKIP_WRITE_BARRIER); | |
| 11530 } | 11549 } |
| 11531 | 11550 |
| 11532 // Keep the src entry by copying it to the dst entry. | 11551 // Keep the src entry by copying it to the dst entry. |
| 11533 if (dst != src) { | 11552 if (dst != src) { |
| 11534 code_map->set(dst + kContextOffset, code_map->get(src + kContextOffset)); | 11553 code_map->set(dst + kContextOffset, code_map->get(src + kContextOffset)); |
| 11535 code_map->set(dst + kCachedCodeOffset, | 11554 code_map->set(dst + kCachedCodeOffset, |
| 11536 code_map->get(src + kCachedCodeOffset)); | 11555 code_map->get(src + kCachedCodeOffset)); |
| 11537 code_map->set(dst + kLiteralsOffset, | 11556 code_map->set(dst + kLiteralsOffset, |
| 11538 code_map->get(src + kLiteralsOffset)); | 11557 code_map->get(src + kLiteralsOffset)); |
| 11539 code_map->set(dst + kOsrAstIdOffset, | 11558 code_map->set(dst + kOsrAstIdOffset, |
| 11540 code_map->get(src + kOsrAstIdOffset)); | 11559 code_map->get(src + kOsrAstIdOffset)); |
| 11541 } | 11560 } |
| 11542 dst += kEntryLength; | 11561 dst += kEntryLength; |
| 11543 } | 11562 } |
| 11544 if (code_map->get(kSharedCodeIndex) == optimized_code) { | 11563 if (WeakCell::cast(code_map->get(kSharedCodeIndex))->value() == |
| 11564 optimized_code) { | |
| 11545 // Evict context-independent code as well. | 11565 // Evict context-independent code as well. |
| 11546 code_map->set_undefined(kSharedCodeIndex); | 11566 code_map->set(kSharedCodeIndex, heap->empty_weak_cell(), |
| 11567 SKIP_WRITE_BARRIER); | |
| 11547 if (FLAG_trace_opt) { | 11568 if (FLAG_trace_opt) { |
| 11548 PrintF("[evicting entry from optimizing code map (%s) for ", reason); | 11569 PrintF("[evicting entry from optimizing code map (%s) for ", reason); |
| 11549 ShortPrint(); | 11570 ShortPrint(); |
| 11550 PrintF(" (context-independent code)]\n"); | 11571 PrintF(" (context-independent code)]\n"); |
| 11551 } | 11572 } |
| 11552 } | 11573 } |
| 11553 if (dst != length) { | 11574 if (dst != length) { |
| 11554 // Always trim even when array is cleared because of heap verifier. | 11575 // Always trim even when array is cleared because of heap verifier. |
| 11555 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map, | 11576 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map, |
| 11556 length - dst); | 11577 length - dst); |
| 11557 if (code_map->length() == kEntriesStart && | 11578 if (code_map->length() == kEntriesStart && |
| 11558 code_map->get(kSharedCodeIndex)->IsUndefined()) { | 11579 WeakCell::cast(code_map->get(kSharedCodeIndex))->cleared()) { |
| 11559 ClearOptimizedCodeMap(); | 11580 ClearOptimizedCodeMap(); |
| 11560 } | 11581 } |
| 11561 } | 11582 } |
| 11562 } | 11583 } |
| 11563 | 11584 |
| 11564 | 11585 |
| 11565 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) { | 11586 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) { |
| 11566 FixedArray* code_map = optimized_code_map(); | 11587 FixedArray* code_map = optimized_code_map(); |
| 11567 DCHECK(shrink_by % kEntryLength == 0); | 11588 DCHECK(shrink_by % kEntryLength == 0); |
| 11568 DCHECK(shrink_by <= code_map->length() - kEntriesStart); | 11589 DCHECK(shrink_by <= code_map->length() - kEntriesStart); |
| 11569 // Always trim even when array is cleared because of heap verifier. | 11590 // Always trim even when array is cleared because of heap verifier. |
| 11570 GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map, | 11591 GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map, |
| 11571 shrink_by); | 11592 shrink_by); |
| 11572 if (code_map->length() == kEntriesStart && | 11593 if (code_map->length() == kEntriesStart && |
| 11573 code_map->get(kSharedCodeIndex)->IsUndefined()) { | 11594 WeakCell::cast(code_map->get(kSharedCodeIndex))->cleared()) { |
| 11574 ClearOptimizedCodeMap(); | 11595 ClearOptimizedCodeMap(); |
| 11575 } | 11596 } |
| 11576 } | 11597 } |
| 11577 | 11598 |
| 11578 | 11599 |
| 11579 static void GetMinInobjectSlack(Map* map, void* data) { | 11600 static void GetMinInobjectSlack(Map* map, void* data) { |
| 11580 int slack = map->unused_property_fields(); | 11601 int slack = map->unused_property_fields(); |
| 11581 if (*reinterpret_cast<int*>(data) > slack) { | 11602 if (*reinterpret_cast<int*>(data) > slack) { |
| 11582 *reinterpret_cast<int*>(data) = slack; | 11603 *reinterpret_cast<int*>(data) = slack; |
| 11583 } | 11604 } |
| (...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12788 | 12809 |
| 12789 int SharedFunctionInfo::SearchOptimizedCodeMapEntry(Context* native_context, | 12810 int SharedFunctionInfo::SearchOptimizedCodeMapEntry(Context* native_context, |
| 12790 BailoutId osr_ast_id) { | 12811 BailoutId osr_ast_id) { |
| 12791 DisallowHeapAllocation no_gc; | 12812 DisallowHeapAllocation no_gc; |
| 12792 DCHECK(native_context->IsNativeContext()); | 12813 DCHECK(native_context->IsNativeContext()); |
| 12793 if (!OptimizedCodeMapIsCleared()) { | 12814 if (!OptimizedCodeMapIsCleared()) { |
| 12794 FixedArray* optimized_code_map = this->optimized_code_map(); | 12815 FixedArray* optimized_code_map = this->optimized_code_map(); |
| 12795 int length = optimized_code_map->length(); | 12816 int length = optimized_code_map->length(); |
| 12796 Smi* osr_ast_id_smi = Smi::FromInt(osr_ast_id.ToInt()); | 12817 Smi* osr_ast_id_smi = Smi::FromInt(osr_ast_id.ToInt()); |
| 12797 for (int i = kEntriesStart; i < length; i += kEntryLength) { | 12818 for (int i = kEntriesStart; i < length; i += kEntryLength) { |
| 12798 if (optimized_code_map->get(i + kContextOffset) == native_context && | 12819 if (WeakCell::cast(optimized_code_map->get(i + kContextOffset)) |
| 12820 ->value() == native_context && | |
| 12799 optimized_code_map->get(i + kOsrAstIdOffset) == osr_ast_id_smi) { | 12821 optimized_code_map->get(i + kOsrAstIdOffset) == osr_ast_id_smi) { |
| 12800 return i; | 12822 return i; |
| 12801 } | 12823 } |
| 12802 } | 12824 } |
| 12803 Object* shared_code = optimized_code_map->get(kSharedCodeIndex); | 12825 Object* shared_code = |
| 12826 WeakCell::cast(optimized_code_map->get(kSharedCodeIndex))->value(); | |
| 12804 if (shared_code->IsCode() && osr_ast_id.IsNone()) { | 12827 if (shared_code->IsCode() && osr_ast_id.IsNone()) { |
| 12805 return kSharedCodeIndex; | 12828 return kSharedCodeIndex; |
| 12806 } | 12829 } |
| 12807 } | 12830 } |
| 12808 return -1; | 12831 return -1; |
| 12809 } | 12832 } |
| 12810 | 12833 |
| 12811 | 12834 |
| 12812 CodeAndLiterals SharedFunctionInfo::SearchOptimizedCodeMap( | 12835 CodeAndLiterals SharedFunctionInfo::SearchOptimizedCodeMap( |
| 12813 Context* native_context, BailoutId osr_ast_id) { | 12836 Context* native_context, BailoutId osr_ast_id) { |
| 12814 CodeAndLiterals result = {nullptr, nullptr}; | 12837 CodeAndLiterals result = {nullptr, nullptr}; |
| 12815 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); | 12838 int entry = SearchOptimizedCodeMapEntry(native_context, osr_ast_id); |
| 12816 if (entry != kNotFound) { | 12839 if (entry != kNotFound) { |
| 12817 FixedArray* code_map = optimized_code_map(); | 12840 FixedArray* code_map = optimized_code_map(); |
| 12818 if (entry == kSharedCodeIndex) { | 12841 if (entry == kSharedCodeIndex) { |
| 12819 result = {Code::cast(code_map->get(kSharedCodeIndex)), nullptr}; | 12842 // We know the weak cell isn't cleared because we made sure of it in |
| 12820 | 12843 // SearchOptimizedCodeMapEntry and performed no allocations since that |
| 12844 // call. | |
| 12845 result = { | |
| 12846 Code::cast(WeakCell::cast(code_map->get(kSharedCodeIndex))->value()), | |
| 12847 nullptr}; | |
| 12821 } else { | 12848 } else { |
| 12822 DCHECK_LE(entry + kEntryLength, code_map->length()); | 12849 DCHECK_LE(entry + kEntryLength, code_map->length()); |
| 12823 Object* code = code_map->get(entry + kCachedCodeOffset); | 12850 WeakCell* cell = WeakCell::cast(code_map->get(entry + kCachedCodeOffset)); |
| 12824 result = {code->IsUndefined() ? nullptr : Code::cast(code), | 12851 WeakCell* literals_cell = |
| 12825 LiteralsArray::cast(code_map->get(entry + kLiteralsOffset))}; | 12852 WeakCell::cast(code_map->get(entry + kLiteralsOffset)); |
| 12853 | |
| 12854 result = {cell->cleared() ? nullptr : Code::cast(cell->value()), | |
| 12855 literals_cell->cleared() | |
| 12856 ? nullptr | |
| 12857 : LiteralsArray::cast(literals_cell->value())}; | |
| 12826 } | 12858 } |
| 12827 } | 12859 } |
| 12828 if (FLAG_trace_opt && !OptimizedCodeMapIsCleared() && | 12860 if (FLAG_trace_opt && !OptimizedCodeMapIsCleared() && |
| 12829 result.code == nullptr) { | 12861 result.code == nullptr) { |
| 12830 PrintF("[didn't find optimized code in optimized code map for "); | 12862 PrintF("[didn't find optimized code in optimized code map for "); |
| 12831 ShortPrint(); | 12863 ShortPrint(); |
| 12832 PrintF("]\n"); | 12864 PrintF("]\n"); |
| 12833 } | 12865 } |
| 12834 return result; | 12866 return result; |
| 12835 } | 12867 } |
| (...skipping 5738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18574 if (cell->value() != *new_value) { | 18606 if (cell->value() != *new_value) { |
| 18575 cell->set_value(*new_value); | 18607 cell->set_value(*new_value); |
| 18576 Isolate* isolate = cell->GetIsolate(); | 18608 Isolate* isolate = cell->GetIsolate(); |
| 18577 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18609 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18578 isolate, DependentCode::kPropertyCellChangedGroup); | 18610 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18579 } | 18611 } |
| 18580 } | 18612 } |
| 18581 | 18613 |
| 18582 } // namespace internal | 18614 } // namespace internal |
| 18583 } // namespace v8 | 18615 } // namespace v8 |
| OLD | NEW |