OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/disasm.h" | 8 #include "src/disasm.h" |
9 #include "src/disassembler.h" | 9 #include "src/disassembler.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 (!FLAG_use_allocation_folding && value->IsUndefined())); | 311 (!FLAG_use_allocation_folding && value->IsUndefined())); |
312 } | 312 } |
313 } | 313 } |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 // If a GC was caused while constructing this object, the elements | 317 // If a GC was caused while constructing this object, the elements |
318 // pointer may point to a one pointer filler map. | 318 // pointer may point to a one pointer filler map. |
319 if (ElementsAreSafeToExamine()) { | 319 if (ElementsAreSafeToExamine()) { |
320 CHECK_EQ((map()->has_fast_smi_or_object_elements() || | 320 CHECK_EQ((map()->has_fast_smi_or_object_elements() || |
321 (elements() == GetHeap()->empty_fixed_array())), | 321 (elements() == GetHeap()->empty_fixed_array()) || |
| 322 HasFastStringWrapperElements()), |
322 (elements()->map() == GetHeap()->fixed_array_map() || | 323 (elements()->map() == GetHeap()->fixed_array_map() || |
323 elements()->map() == GetHeap()->fixed_cow_array_map())); | 324 elements()->map() == GetHeap()->fixed_cow_array_map())); |
324 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); | 325 CHECK(map()->has_fast_object_elements() == HasFastObjectElements()); |
325 } | 326 } |
326 } | 327 } |
327 | 328 |
328 | 329 |
329 void Map::MapVerify() { | 330 void Map::MapVerify() { |
330 Heap* heap = GetHeap(); | 331 Heap* heap = GetHeap(); |
331 CHECK(!heap->InNewSpace(this)); | 332 CHECK(!heap->InNewSpace(this)); |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 info->number_of_slow_unused_properties_ += | 1063 info->number_of_slow_unused_properties_ += |
1063 dict->Capacity() - dict->NumberOfElements(); | 1064 dict->Capacity() - dict->NumberOfElements(); |
1064 } | 1065 } |
1065 // Indexed properties | 1066 // Indexed properties |
1066 switch (GetElementsKind()) { | 1067 switch (GetElementsKind()) { |
1067 case FAST_HOLEY_SMI_ELEMENTS: | 1068 case FAST_HOLEY_SMI_ELEMENTS: |
1068 case FAST_SMI_ELEMENTS: | 1069 case FAST_SMI_ELEMENTS: |
1069 case FAST_HOLEY_DOUBLE_ELEMENTS: | 1070 case FAST_HOLEY_DOUBLE_ELEMENTS: |
1070 case FAST_DOUBLE_ELEMENTS: | 1071 case FAST_DOUBLE_ELEMENTS: |
1071 case FAST_HOLEY_ELEMENTS: | 1072 case FAST_HOLEY_ELEMENTS: |
1072 case FAST_ELEMENTS: { | 1073 case FAST_ELEMENTS: |
| 1074 case FAST_STRING_WRAPPER_ELEMENTS: { |
1073 info->number_of_objects_with_fast_elements_++; | 1075 info->number_of_objects_with_fast_elements_++; |
1074 int holes = 0; | 1076 int holes = 0; |
1075 FixedArray* e = FixedArray::cast(elements()); | 1077 FixedArray* e = FixedArray::cast(elements()); |
1076 int len = e->length(); | 1078 int len = e->length(); |
1077 Heap* heap = GetHeap(); | 1079 Heap* heap = GetHeap(); |
1078 for (int i = 0; i < len; i++) { | 1080 for (int i = 0; i < len; i++) { |
1079 if (e->get(i) == heap->the_hole_value()) holes++; | 1081 if (e->get(i) == heap->the_hole_value()) holes++; |
1080 } | 1082 } |
1081 info->number_of_fast_used_elements_ += len - holes; | 1083 info->number_of_fast_used_elements_ += len - holes; |
1082 info->number_of_fast_unused_elements_ += holes; | 1084 info->number_of_fast_unused_elements_ += holes; |
1083 break; | 1085 break; |
1084 } | 1086 } |
1085 | 1087 |
1086 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 1088 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
1087 case TYPE##_ELEMENTS: | 1089 case TYPE##_ELEMENTS: |
1088 | 1090 |
1089 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 1091 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
1090 #undef TYPED_ARRAY_CASE | 1092 #undef TYPED_ARRAY_CASE |
1091 { info->number_of_objects_with_fast_elements_++; | 1093 { info->number_of_objects_with_fast_elements_++; |
1092 FixedArrayBase* e = FixedArrayBase::cast(elements()); | 1094 FixedArrayBase* e = FixedArrayBase::cast(elements()); |
1093 info->number_of_fast_used_elements_ += e->length(); | 1095 info->number_of_fast_used_elements_ += e->length(); |
1094 break; | 1096 break; |
1095 } | 1097 } |
1096 case DICTIONARY_ELEMENTS: { | 1098 case DICTIONARY_ELEMENTS: |
| 1099 case SLOW_STRING_WRAPPER_ELEMENTS: { |
1097 SeededNumberDictionary* dict = element_dictionary(); | 1100 SeededNumberDictionary* dict = element_dictionary(); |
1098 info->number_of_slow_used_elements_ += dict->NumberOfElements(); | 1101 info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
1099 info->number_of_slow_unused_elements_ += | 1102 info->number_of_slow_unused_elements_ += |
1100 dict->Capacity() - dict->NumberOfElements(); | 1103 dict->Capacity() - dict->NumberOfElements(); |
1101 break; | 1104 break; |
1102 } | 1105 } |
1103 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: | 1106 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: |
1104 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: | 1107 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: |
| 1108 case NO_ELEMENTS: |
1105 break; | 1109 break; |
1106 } | 1110 } |
1107 } | 1111 } |
1108 | 1112 |
1109 | 1113 |
1110 void JSObject::SpillInformation::Clear() { | 1114 void JSObject::SpillInformation::Clear() { |
1111 number_of_objects_ = 0; | 1115 number_of_objects_ = 0; |
1112 number_of_objects_with_fast_properties_ = 0; | 1116 number_of_objects_with_fast_properties_ = 0; |
1113 number_of_objects_with_fast_elements_ = 0; | 1117 number_of_objects_with_fast_elements_ = 0; |
1114 number_of_fast_used_fields_ = 0; | 1118 number_of_fast_used_fields_ = 0; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 | 1330 |
1327 // Both are done at the same time. | 1331 // Both are done at the same time. |
1328 CHECK_EQ(new_it.done(), old_it.done()); | 1332 CHECK_EQ(new_it.done(), old_it.done()); |
1329 } | 1333 } |
1330 | 1334 |
1331 | 1335 |
1332 #endif // DEBUG | 1336 #endif // DEBUG |
1333 | 1337 |
1334 } // namespace internal | 1338 } // namespace internal |
1335 } // namespace v8 | 1339 } // namespace v8 |
OLD | NEW |