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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/disasm.h" | 7 #include "src/disasm.h" |
8 #include "src/disassembler.h" | 8 #include "src/disassembler.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/jsregexp.h" | 10 #include "src/jsregexp.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 FixedDoubleArray::cast(this)->FixedDoubleArrayVerify(); | 68 FixedDoubleArray::cast(this)->FixedDoubleArrayVerify(); |
69 break; | 69 break; |
70 case BYTE_ARRAY_TYPE: | 70 case BYTE_ARRAY_TYPE: |
71 ByteArray::cast(this)->ByteArrayVerify(); | 71 ByteArray::cast(this)->ByteArrayVerify(); |
72 break; | 72 break; |
73 case FREE_SPACE_TYPE: | 73 case FREE_SPACE_TYPE: |
74 FreeSpace::cast(this)->FreeSpaceVerify(); | 74 FreeSpace::cast(this)->FreeSpaceVerify(); |
75 break; | 75 break; |
76 | 76 |
77 #define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 77 #define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
78 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ | |
79 External##Type##Array::cast(this)->External##Type##ArrayVerify(); \ | |
80 break; \ | |
81 case FIXED_##TYPE##_ARRAY_TYPE: \ | 78 case FIXED_##TYPE##_ARRAY_TYPE: \ |
82 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \ | 79 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \ |
83 break; | 80 break; |
84 | 81 |
85 TYPED_ARRAYS(VERIFY_TYPED_ARRAY) | 82 TYPED_ARRAYS(VERIFY_TYPED_ARRAY) |
86 #undef VERIFY_TYPED_ARRAY | 83 #undef VERIFY_TYPED_ARRAY |
87 | 84 |
88 case CODE_TYPE: | 85 case CODE_TYPE: |
89 Code::cast(this)->CodeVerify(); | 86 Code::cast(this)->CodeVerify(); |
90 break; | 87 break; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void ByteArray::ByteArrayVerify() { | 217 void ByteArray::ByteArrayVerify() { |
221 CHECK(IsByteArray()); | 218 CHECK(IsByteArray()); |
222 } | 219 } |
223 | 220 |
224 | 221 |
225 void FreeSpace::FreeSpaceVerify() { | 222 void FreeSpace::FreeSpaceVerify() { |
226 CHECK(IsFreeSpace()); | 223 CHECK(IsFreeSpace()); |
227 } | 224 } |
228 | 225 |
229 | 226 |
230 #define EXTERNAL_ARRAY_VERIFY(Type, type, TYPE, ctype, size) \ | |
231 void External##Type##Array::External##Type##ArrayVerify() { \ | |
232 CHECK(IsExternal##Type##Array()); \ | |
233 } | |
234 | |
235 TYPED_ARRAYS(EXTERNAL_ARRAY_VERIFY) | |
236 #undef EXTERNAL_ARRAY_VERIFY | |
237 | |
238 | |
239 template <class Traits> | 227 template <class Traits> |
240 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { | 228 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { |
241 CHECK(IsHeapObject() && | 229 CHECK(IsHeapObject() && |
242 HeapObject::cast(this)->map()->instance_type() == | 230 HeapObject::cast(this)->map()->instance_type() == |
243 Traits::kInstanceType); | 231 Traits::kInstanceType); |
244 CHECK(base_pointer() == this); | 232 if (base_pointer() == this) { |
| 233 CHECK(external_pointer() == |
| 234 ExternalReference::fixed_typed_array_base_data_offset().address()); |
| 235 } else { |
| 236 CHECK(base_pointer() == nullptr); |
| 237 } |
245 } | 238 } |
246 | 239 |
247 | 240 |
248 bool JSObject::ElementsAreSafeToExamine() { | 241 bool JSObject::ElementsAreSafeToExamine() { |
249 // If a GC was caused while constructing this object, the elements | 242 // If a GC was caused while constructing this object, the elements |
250 // pointer may point to a one pointer filler map. | 243 // pointer may point to a one pointer filler map. |
251 return reinterpret_cast<Map*>(elements()) != | 244 return reinterpret_cast<Map*>(elements()) != |
252 GetHeap()->one_pointer_filler_map(); | 245 GetHeap()->one_pointer_filler_map(); |
253 } | 246 } |
254 | 247 |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 Heap* heap = GetHeap(); | 1071 Heap* heap = GetHeap(); |
1079 for (int i = 0; i < len; i++) { | 1072 for (int i = 0; i < len; i++) { |
1080 if (e->get(i) == heap->the_hole_value()) holes++; | 1073 if (e->get(i) == heap->the_hole_value()) holes++; |
1081 } | 1074 } |
1082 info->number_of_fast_used_elements_ += len - holes; | 1075 info->number_of_fast_used_elements_ += len - holes; |
1083 info->number_of_fast_unused_elements_ += holes; | 1076 info->number_of_fast_unused_elements_ += holes; |
1084 break; | 1077 break; |
1085 } | 1078 } |
1086 | 1079 |
1087 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 1080 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
1088 case EXTERNAL_##TYPE##_ELEMENTS: \ | |
1089 case TYPE##_ELEMENTS: | 1081 case TYPE##_ELEMENTS: |
1090 | 1082 |
1091 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 1083 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
1092 #undef TYPED_ARRAY_CASE | 1084 #undef TYPED_ARRAY_CASE |
1093 { info->number_of_objects_with_fast_elements_++; | 1085 { info->number_of_objects_with_fast_elements_++; |
1094 FixedArrayBase* e = FixedArrayBase::cast(elements()); | 1086 FixedArrayBase* e = FixedArrayBase::cast(elements()); |
1095 info->number_of_fast_used_elements_ += e->length(); | 1087 info->number_of_fast_used_elements_ += e->length(); |
1096 break; | 1088 break; |
1097 } | 1089 } |
1098 case DICTIONARY_ELEMENTS: { | 1090 case DICTIONARY_ELEMENTS: { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 : it.rinfo()->target_object(); | 1263 : it.rinfo()->target_object(); |
1272 CHECK(!CanLeak(target, heap, skip_weak_cell)); | 1264 CHECK(!CanLeak(target, heap, skip_weak_cell)); |
1273 } | 1265 } |
1274 } | 1266 } |
1275 | 1267 |
1276 | 1268 |
1277 #endif // DEBUG | 1269 #endif // DEBUG |
1278 | 1270 |
1279 } // namespace internal | 1271 } // namespace internal |
1280 } // namespace v8 | 1272 } // namespace v8 |
OLD | NEW |