OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 } | 1123 } |
1124 bool is_ascii = this->IsOneByteRepresentation(); | 1124 bool is_ascii = this->IsOneByteRepresentation(); |
1125 bool is_internalized = this->IsInternalizedString(); | 1125 bool is_internalized = this->IsInternalizedString(); |
1126 | 1126 |
1127 // Morph the object to an external string by adjusting the map and | 1127 // Morph the object to an external string by adjusting the map and |
1128 // reinitializing the fields. | 1128 // reinitializing the fields. |
1129 if (size >= ExternalString::kSize) { | 1129 if (size >= ExternalString::kSize) { |
1130 this->set_map_no_write_barrier( | 1130 this->set_map_no_write_barrier( |
1131 is_internalized | 1131 is_internalized |
1132 ? (is_ascii | 1132 ? (is_ascii |
1133 ? heap->external_internalized_string_with_ascii_data_map() | 1133 ? heap->external_internalized_string_with_one_byte_data_map() |
1134 : heap->external_internalized_string_map()) | 1134 : heap->external_internalized_string_map()) |
1135 : (is_ascii | 1135 : (is_ascii |
1136 ? heap->external_string_with_ascii_data_map() | 1136 ? heap->external_string_with_one_byte_data_map() |
1137 : heap->external_string_map())); | 1137 : heap->external_string_map())); |
1138 } else { | 1138 } else { |
1139 this->set_map_no_write_barrier( | 1139 this->set_map_no_write_barrier( |
1140 is_internalized | 1140 is_internalized |
1141 ? (is_ascii | 1141 ? (is_ascii |
1142 ? heap-> | 1142 ? heap-> |
1143 short_external_internalized_string_with_ascii_data_map() | 1143 short_external_internalized_string_with_one_byte_data_map() |
1144 : heap->short_external_internalized_string_map()) | 1144 : heap->short_external_internalized_string_map()) |
1145 : (is_ascii | 1145 : (is_ascii |
1146 ? heap->short_external_string_with_ascii_data_map() | 1146 ? heap->short_external_string_with_one_byte_data_map() |
1147 : heap->short_external_string_map())); | 1147 : heap->short_external_string_map())); |
1148 } | 1148 } |
1149 ExternalTwoByteString* self = ExternalTwoByteString::cast(this); | 1149 ExternalTwoByteString* self = ExternalTwoByteString::cast(this); |
1150 self->set_resource(resource); | 1150 self->set_resource(resource); |
1151 if (is_internalized) self->Hash(); // Force regeneration of the hash value. | 1151 if (is_internalized) self->Hash(); // Force regeneration of the hash value. |
1152 | 1152 |
1153 // Fill the remainder of the string with dead wood. | 1153 // Fill the remainder of the string with dead wood. |
1154 int new_size = this->Size(); // Byte size of the external String object. | 1154 int new_size = this->Size(); // Byte size of the external String object. |
1155 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); | 1155 heap->CreateFillerObjectAt(this->address() + new_size, size - new_size); |
1156 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { | 1156 if (Marking::IsBlack(Marking::MarkBitFrom(this))) { |
1157 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), | 1157 MemoryChunk::IncrementLiveBytesFromMutator(this->address(), |
(...skipping 13359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14517 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 14517 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
14518 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 14518 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
14519 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 14519 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
14520 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 14520 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
14521 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 14521 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
14522 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 14522 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
14523 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 14523 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
14524 } | 14524 } |
14525 | 14525 |
14526 } } // namespace v8::internal | 14526 } } // namespace v8::internal |
OLD | NEW |