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

Side by Side Diff: src/objects.cc

Issue 367113003: Revert "Turn old space cons strings into regular external strings (not short)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/heap-inl.h ('k') | test/mjsunit/regress/regress-sliced-external-cons-regexp.js » ('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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 #endif // DEBUG 1060 #endif // DEBUG
1061 Heap* heap = GetHeap(); 1061 Heap* heap = GetHeap();
1062 int size = this->Size(); // Byte size of the original string. 1062 int size = this->Size(); // Byte size of the original string.
1063 if (size < ExternalString::kShortSize) { 1063 if (size < ExternalString::kShortSize) {
1064 return false; 1064 return false;
1065 } 1065 }
1066 bool is_ascii = this->IsOneByteRepresentation(); 1066 bool is_ascii = this->IsOneByteRepresentation();
1067 bool is_internalized = this->IsInternalizedString(); 1067 bool is_internalized = this->IsInternalizedString();
1068 1068
1069 // Morph the string to an external string by replacing the map and 1069 // Morph the string to an external string by replacing the map and
1070 // reinitializing the fields. This won't work if the space the existing 1070 // reinitializing the fields. This won't work if
1071 // string occupies is too small for a regular external string. 1071 // - the space the existing string occupies is too small for a regular
1072 // Instead, we resort to a short external string instead, omitting 1072 // external string.
1073 // - the existing string is in old pointer space and the backing store of
1074 // the external string is not aligned. The GC cannot deal with a field
1075 // containing a possibly unaligned address to outside of V8's heap.
1076 // In either case we resort to a short external string instead, omitting
1073 // the field caching the address of the backing store. When we encounter 1077 // the field caching the address of the backing store. When we encounter
1074 // short external strings in generated code, we need to bailout to runtime. 1078 // short external strings in generated code, we need to bailout to runtime.
1075 Map* new_map; 1079 Map* new_map;
1076 if (size < ExternalString::kSize) { 1080 if (size < ExternalString::kSize ||
1081 heap->old_pointer_space()->Contains(this)) {
1077 new_map = is_internalized 1082 new_map = is_internalized
1078 ? (is_ascii 1083 ? (is_ascii
1079 ? heap-> 1084 ? heap->
1080 short_external_internalized_string_with_one_byte_data_map() 1085 short_external_internalized_string_with_one_byte_data_map()
1081 : heap->short_external_internalized_string_map()) 1086 : heap->short_external_internalized_string_map())
1082 : (is_ascii 1087 : (is_ascii
1083 ? heap->short_external_string_with_one_byte_data_map() 1088 ? heap->short_external_string_with_one_byte_data_map()
1084 : heap->short_external_string_map()); 1089 : heap->short_external_string_map());
1085 } else { 1090 } else {
1086 new_map = is_internalized 1091 new_map = is_internalized
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 } 1132 }
1128 #endif // DEBUG 1133 #endif // DEBUG
1129 Heap* heap = GetHeap(); 1134 Heap* heap = GetHeap();
1130 int size = this->Size(); // Byte size of the original string. 1135 int size = this->Size(); // Byte size of the original string.
1131 if (size < ExternalString::kShortSize) { 1136 if (size < ExternalString::kShortSize) {
1132 return false; 1137 return false;
1133 } 1138 }
1134 bool is_internalized = this->IsInternalizedString(); 1139 bool is_internalized = this->IsInternalizedString();
1135 1140
1136 // Morph the string to an external string by replacing the map and 1141 // Morph the string to an external string by replacing the map and
1137 // reinitializing the fields. This won't work if the space the existing 1142 // reinitializing the fields. This won't work if
1138 // string occupies is too small for a regular external string. 1143 // - the space the existing string occupies is too small for a regular
1139 // Instead, we resort to a short external string instead, omitting 1144 // external string.
1145 // - the existing string is in old pointer space and the backing store of
1146 // the external string is not aligned. The GC cannot deal with a field
1147 // containing a possibly unaligned address to outside of V8's heap.
1148 // In either case we resort to a short external string instead, omitting
1140 // the field caching the address of the backing store. When we encounter 1149 // the field caching the address of the backing store. When we encounter
1141 // short external strings in generated code, we need to bailout to runtime. 1150 // short external strings in generated code, we need to bailout to runtime.
1142 Map* new_map; 1151 Map* new_map;
1143 if (size < ExternalString::kSize) { 1152 if (size < ExternalString::kSize ||
1153 heap->old_pointer_space()->Contains(this)) {
1144 new_map = is_internalized 1154 new_map = is_internalized
1145 ? heap->short_external_ascii_internalized_string_map() 1155 ? heap->short_external_ascii_internalized_string_map()
1146 : heap->short_external_ascii_string_map(); 1156 : heap->short_external_ascii_string_map();
1147 } else { 1157 } else {
1148 new_map = is_internalized 1158 new_map = is_internalized
1149 ? heap->external_ascii_internalized_string_map() 1159 ? heap->external_ascii_internalized_string_map()
1150 : heap->external_ascii_string_map(); 1160 : heap->external_ascii_string_map();
1151 } 1161 }
1152 1162
1153 // Byte size of the external String object. 1163 // Byte size of the external String object.
(...skipping 15814 matching lines...) Expand 10 before | Expand all | Expand 10 after
16968 #define ERROR_MESSAGES_TEXTS(C, T) T, 16978 #define ERROR_MESSAGES_TEXTS(C, T) T,
16969 static const char* error_messages_[] = { 16979 static const char* error_messages_[] = {
16970 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16980 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16971 }; 16981 };
16972 #undef ERROR_MESSAGES_TEXTS 16982 #undef ERROR_MESSAGES_TEXTS
16973 return error_messages_[reason]; 16983 return error_messages_[reason];
16974 } 16984 }
16975 16985
16976 16986
16977 } } // namespace v8::internal 16987 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | test/mjsunit/regress/regress-sliced-external-cons-regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698