OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 break; | 97 break; |
98 case CONSTANT_POOL_ARRAY_TYPE: | 98 case CONSTANT_POOL_ARRAY_TYPE: |
99 ConstantPoolArray::cast(this)->ConstantPoolArrayVerify(); | 99 ConstantPoolArray::cast(this)->ConstantPoolArrayVerify(); |
100 break; | 100 break; |
101 case BYTE_ARRAY_TYPE: | 101 case BYTE_ARRAY_TYPE: |
102 ByteArray::cast(this)->ByteArrayVerify(); | 102 ByteArray::cast(this)->ByteArrayVerify(); |
103 break; | 103 break; |
104 case FREE_SPACE_TYPE: | 104 case FREE_SPACE_TYPE: |
105 FreeSpace::cast(this)->FreeSpaceVerify(); | 105 FreeSpace::cast(this)->FreeSpaceVerify(); |
106 break; | 106 break; |
107 case EXTERNAL_PIXEL_ARRAY_TYPE: | 107 |
108 ExternalPixelArray::cast(this)->ExternalPixelArrayVerify(); | 108 #define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
| 109 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ |
| 110 External##Type##Array::cast(this)->External##Type##ArrayVerify(); \ |
| 111 break; \ |
| 112 case FIXED_##TYPE##_ARRAY_TYPE: \ |
| 113 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \ |
109 break; | 114 break; |
110 case EXTERNAL_BYTE_ARRAY_TYPE: | 115 |
111 ExternalByteArray::cast(this)->ExternalByteArrayVerify(); | 116 TYPED_ARRAYS(VERIFY_TYPED_ARRAY) |
112 break; | 117 #undef VERIFY_TYPED_ARRAY |
113 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 118 |
114 ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayVerify(); | |
115 break; | |
116 case EXTERNAL_SHORT_ARRAY_TYPE: | |
117 ExternalShortArray::cast(this)->ExternalShortArrayVerify(); | |
118 break; | |
119 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | |
120 ExternalUnsignedShortArray::cast(this)-> | |
121 ExternalUnsignedShortArrayVerify(); | |
122 break; | |
123 case EXTERNAL_INT_ARRAY_TYPE: | |
124 ExternalIntArray::cast(this)->ExternalIntArrayVerify(); | |
125 break; | |
126 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | |
127 ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayVerify(); | |
128 break; | |
129 case EXTERNAL_FLOAT_ARRAY_TYPE: | |
130 ExternalFloatArray::cast(this)->ExternalFloatArrayVerify(); | |
131 break; | |
132 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
133 ExternalDoubleArray::cast(this)->ExternalDoubleArrayVerify(); | |
134 break; | |
135 case FIXED_UINT8_ARRAY_TYPE: | |
136 FixedUint8Array::cast(this)->FixedTypedArrayVerify(); | |
137 break; | |
138 case FIXED_INT8_ARRAY_TYPE: | |
139 FixedInt8Array::cast(this)->FixedTypedArrayVerify(); | |
140 break; | |
141 case FIXED_UINT16_ARRAY_TYPE: | |
142 FixedUint16Array::cast(this)->FixedTypedArrayVerify(); | |
143 break; | |
144 case FIXED_INT16_ARRAY_TYPE: | |
145 FixedInt16Array::cast(this)->FixedTypedArrayVerify(); | |
146 break; | |
147 case FIXED_UINT32_ARRAY_TYPE: | |
148 FixedUint32Array::cast(this)->FixedTypedArrayVerify(); | |
149 break; | |
150 case FIXED_INT32_ARRAY_TYPE: | |
151 FixedInt32Array::cast(this)->FixedTypedArrayVerify(); | |
152 break; | |
153 case FIXED_FLOAT32_ARRAY_TYPE: | |
154 FixedFloat32Array::cast(this)->FixedTypedArrayVerify(); | |
155 break; | |
156 case FIXED_FLOAT64_ARRAY_TYPE: | |
157 FixedFloat64Array::cast(this)->FixedTypedArrayVerify(); | |
158 break; | |
159 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: | |
160 FixedUint8ClampedArray::cast(this)->FixedTypedArrayVerify(); | |
161 break; | |
162 case CODE_TYPE: | 119 case CODE_TYPE: |
163 Code::cast(this)->CodeVerify(); | 120 Code::cast(this)->CodeVerify(); |
164 break; | 121 break; |
165 case ODDBALL_TYPE: | 122 case ODDBALL_TYPE: |
166 Oddball::cast(this)->OddballVerify(); | 123 Oddball::cast(this)->OddballVerify(); |
167 break; | 124 break; |
168 case JS_OBJECT_TYPE: | 125 case JS_OBJECT_TYPE: |
169 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 126 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
170 JSObject::cast(this)->JSObjectVerify(); | 127 JSObject::cast(this)->JSObjectVerify(); |
171 break; | 128 break; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 void ByteArray::ByteArrayVerify() { | 239 void ByteArray::ByteArrayVerify() { |
283 CHECK(IsByteArray()); | 240 CHECK(IsByteArray()); |
284 } | 241 } |
285 | 242 |
286 | 243 |
287 void FreeSpace::FreeSpaceVerify() { | 244 void FreeSpace::FreeSpaceVerify() { |
288 CHECK(IsFreeSpace()); | 245 CHECK(IsFreeSpace()); |
289 } | 246 } |
290 | 247 |
291 | 248 |
292 void ExternalPixelArray::ExternalPixelArrayVerify() { | 249 #define EXTERNAL_ARRAY_VERIFY(Type, type, TYPE, ctype, size) \ |
293 CHECK(IsExternalPixelArray()); | 250 void External##Type##Array::External##Type##ArrayVerify() { \ |
294 } | 251 CHECK(IsExternal##Type##Array()); \ |
| 252 } |
295 | 253 |
296 | 254 TYPED_ARRAYS(EXTERNAL_ARRAY_VERIFY) |
297 void ExternalByteArray::ExternalByteArrayVerify() { | 255 #undef EXTERNAL_ARRAY_VERIFY |
298 CHECK(IsExternalByteArray()); | |
299 } | |
300 | |
301 | |
302 void ExternalUnsignedByteArray::ExternalUnsignedByteArrayVerify() { | |
303 CHECK(IsExternalUnsignedByteArray()); | |
304 } | |
305 | |
306 | |
307 void ExternalShortArray::ExternalShortArrayVerify() { | |
308 CHECK(IsExternalShortArray()); | |
309 } | |
310 | |
311 | |
312 void ExternalUnsignedShortArray::ExternalUnsignedShortArrayVerify() { | |
313 CHECK(IsExternalUnsignedShortArray()); | |
314 } | |
315 | |
316 | |
317 void ExternalIntArray::ExternalIntArrayVerify() { | |
318 CHECK(IsExternalIntArray()); | |
319 } | |
320 | |
321 | |
322 void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { | |
323 CHECK(IsExternalUnsignedIntArray()); | |
324 } | |
325 | |
326 | |
327 void ExternalFloatArray::ExternalFloatArrayVerify() { | |
328 CHECK(IsExternalFloatArray()); | |
329 } | |
330 | |
331 | |
332 void ExternalDoubleArray::ExternalDoubleArrayVerify() { | |
333 CHECK(IsExternalDoubleArray()); | |
334 } | |
335 | 256 |
336 | 257 |
337 template <class Traits> | 258 template <class Traits> |
338 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { | 259 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { |
339 CHECK(IsHeapObject() && | 260 CHECK(IsHeapObject() && |
340 HeapObject::cast(this)->map()->instance_type() == | 261 HeapObject::cast(this)->map()->instance_type() == |
341 Traits::kInstanceType); | 262 Traits::kInstanceType); |
342 } | 263 } |
343 | 264 |
344 | 265 |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 FixedArray* e = FixedArray::cast(elements()); | 1028 FixedArray* e = FixedArray::cast(elements()); |
1108 int len = e->length(); | 1029 int len = e->length(); |
1109 Heap* heap = GetHeap(); | 1030 Heap* heap = GetHeap(); |
1110 for (int i = 0; i < len; i++) { | 1031 for (int i = 0; i < len; i++) { |
1111 if (e->get(i) == heap->the_hole_value()) holes++; | 1032 if (e->get(i) == heap->the_hole_value()) holes++; |
1112 } | 1033 } |
1113 info->number_of_fast_used_elements_ += len - holes; | 1034 info->number_of_fast_used_elements_ += len - holes; |
1114 info->number_of_fast_unused_elements_ += holes; | 1035 info->number_of_fast_unused_elements_ += holes; |
1115 break; | 1036 break; |
1116 } | 1037 } |
1117 case EXTERNAL_BYTE_ELEMENTS: | 1038 |
1118 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 1039 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
1119 case EXTERNAL_SHORT_ELEMENTS: | 1040 case EXTERNAL_##TYPE##_ELEMENTS: \ |
1120 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 1041 case TYPE##_ELEMENTS: |
1121 case EXTERNAL_INT_ELEMENTS: | 1042 |
1122 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 1043 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
1123 case EXTERNAL_FLOAT_ELEMENTS: | 1044 #undef TYPED_ARRAY_CASE |
1124 case EXTERNAL_DOUBLE_ELEMENTS: | 1045 { info->number_of_objects_with_fast_elements_++; |
1125 case EXTERNAL_PIXEL_ELEMENTS: | |
1126 case UINT8_ELEMENTS: | |
1127 case INT8_ELEMENTS: | |
1128 case UINT16_ELEMENTS: | |
1129 case INT16_ELEMENTS: | |
1130 case UINT32_ELEMENTS: | |
1131 case INT32_ELEMENTS: | |
1132 case FLOAT32_ELEMENTS: | |
1133 case FLOAT64_ELEMENTS: | |
1134 case UINT8_CLAMPED_ELEMENTS: { | |
1135 info->number_of_objects_with_fast_elements_++; | |
1136 FixedArrayBase* e = FixedArrayBase::cast(elements()); | 1046 FixedArrayBase* e = FixedArrayBase::cast(elements()); |
1137 info->number_of_fast_used_elements_ += e->length(); | 1047 info->number_of_fast_used_elements_ += e->length(); |
1138 break; | 1048 break; |
1139 } | 1049 } |
1140 case DICTIONARY_ELEMENTS: { | 1050 case DICTIONARY_ELEMENTS: { |
1141 SeededNumberDictionary* dict = element_dictionary(); | 1051 SeededNumberDictionary* dict = element_dictionary(); |
1142 info->number_of_slow_used_elements_ += dict->NumberOfElements(); | 1052 info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
1143 info->number_of_slow_unused_elements_ += | 1053 info->number_of_slow_unused_elements_ += |
1144 dict->Capacity() - dict->NumberOfElements(); | 1054 dict->Capacity() - dict->NumberOfElements(); |
1145 break; | 1055 break; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 for (int i = 0; i < number_of_transitions(); ++i) { | 1151 for (int i = 0; i < number_of_transitions(); ++i) { |
1242 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; | 1152 if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
1243 } | 1153 } |
1244 return true; | 1154 return true; |
1245 } | 1155 } |
1246 | 1156 |
1247 | 1157 |
1248 #endif // DEBUG | 1158 #endif // DEBUG |
1249 | 1159 |
1250 } } // namespace v8::internal | 1160 } } // namespace v8::internal |
OLD | NEW |