| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ByteArray::cast(this)->ByteArrayVerify(); | 71 ByteArray::cast(this)->ByteArrayVerify(); |
| 72 break; | 72 break; |
| 73 case BYTECODE_ARRAY_TYPE: | 73 case BYTECODE_ARRAY_TYPE: |
| 74 BytecodeArray::cast(this)->BytecodeArrayVerify(); | 74 BytecodeArray::cast(this)->BytecodeArrayVerify(); |
| 75 break; | 75 break; |
| 76 case FREE_SPACE_TYPE: | 76 case FREE_SPACE_TYPE: |
| 77 FreeSpace::cast(this)->FreeSpaceVerify(); | 77 FreeSpace::cast(this)->FreeSpaceVerify(); |
| 78 break; | 78 break; |
| 79 | 79 |
| 80 #define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 80 #define VERIFY_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
| 81 case EXTERNAL_##TYPE##_ARRAY_TYPE: \ | |
| 82 External##Type##Array::cast(this)->External##Type##ArrayVerify(); \ | |
| 83 break; \ | |
| 84 case FIXED_##TYPE##_ARRAY_TYPE: \ | 81 case FIXED_##TYPE##_ARRAY_TYPE: \ |
| 85 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \ | 82 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \ |
| 86 break; | 83 break; |
| 87 | 84 |
| 88 TYPED_ARRAYS(VERIFY_TYPED_ARRAY) | 85 TYPED_ARRAYS(VERIFY_TYPED_ARRAY) |
| 89 #undef VERIFY_TYPED_ARRAY | 86 #undef VERIFY_TYPED_ARRAY |
| 90 | 87 |
| 91 case CODE_TYPE: | 88 case CODE_TYPE: |
| 92 Code::cast(this)->CodeVerify(); | 89 Code::cast(this)->CodeVerify(); |
| 93 break; | 90 break; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // TODO(oth): Walk bytecodes and immediate values to validate sanity. | 226 // TODO(oth): Walk bytecodes and immediate values to validate sanity. |
| 230 CHECK(IsBytecodeArray()); | 227 CHECK(IsBytecodeArray()); |
| 231 } | 228 } |
| 232 | 229 |
| 233 | 230 |
| 234 void FreeSpace::FreeSpaceVerify() { | 231 void FreeSpace::FreeSpaceVerify() { |
| 235 CHECK(IsFreeSpace()); | 232 CHECK(IsFreeSpace()); |
| 236 } | 233 } |
| 237 | 234 |
| 238 | 235 |
| 239 #define EXTERNAL_ARRAY_VERIFY(Type, type, TYPE, ctype, size) \ | |
| 240 void External##Type##Array::External##Type##ArrayVerify() { \ | |
| 241 CHECK(IsExternal##Type##Array()); \ | |
| 242 } | |
| 243 | |
| 244 TYPED_ARRAYS(EXTERNAL_ARRAY_VERIFY) | |
| 245 #undef EXTERNAL_ARRAY_VERIFY | |
| 246 | |
| 247 | |
| 248 template <class Traits> | 236 template <class Traits> |
| 249 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { | 237 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { |
| 250 CHECK(IsHeapObject() && | 238 CHECK(IsHeapObject() && |
| 251 HeapObject::cast(this)->map()->instance_type() == | 239 HeapObject::cast(this)->map()->instance_type() == |
| 252 Traits::kInstanceType); | 240 Traits::kInstanceType); |
| 253 CHECK(base_pointer() == this); | 241 if (base_pointer() == this) { |
| 242 CHECK(external_pointer() == |
| 243 ExternalReference::fixed_typed_array_base_data_offset().address()); |
| 244 } else { |
| 245 CHECK(base_pointer() == nullptr); |
| 246 } |
| 254 } | 247 } |
| 255 | 248 |
| 256 | 249 |
| 257 bool JSObject::ElementsAreSafeToExamine() { | 250 bool JSObject::ElementsAreSafeToExamine() { |
| 258 // If a GC was caused while constructing this object, the elements | 251 // If a GC was caused while constructing this object, the elements |
| 259 // pointer may point to a one pointer filler map. | 252 // pointer may point to a one pointer filler map. |
| 260 return reinterpret_cast<Map*>(elements()) != | 253 return reinterpret_cast<Map*>(elements()) != |
| 261 GetHeap()->one_pointer_filler_map(); | 254 GetHeap()->one_pointer_filler_map(); |
| 262 } | 255 } |
| 263 | 256 |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 Heap* heap = GetHeap(); | 1082 Heap* heap = GetHeap(); |
| 1090 for (int i = 0; i < len; i++) { | 1083 for (int i = 0; i < len; i++) { |
| 1091 if (e->get(i) == heap->the_hole_value()) holes++; | 1084 if (e->get(i) == heap->the_hole_value()) holes++; |
| 1092 } | 1085 } |
| 1093 info->number_of_fast_used_elements_ += len - holes; | 1086 info->number_of_fast_used_elements_ += len - holes; |
| 1094 info->number_of_fast_unused_elements_ += holes; | 1087 info->number_of_fast_unused_elements_ += holes; |
| 1095 break; | 1088 break; |
| 1096 } | 1089 } |
| 1097 | 1090 |
| 1098 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 1091 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 1099 case EXTERNAL_##TYPE##_ELEMENTS: \ | |
| 1100 case TYPE##_ELEMENTS: | 1092 case TYPE##_ELEMENTS: |
| 1101 | 1093 |
| 1102 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 1094 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
| 1103 #undef TYPED_ARRAY_CASE | 1095 #undef TYPED_ARRAY_CASE |
| 1104 { info->number_of_objects_with_fast_elements_++; | 1096 { info->number_of_objects_with_fast_elements_++; |
| 1105 FixedArrayBase* e = FixedArrayBase::cast(elements()); | 1097 FixedArrayBase* e = FixedArrayBase::cast(elements()); |
| 1106 info->number_of_fast_used_elements_ += e->length(); | 1098 info->number_of_fast_used_elements_ += e->length(); |
| 1107 break; | 1099 break; |
| 1108 } | 1100 } |
| 1109 case DICTIONARY_ELEMENTS: { | 1101 case DICTIONARY_ELEMENTS: { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 : it.rinfo()->target_object(); | 1274 : it.rinfo()->target_object(); |
| 1283 CHECK(!CanLeak(target, heap, skip_weak_cell)); | 1275 CHECK(!CanLeak(target, heap, skip_weak_cell)); |
| 1284 } | 1276 } |
| 1285 } | 1277 } |
| 1286 | 1278 |
| 1287 | 1279 |
| 1288 #endif // DEBUG | 1280 #endif // DEBUG |
| 1289 | 1281 |
| 1290 } // namespace internal | 1282 } // namespace internal |
| 1291 } // namespace v8 | 1283 } // namespace v8 |
| OLD | NEW |