Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: src/objects.cc

Issue 1249543005: Allow for optimized code map to have zero entries. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added test case. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | test/cctest/test-compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 9524 matching lines...) Expand 10 before | Expand all | Expand 10 after
9535 if (FLAG_trace_opt) { 9535 if (FLAG_trace_opt) {
9536 PrintF("[evicting entry from optimizing code map (%s) for ", reason); 9536 PrintF("[evicting entry from optimizing code map (%s) for ", reason);
9537 ShortPrint(); 9537 ShortPrint();
9538 PrintF(" (context-independent code)]\n"); 9538 PrintF(" (context-independent code)]\n");
9539 } 9539 }
9540 } 9540 }
9541 if (dst != length) { 9541 if (dst != length) {
9542 // Always trim even when array is cleared because of heap verifier. 9542 // Always trim even when array is cleared because of heap verifier.
9543 GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map, 9543 GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(code_map,
9544 length - dst); 9544 length - dst);
9545 if (code_map->length() == kEntriesStart) ClearOptimizedCodeMap(); 9545 if (code_map->length() == kEntriesStart &&
9546 code_map->get(kSharedCodeIndex)->IsUndefined()) {
9547 ClearOptimizedCodeMap();
9548 }
9546 } 9549 }
9547 } 9550 }
9548 9551
9549 9552
9550 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) { 9553 void SharedFunctionInfo::TrimOptimizedCodeMap(int shrink_by) {
9551 FixedArray* code_map = FixedArray::cast(optimized_code_map()); 9554 FixedArray* code_map = FixedArray::cast(optimized_code_map());
9552 DCHECK(shrink_by % kEntryLength == 0); 9555 DCHECK(shrink_by % kEntryLength == 0);
9553 DCHECK(shrink_by <= code_map->length() - kEntriesStart); 9556 DCHECK(shrink_by <= code_map->length() - kEntriesStart);
9554 // Always trim even when array is cleared because of heap verifier. 9557 // Always trim even when array is cleared because of heap verifier.
9555 GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map, 9558 GetHeap()->RightTrimFixedArray<Heap::SEQUENTIAL_TO_SWEEPER>(code_map,
9556 shrink_by); 9559 shrink_by);
9557 if (code_map->length() == kEntriesStart) { 9560 if (code_map->length() == kEntriesStart &&
9561 code_map->get(kSharedCodeIndex)->IsUndefined()) {
9558 ClearOptimizedCodeMap(); 9562 ClearOptimizedCodeMap();
9559 } 9563 }
9560 } 9564 }
9561 9565
9562 9566
9563 static void GetMinInobjectSlack(Map* map, void* data) { 9567 static void GetMinInobjectSlack(Map* map, void* data) {
9564 int slack = map->unused_property_fields(); 9568 int slack = map->unused_property_fields();
9565 if (*reinterpret_cast<int*>(data) > slack) { 9569 if (*reinterpret_cast<int*>(data) > slack) {
9566 *reinterpret_cast<int*>(data) = slack; 9570 *reinterpret_cast<int*>(data) = slack;
9567 } 9571 }
(...skipping 6337 matching lines...) Expand 10 before | Expand all | Expand 10 after
15905 Handle<Object> new_value) { 15909 Handle<Object> new_value) {
15906 if (cell->value() != *new_value) { 15910 if (cell->value() != *new_value) {
15907 cell->set_value(*new_value); 15911 cell->set_value(*new_value);
15908 Isolate* isolate = cell->GetIsolate(); 15912 Isolate* isolate = cell->GetIsolate();
15909 cell->dependent_code()->DeoptimizeDependentCodeGroup( 15913 cell->dependent_code()->DeoptimizeDependentCodeGroup(
15910 isolate, DependentCode::kPropertyCellChangedGroup); 15914 isolate, DependentCode::kPropertyCellChangedGroup);
15911 } 15915 }
15912 } 15916 }
15913 } // namespace internal 15917 } // namespace internal
15914 } // namespace v8 15918 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | test/cctest/test-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698