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

Side by Side Diff: src/objects.cc

Issue 1490193002: Add ExternalStringResourceBase::IsCompressible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
« src/factory.cc ('K') | « src/factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 9 #include <sstream>
10 10
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 bool is_one_byte = this->IsOneByteRepresentation(); 1680 bool is_one_byte = this->IsOneByteRepresentation();
1681 bool is_internalized = this->IsInternalizedString(); 1681 bool is_internalized = this->IsInternalizedString();
1682 1682
1683 // Morph the string to an external string by replacing the map and 1683 // Morph the string to an external string by replacing the map and
1684 // reinitializing the fields. This won't work if the space the existing 1684 // reinitializing the fields. This won't work if the space the existing
1685 // string occupies is too small for a regular external string. 1685 // string occupies is too small for a regular external string.
1686 // Instead, we resort to a short external string instead, omitting 1686 // Instead, we resort to a short external string instead, omitting
1687 // the field caching the address of the backing store. When we encounter 1687 // the field caching the address of the backing store. When we encounter
1688 // short external strings in generated code, we need to bailout to runtime. 1688 // short external strings in generated code, we need to bailout to runtime.
1689 Map* new_map; 1689 Map* new_map;
1690 if (size < ExternalString::kSize) { 1690 if (size < ExternalString::kSize || resource->isCompressible()) {
Yang 2015/12/17 11:41:53 Is this necessary? For source strings, we always c
hajimehoshi 2016/01/05 08:07:44 I meant compressible string should use short_*_map
1691 new_map = is_internalized 1691 new_map = is_internalized
1692 ? (is_one_byte 1692 ? (is_one_byte
1693 ? heap->short_external_internalized_string_with_one_byte_data_map() 1693 ? heap->short_external_internalized_string_with_one_byte_data_map()
1694 : heap->short_external_internalized_string_map()) 1694 : heap->short_external_internalized_string_map())
1695 : (is_one_byte ? heap->short_external_string_with_one_byte_data_map() 1695 : (is_one_byte ? heap->short_external_string_with_one_byte_data_map()
1696 : heap->short_external_string_map()); 1696 : heap->short_external_string_map());
1697 } else { 1697 } else {
1698 new_map = is_internalized 1698 new_map = is_internalized
1699 ? (is_one_byte 1699 ? (is_one_byte
1700 ? heap->external_internalized_string_with_one_byte_data_map() 1700 ? heap->external_internalized_string_with_one_byte_data_map()
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 Heap* heap = GetHeap(); 1746 Heap* heap = GetHeap();
1747 bool is_internalized = this->IsInternalizedString(); 1747 bool is_internalized = this->IsInternalizedString();
1748 1748
1749 // Morph the string to an external string by replacing the map and 1749 // Morph the string to an external string by replacing the map and
1750 // reinitializing the fields. This won't work if the space the existing 1750 // reinitializing the fields. This won't work if the space the existing
1751 // string occupies is too small for a regular external string. 1751 // string occupies is too small for a regular external string.
1752 // Instead, we resort to a short external string instead, omitting 1752 // Instead, we resort to a short external string instead, omitting
1753 // the field caching the address of the backing store. When we encounter 1753 // the field caching the address of the backing store. When we encounter
1754 // short external strings in generated code, we need to bailout to runtime. 1754 // short external strings in generated code, we need to bailout to runtime.
1755 Map* new_map; 1755 Map* new_map;
1756 if (size < ExternalString::kSize) { 1756 if (size < ExternalString::kSize || resource->isCompressible()) {
1757 new_map = is_internalized 1757 new_map = is_internalized
1758 ? heap->short_external_one_byte_internalized_string_map() 1758 ? heap->short_external_one_byte_internalized_string_map()
1759 : heap->short_external_one_byte_string_map(); 1759 : heap->short_external_one_byte_string_map();
1760 } else { 1760 } else {
1761 new_map = is_internalized 1761 new_map = is_internalized
1762 ? heap->external_one_byte_internalized_string_map() 1762 ? heap->external_one_byte_internalized_string_map()
1763 : heap->external_one_byte_string_map(); 1763 : heap->external_one_byte_string_map();
1764 } 1764 }
1765 1765
1766 // Byte size of the external String object. 1766 // Byte size of the external String object.
(...skipping 17598 matching lines...) Expand 10 before | Expand all | Expand 10 after
19365 if (cell->value() != *new_value) { 19365 if (cell->value() != *new_value) {
19366 cell->set_value(*new_value); 19366 cell->set_value(*new_value);
19367 Isolate* isolate = cell->GetIsolate(); 19367 Isolate* isolate = cell->GetIsolate();
19368 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19368 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19369 isolate, DependentCode::kPropertyCellChangedGroup); 19369 isolate, DependentCode::kPropertyCellChangedGroup);
19370 } 19370 }
19371 } 19371 }
19372 19372
19373 } // namespace internal 19373 } // namespace internal
19374 } // namespace v8 19374 } // namespace v8
OLDNEW
« src/factory.cc ('K') | « src/factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698