| 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 <iomanip> | 7 #include <iomanip> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 bool is_one_byte = this->IsOneByteRepresentation(); | 1174 bool is_one_byte = this->IsOneByteRepresentation(); |
| 1175 bool is_internalized = this->IsInternalizedString(); | 1175 bool is_internalized = this->IsInternalizedString(); |
| 1176 | 1176 |
| 1177 // Morph the string to an external string by replacing the map and | 1177 // Morph the string to an external string by replacing the map and |
| 1178 // reinitializing the fields. This won't work if the space the existing | 1178 // reinitializing the fields. This won't work if the space the existing |
| 1179 // string occupies is too small for a regular external string. | 1179 // string occupies is too small for a regular external string. |
| 1180 // Instead, we resort to a short external string instead, omitting | 1180 // Instead, we resort to a short external string instead, omitting |
| 1181 // the field caching the address of the backing store. When we encounter | 1181 // the field caching the address of the backing store. When we encounter |
| 1182 // short external strings in generated code, we need to bailout to runtime. | 1182 // short external strings in generated code, we need to bailout to runtime. |
| 1183 Map* new_map; | 1183 Map* new_map; |
| 1184 if (size < ExternalString::kSize) { | 1184 if (true) { |
| 1185 new_map = is_internalized | 1185 new_map = is_internalized |
| 1186 ? (is_one_byte | 1186 ? (is_one_byte |
| 1187 ? heap->short_external_internalized_string_with_one_byte_data_map() | 1187 ? heap->short_external_internalized_string_with_one_byte_data_map() |
| 1188 : heap->short_external_internalized_string_map()) | 1188 : heap->short_external_internalized_string_map()) |
| 1189 : (is_one_byte ? heap->short_external_string_with_one_byte_data_map() | 1189 : (is_one_byte ? heap->short_external_string_with_one_byte_data_map() |
| 1190 : heap->short_external_string_map()); | 1190 : heap->short_external_string_map()); |
| 1191 } else { | 1191 } else { |
| 1192 new_map = is_internalized | 1192 new_map = is_internalized |
| 1193 ? (is_one_byte | 1193 ? (is_one_byte |
| 1194 ? heap->external_internalized_string_with_one_byte_data_map() | 1194 ? heap->external_internalized_string_with_one_byte_data_map() |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 Heap* heap = GetHeap(); | 1240 Heap* heap = GetHeap(); |
| 1241 bool is_internalized = this->IsInternalizedString(); | 1241 bool is_internalized = this->IsInternalizedString(); |
| 1242 | 1242 |
| 1243 // Morph the string to an external string by replacing the map and | 1243 // Morph the string to an external string by replacing the map and |
| 1244 // reinitializing the fields. This won't work if the space the existing | 1244 // reinitializing the fields. This won't work if the space the existing |
| 1245 // string occupies is too small for a regular external string. | 1245 // string occupies is too small for a regular external string. |
| 1246 // Instead, we resort to a short external string instead, omitting | 1246 // Instead, we resort to a short external string instead, omitting |
| 1247 // the field caching the address of the backing store. When we encounter | 1247 // the field caching the address of the backing store. When we encounter |
| 1248 // short external strings in generated code, we need to bailout to runtime. | 1248 // short external strings in generated code, we need to bailout to runtime. |
| 1249 Map* new_map; | 1249 Map* new_map; |
| 1250 if (size < ExternalString::kSize) { | 1250 if (true) { |
| 1251 new_map = is_internalized | 1251 new_map = is_internalized |
| 1252 ? heap->short_external_one_byte_internalized_string_map() | 1252 ? heap->short_external_one_byte_internalized_string_map() |
| 1253 : heap->short_external_one_byte_string_map(); | 1253 : heap->short_external_one_byte_string_map(); |
| 1254 } else { | 1254 } else { |
| 1255 new_map = is_internalized | 1255 new_map = is_internalized |
| 1256 ? heap->external_one_byte_internalized_string_map() | 1256 ? heap->external_one_byte_internalized_string_map() |
| 1257 : heap->external_one_byte_string_map(); | 1257 : heap->external_one_byte_string_map(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 // Byte size of the external String object. | 1260 // Byte size of the external String object. |
| (...skipping 15102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16363 if (cell->value() != *new_value) { | 16363 if (cell->value() != *new_value) { |
| 16364 cell->set_value(*new_value); | 16364 cell->set_value(*new_value); |
| 16365 Isolate* isolate = cell->GetIsolate(); | 16365 Isolate* isolate = cell->GetIsolate(); |
| 16366 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16366 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16367 isolate, DependentCode::kPropertyCellChangedGroup); | 16367 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16368 } | 16368 } |
| 16369 } | 16369 } |
| 16370 | 16370 |
| 16371 } // namespace internal | 16371 } // namespace internal |
| 16372 } // namespace v8 | 16372 } // namespace v8 |
| OLD | NEW |