Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: src/objects-debug.cc

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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; \
81 case FIXED_##TYPE##_ARRAY_TYPE: \ 84 case FIXED_##TYPE##_ARRAY_TYPE: \
82 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \ 85 Fixed##Type##Array::cast(this)->FixedTypedArrayVerify(); \
83 break; 86 break;
84 87
85 TYPED_ARRAYS(VERIFY_TYPED_ARRAY) 88 TYPED_ARRAYS(VERIFY_TYPED_ARRAY)
86 #undef VERIFY_TYPED_ARRAY 89 #undef VERIFY_TYPED_ARRAY
87 90
88 case CODE_TYPE: 91 case CODE_TYPE:
89 Code::cast(this)->CodeVerify(); 92 Code::cast(this)->CodeVerify();
90 break; 93 break;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // TODO(oth): Walk bytecodes and immediate values to validate sanity. 229 // TODO(oth): Walk bytecodes and immediate values to validate sanity.
227 CHECK(IsBytecodeArray()); 230 CHECK(IsBytecodeArray());
228 } 231 }
229 232
230 233
231 void FreeSpace::FreeSpaceVerify() { 234 void FreeSpace::FreeSpaceVerify() {
232 CHECK(IsFreeSpace()); 235 CHECK(IsFreeSpace());
233 } 236 }
234 237
235 238
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
236 template <class Traits> 248 template <class Traits>
237 void FixedTypedArray<Traits>::FixedTypedArrayVerify() { 249 void FixedTypedArray<Traits>::FixedTypedArrayVerify() {
238 CHECK(IsHeapObject() && 250 CHECK(IsHeapObject() &&
239 HeapObject::cast(this)->map()->instance_type() == 251 HeapObject::cast(this)->map()->instance_type() ==
240 Traits::kInstanceType); 252 Traits::kInstanceType);
241 if (base_pointer() == this) { 253 CHECK(base_pointer() == this);
242 CHECK(external_pointer() ==
243 ExternalReference::fixed_typed_array_base_data_offset().address());
244 } else {
245 CHECK(base_pointer() == nullptr);
246 }
247 } 254 }
248 255
249 256
250 bool JSObject::ElementsAreSafeToExamine() { 257 bool JSObject::ElementsAreSafeToExamine() {
251 // If a GC was caused while constructing this object, the elements 258 // If a GC was caused while constructing this object, the elements
252 // pointer may point to a one pointer filler map. 259 // pointer may point to a one pointer filler map.
253 return reinterpret_cast<Map*>(elements()) != 260 return reinterpret_cast<Map*>(elements()) !=
254 GetHeap()->one_pointer_filler_map(); 261 GetHeap()->one_pointer_filler_map();
255 } 262 }
256 263
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 Heap* heap = GetHeap(); 1089 Heap* heap = GetHeap();
1083 for (int i = 0; i < len; i++) { 1090 for (int i = 0; i < len; i++) {
1084 if (e->get(i) == heap->the_hole_value()) holes++; 1091 if (e->get(i) == heap->the_hole_value()) holes++;
1085 } 1092 }
1086 info->number_of_fast_used_elements_ += len - holes; 1093 info->number_of_fast_used_elements_ += len - holes;
1087 info->number_of_fast_unused_elements_ += holes; 1094 info->number_of_fast_unused_elements_ += holes;
1088 break; 1095 break;
1089 } 1096 }
1090 1097
1091 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ 1098 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1099 case EXTERNAL_##TYPE##_ELEMENTS: \
1092 case TYPE##_ELEMENTS: 1100 case TYPE##_ELEMENTS:
1093 1101
1094 TYPED_ARRAYS(TYPED_ARRAY_CASE) 1102 TYPED_ARRAYS(TYPED_ARRAY_CASE)
1095 #undef TYPED_ARRAY_CASE 1103 #undef TYPED_ARRAY_CASE
1096 { info->number_of_objects_with_fast_elements_++; 1104 { info->number_of_objects_with_fast_elements_++;
1097 FixedArrayBase* e = FixedArrayBase::cast(elements()); 1105 FixedArrayBase* e = FixedArrayBase::cast(elements());
1098 info->number_of_fast_used_elements_ += e->length(); 1106 info->number_of_fast_used_elements_ += e->length();
1099 break; 1107 break;
1100 } 1108 }
1101 case DICTIONARY_ELEMENTS: { 1109 case DICTIONARY_ELEMENTS: {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 : it.rinfo()->target_object(); 1282 : it.rinfo()->target_object();
1275 CHECK(!CanLeak(target, heap, skip_weak_cell)); 1283 CHECK(!CanLeak(target, heap, skip_weak_cell));
1276 } 1284 }
1277 } 1285 }
1278 1286
1279 1287
1280 #endif // DEBUG 1288 #endif // DEBUG
1281 1289
1282 } // namespace internal 1290 } // namespace internal
1283 } // namespace v8 1291 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698