| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 9 #include <memory> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 12525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12536 } | 12536 } |
| 12537 if (dst != length) { | 12537 if (dst != length) { |
| 12538 // Always trim even when array is cleared because of heap verifier. | 12538 // Always trim even when array is cleared because of heap verifier. |
| 12539 heap->RightTrimFixedArray(code_map, length - dst); | 12539 heap->RightTrimFixedArray(code_map, length - dst); |
| 12540 if (code_map->length() == kEntriesStart) { | 12540 if (code_map->length() == kEntriesStart) { |
| 12541 ClearOptimizedCodeMap(); | 12541 ClearOptimizedCodeMap(); |
| 12542 } | 12542 } |
| 12543 } | 12543 } |
| 12544 } | 12544 } |
| 12545 | 12545 |
| 12546 | |
| 12547 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) { | |
| 12548 FixedArray* code_map = optimized_code_map(); | |
| 12549 DCHECK(shrink_by % kEntryLength == 0); | |
| 12550 DCHECK(shrink_by <= code_map->length() - kEntriesStart); | |
| 12551 // Always trim even when array is cleared because of heap verifier. | |
| 12552 GetHeap()->RightTrimFixedArray(code_map, shrink_by); | |
| 12553 if (code_map->length() == kEntriesStart) { | |
| 12554 ClearOptimizedCodeMap(); | |
| 12555 } | |
| 12556 } | |
| 12557 | |
| 12558 // static | 12546 // static |
| 12559 void JSFunction::EnsureLiterals(Handle<JSFunction> function) { | 12547 void JSFunction::EnsureLiterals(Handle<JSFunction> function) { |
| 12560 Handle<SharedFunctionInfo> shared(function->shared()); | 12548 Handle<SharedFunctionInfo> shared(function->shared()); |
| 12561 Handle<Context> native_context(function->context()->native_context()); | 12549 Handle<Context> native_context(function->context()->native_context()); |
| 12562 if (function->literals() == | 12550 if (function->literals() == |
| 12563 function->GetIsolate()->heap()->empty_literals_array()) { | 12551 function->GetIsolate()->heap()->empty_literals_array()) { |
| 12564 Handle<LiteralsArray> literals = | 12552 Handle<LiteralsArray> literals = |
| 12565 SharedFunctionInfo::FindOrCreateLiterals(shared, native_context); | 12553 SharedFunctionInfo::FindOrCreateLiterals(shared, native_context); |
| 12566 function->set_literals(*literals); | 12554 function->set_literals(*literals); |
| 12567 } | 12555 } |
| (...skipping 7867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20435 // depend on this. | 20423 // depend on this. |
| 20436 return DICTIONARY_ELEMENTS; | 20424 return DICTIONARY_ELEMENTS; |
| 20437 } | 20425 } |
| 20438 DCHECK_LE(kind, LAST_ELEMENTS_KIND); | 20426 DCHECK_LE(kind, LAST_ELEMENTS_KIND); |
| 20439 return kind; | 20427 return kind; |
| 20440 } | 20428 } |
| 20441 } | 20429 } |
| 20442 | 20430 |
| 20443 } // namespace internal | 20431 } // namespace internal |
| 20444 } // namespace v8 | 20432 } // namespace v8 |
| OLD | NEW |