ulan@chromium.org | 65a89c2 | 2012-02-14 11:46:07 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #include "v8.h" |
| 29 | |
| 30 | #include "disassembler.h" |
| 31 | #include "disasm.h" |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 32 | #include "jsregexp.h" |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 33 | #include "objects-visiting.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 34 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 35 | namespace v8 { |
| 36 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 37 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 38 | #ifdef DEBUG |
fschneider@chromium.org | 9e3e0b6 | 2011-01-03 10:16:46 +0000 | [diff] [blame] | 39 | |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 40 | void MaybeObject::Verify() { |
| 41 | Object* this_as_object; |
| 42 | if (ToObject(&this_as_object)) { |
| 43 | if (this_as_object->IsSmi()) { |
| 44 | Smi::cast(this_as_object)->SmiVerify(); |
| 45 | } else { |
| 46 | HeapObject::cast(this_as_object)->HeapObjectVerify(); |
| 47 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 48 | } else { |
lrn@chromium.org | 303ada7 | 2010-10-27 09:33:13 +0000 | [diff] [blame] | 49 | Failure::cast(this)->FailureVerify(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 50 | } |
| 51 | } |
| 52 | |
| 53 | |
| 54 | void Object::VerifyPointer(Object* p) { |
| 55 | if (p->IsHeapObject()) { |
| 56 | HeapObject::VerifyHeapPointer(p); |
| 57 | } else { |
| 58 | ASSERT(p->IsSmi()); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | |
| 63 | void Smi::SmiVerify() { |
| 64 | ASSERT(IsSmi()); |
| 65 | } |
| 66 | |
| 67 | |
| 68 | void Failure::FailureVerify() { |
| 69 | ASSERT(IsFailure()); |
| 70 | } |
| 71 | |
| 72 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 73 | void HeapObject::HeapObjectVerify() { |
| 74 | InstanceType instance_type = map()->instance_type(); |
| 75 | |
| 76 | if (instance_type < FIRST_NONSTRING_TYPE) { |
| 77 | String::cast(this)->StringVerify(); |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | switch (instance_type) { |
| 82 | case MAP_TYPE: |
| 83 | Map::cast(this)->MapVerify(); |
| 84 | break; |
| 85 | case HEAP_NUMBER_TYPE: |
| 86 | HeapNumber::cast(this)->HeapNumberVerify(); |
| 87 | break; |
| 88 | case FIXED_ARRAY_TYPE: |
| 89 | FixedArray::cast(this)->FixedArrayVerify(); |
| 90 | break; |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 91 | case FIXED_DOUBLE_ARRAY_TYPE: |
| 92 | FixedDoubleArray::cast(this)->FixedDoubleArrayVerify(); |
| 93 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 94 | case BYTE_ARRAY_TYPE: |
| 95 | ByteArray::cast(this)->ByteArrayVerify(); |
| 96 | break; |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 97 | case FREE_SPACE_TYPE: |
| 98 | FreeSpace::cast(this)->FreeSpaceVerify(); |
| 99 | break; |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 100 | case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 101 | ExternalPixelArray::cast(this)->ExternalPixelArrayVerify(); |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 102 | break; |
ager@chromium.org | 3811b43 | 2009-10-28 14:53:37 +0000 | [diff] [blame] | 103 | case EXTERNAL_BYTE_ARRAY_TYPE: |
| 104 | ExternalByteArray::cast(this)->ExternalByteArrayVerify(); |
| 105 | break; |
| 106 | case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 107 | ExternalUnsignedByteArray::cast(this)->ExternalUnsignedByteArrayVerify(); |
| 108 | break; |
| 109 | case EXTERNAL_SHORT_ARRAY_TYPE: |
| 110 | ExternalShortArray::cast(this)->ExternalShortArrayVerify(); |
| 111 | break; |
| 112 | case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 113 | ExternalUnsignedShortArray::cast(this)-> |
| 114 | ExternalUnsignedShortArrayVerify(); |
| 115 | break; |
| 116 | case EXTERNAL_INT_ARRAY_TYPE: |
| 117 | ExternalIntArray::cast(this)->ExternalIntArrayVerify(); |
| 118 | break; |
| 119 | case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 120 | ExternalUnsignedIntArray::cast(this)->ExternalUnsignedIntArrayVerify(); |
| 121 | break; |
| 122 | case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 123 | ExternalFloatArray::cast(this)->ExternalFloatArrayVerify(); |
| 124 | break; |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 125 | case EXTERNAL_DOUBLE_ARRAY_TYPE: |
| 126 | ExternalDoubleArray::cast(this)->ExternalDoubleArrayVerify(); |
| 127 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 128 | case CODE_TYPE: |
| 129 | Code::cast(this)->CodeVerify(); |
| 130 | break; |
| 131 | case ODDBALL_TYPE: |
| 132 | Oddball::cast(this)->OddballVerify(); |
| 133 | break; |
| 134 | case JS_OBJECT_TYPE: |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 135 | case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 136 | JSObject::cast(this)->JSObjectVerify(); |
| 137 | break; |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 138 | case JS_MODULE_TYPE: |
| 139 | JSModule::cast(this)->JSModuleVerify(); |
| 140 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 141 | case JS_VALUE_TYPE: |
| 142 | JSValue::cast(this)->JSValueVerify(); |
| 143 | break; |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 144 | case JS_DATE_TYPE: |
| 145 | JSDate::cast(this)->JSDateVerify(); |
| 146 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 147 | case JS_FUNCTION_TYPE: |
| 148 | JSFunction::cast(this)->JSFunctionVerify(); |
| 149 | break; |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 150 | case JS_GLOBAL_PROXY_TYPE: |
| 151 | JSGlobalProxy::cast(this)->JSGlobalProxyVerify(); |
| 152 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 153 | case JS_GLOBAL_OBJECT_TYPE: |
| 154 | JSGlobalObject::cast(this)->JSGlobalObjectVerify(); |
| 155 | break; |
| 156 | case JS_BUILTINS_OBJECT_TYPE: |
| 157 | JSBuiltinsObject::cast(this)->JSBuiltinsObjectVerify(); |
| 158 | break; |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 159 | case JS_GLOBAL_PROPERTY_CELL_TYPE: |
| 160 | JSGlobalPropertyCell::cast(this)->JSGlobalPropertyCellVerify(); |
| 161 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 162 | case JS_ARRAY_TYPE: |
| 163 | JSArray::cast(this)->JSArrayVerify(); |
| 164 | break; |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 165 | case JS_SET_TYPE: |
| 166 | JSSet::cast(this)->JSSetVerify(); |
| 167 | break; |
| 168 | case JS_MAP_TYPE: |
| 169 | JSMap::cast(this)->JSMapVerify(); |
| 170 | break; |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 171 | case JS_WEAK_MAP_TYPE: |
| 172 | JSWeakMap::cast(this)->JSWeakMapVerify(); |
| 173 | break; |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 174 | case JS_REGEXP_TYPE: |
| 175 | JSRegExp::cast(this)->JSRegExpVerify(); |
| 176 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 177 | case FILLER_TYPE: |
| 178 | break; |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 179 | case JS_PROXY_TYPE: |
| 180 | JSProxy::cast(this)->JSProxyVerify(); |
| 181 | break; |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 182 | case JS_FUNCTION_PROXY_TYPE: |
| 183 | JSFunctionProxy::cast(this)->JSFunctionProxyVerify(); |
| 184 | break; |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 185 | case FOREIGN_TYPE: |
| 186 | Foreign::cast(this)->ForeignVerify(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 187 | break; |
| 188 | case SHARED_FUNCTION_INFO_TYPE: |
| 189 | SharedFunctionInfo::cast(this)->SharedFunctionInfoVerify(); |
| 190 | break; |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 191 | case JS_MESSAGE_OBJECT_TYPE: |
| 192 | JSMessageObject::cast(this)->JSMessageObjectVerify(); |
| 193 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 194 | |
| 195 | #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
| 196 | case NAME##_TYPE: \ |
| 197 | Name::cast(this)->Name##Verify(); \ |
| 198 | break; |
| 199 | STRUCT_LIST(MAKE_STRUCT_CASE) |
| 200 | #undef MAKE_STRUCT_CASE |
| 201 | |
| 202 | default: |
| 203 | UNREACHABLE(); |
| 204 | break; |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | |
| 209 | void HeapObject::VerifyHeapPointer(Object* p) { |
| 210 | ASSERT(p->IsHeapObject()); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 211 | ASSERT(HEAP->Contains(HeapObject::cast(p))); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | |
| 215 | void HeapNumber::HeapNumberVerify() { |
| 216 | ASSERT(IsHeapNumber()); |
| 217 | } |
| 218 | |
| 219 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 220 | void ByteArray::ByteArrayVerify() { |
| 221 | ASSERT(IsByteArray()); |
| 222 | } |
| 223 | |
| 224 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 225 | void FreeSpace::FreeSpaceVerify() { |
| 226 | ASSERT(IsFreeSpace()); |
| 227 | } |
| 228 | |
| 229 | |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 230 | void ExternalPixelArray::ExternalPixelArrayVerify() { |
| 231 | ASSERT(IsExternalPixelArray()); |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | |
ager@chromium.org | 3811b43 | 2009-10-28 14:53:37 +0000 | [diff] [blame] | 235 | void ExternalByteArray::ExternalByteArrayVerify() { |
| 236 | ASSERT(IsExternalByteArray()); |
| 237 | } |
| 238 | |
| 239 | |
| 240 | void ExternalUnsignedByteArray::ExternalUnsignedByteArrayVerify() { |
| 241 | ASSERT(IsExternalUnsignedByteArray()); |
| 242 | } |
| 243 | |
| 244 | |
| 245 | void ExternalShortArray::ExternalShortArrayVerify() { |
| 246 | ASSERT(IsExternalShortArray()); |
| 247 | } |
| 248 | |
| 249 | |
| 250 | void ExternalUnsignedShortArray::ExternalUnsignedShortArrayVerify() { |
| 251 | ASSERT(IsExternalUnsignedShortArray()); |
| 252 | } |
| 253 | |
| 254 | |
| 255 | void ExternalIntArray::ExternalIntArrayVerify() { |
| 256 | ASSERT(IsExternalIntArray()); |
| 257 | } |
| 258 | |
| 259 | |
| 260 | void ExternalUnsignedIntArray::ExternalUnsignedIntArrayVerify() { |
| 261 | ASSERT(IsExternalUnsignedIntArray()); |
| 262 | } |
| 263 | |
| 264 | |
| 265 | void ExternalFloatArray::ExternalFloatArrayVerify() { |
| 266 | ASSERT(IsExternalFloatArray()); |
| 267 | } |
| 268 | |
| 269 | |
erik.corry@gmail.com | 3847bd5 | 2011-04-27 10:38:56 +0000 | [diff] [blame] | 270 | void ExternalDoubleArray::ExternalDoubleArrayVerify() { |
| 271 | ASSERT(IsExternalDoubleArray()); |
| 272 | } |
| 273 | |
| 274 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 275 | void JSObject::JSObjectVerify() { |
| 276 | VerifyHeapPointer(properties()); |
| 277 | VerifyHeapPointer(elements()); |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 278 | |
| 279 | if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { |
| 280 | ASSERT(this->elements()->IsFixedArray()); |
| 281 | ASSERT(this->elements()->length() >= 2); |
| 282 | } |
| 283 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 284 | if (HasFastProperties()) { |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 285 | CHECK_EQ(map()->unused_property_fields(), |
| 286 | (map()->inobject_properties() + properties()->length() - |
| 287 | map()->NextFreePropertyIndex())); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 288 | } |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 289 | ASSERT_EQ((map()->has_fast_smi_or_object_elements() || |
ulan@chromium.org | 65a89c2 | 2012-02-14 11:46:07 +0000 | [diff] [blame] | 290 | (elements() == GetHeap()->empty_fixed_array())), |
ricow@chromium.org | 55ee807 | 2011-09-08 16:33:10 +0000 | [diff] [blame] | 291 | (elements()->map() == GetHeap()->fixed_array_map() || |
| 292 | elements()->map() == GetHeap()->fixed_cow_array_map())); |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 293 | ASSERT(map()->has_fast_object_elements() == HasFastObjectElements()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 297 | void Map::MapVerify() { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 298 | ASSERT(!HEAP->InNewSpace(this)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 299 | ASSERT(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE); |
erik.corry@gmail.com | 145eff5 | 2010-08-23 11:36:18 +0000 | [diff] [blame] | 300 | ASSERT(instance_size() == kVariableSizeSentinel || |
| 301 | (kPointerSize <= instance_size() && |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 302 | instance_size() < HEAP->Capacity())); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 303 | VerifyHeapPointer(prototype()); |
| 304 | VerifyHeapPointer(instance_descriptors()); |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 305 | SLOW_ASSERT(instance_descriptors()->IsSortedNoDuplicates()); |
| 306 | SLOW_ASSERT(instance_descriptors()->IsConsistentWithBackPointers(this)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 310 | void Map::SharedMapVerify() { |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 311 | MapVerify(); |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 312 | ASSERT(is_shared()); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 313 | ASSERT(instance_descriptors()->IsEmpty()); |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 314 | ASSERT_EQ(0, pre_allocated_property_fields()); |
| 315 | ASSERT_EQ(0, unused_property_fields()); |
| 316 | ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), |
| 317 | visitor_id()); |
| 318 | } |
| 319 | |
| 320 | |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 321 | void CodeCache::CodeCacheVerify() { |
| 322 | VerifyHeapPointer(default_cache()); |
| 323 | VerifyHeapPointer(normal_type_cache()); |
| 324 | ASSERT(default_cache()->IsFixedArray()); |
| 325 | ASSERT(normal_type_cache()->IsUndefined() |
| 326 | || normal_type_cache()->IsCodeCacheHashTable()); |
| 327 | } |
| 328 | |
| 329 | |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 330 | void PolymorphicCodeCache::PolymorphicCodeCacheVerify() { |
| 331 | VerifyHeapPointer(cache()); |
| 332 | ASSERT(cache()->IsUndefined() || cache()->IsPolymorphicCodeCacheHashTable()); |
| 333 | } |
| 334 | |
| 335 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 336 | void TypeFeedbackInfo::TypeFeedbackInfoVerify() { |
| 337 | VerifyObjectField(kIcTotalCountOffset); |
| 338 | VerifyObjectField(kIcWithTypeinfoCountOffset); |
| 339 | VerifyHeapPointer(type_feedback_cells()); |
| 340 | } |
| 341 | |
| 342 | |
yangguo@chromium.org | ab30bb8 | 2012-02-24 14:41:46 +0000 | [diff] [blame] | 343 | void AliasedArgumentsEntry::AliasedArgumentsEntryVerify() { |
| 344 | VerifySmiField(kAliasedContextSlot); |
| 345 | } |
| 346 | |
| 347 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 348 | void FixedArray::FixedArrayVerify() { |
| 349 | for (int i = 0; i < length(); i++) { |
| 350 | Object* e = get(i); |
| 351 | if (e->IsHeapObject()) { |
| 352 | VerifyHeapPointer(e); |
| 353 | } else { |
| 354 | e->Verify(); |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 360 | void FixedDoubleArray::FixedDoubleArrayVerify() { |
| 361 | for (int i = 0; i < length(); i++) { |
| 362 | if (!is_the_hole(i)) { |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 363 | double value = get_scalar(i); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 364 | ASSERT(!isnan(value) || |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 365 | (BitCast<uint64_t>(value) == |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 366 | BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) || |
| 367 | ((BitCast<uint64_t>(value) & Double::kSignMask) != 0)); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 368 | } |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 373 | void JSModule::JSModuleVerify() { |
| 374 | Object* v = context(); |
| 375 | if (v->IsHeapObject()) { |
| 376 | VerifyHeapPointer(v); |
| 377 | } |
| 378 | CHECK(v->IsUndefined() || v->IsModuleContext()); |
| 379 | } |
| 380 | |
| 381 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 382 | void JSValue::JSValueVerify() { |
| 383 | Object* v = value(); |
| 384 | if (v->IsHeapObject()) { |
| 385 | VerifyHeapPointer(v); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 390 | void JSDate::JSDateVerify() { |
| 391 | if (value()->IsHeapObject()) { |
| 392 | VerifyHeapPointer(value()); |
| 393 | } |
| 394 | CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); |
| 395 | CHECK(year()->IsUndefined() || year()->IsSmi() || year()->IsNaN()); |
| 396 | CHECK(month()->IsUndefined() || month()->IsSmi() || month()->IsNaN()); |
| 397 | CHECK(day()->IsUndefined() || day()->IsSmi() || day()->IsNaN()); |
| 398 | CHECK(weekday()->IsUndefined() || weekday()->IsSmi() || weekday()->IsNaN()); |
| 399 | CHECK(hour()->IsUndefined() || hour()->IsSmi() || hour()->IsNaN()); |
| 400 | CHECK(min()->IsUndefined() || min()->IsSmi() || min()->IsNaN()); |
| 401 | CHECK(sec()->IsUndefined() || sec()->IsSmi() || sec()->IsNaN()); |
| 402 | CHECK(cache_stamp()->IsUndefined() || |
| 403 | cache_stamp()->IsSmi() || |
| 404 | cache_stamp()->IsNaN()); |
| 405 | |
| 406 | if (month()->IsSmi()) { |
| 407 | int month = Smi::cast(this->month())->value(); |
| 408 | CHECK(0 <= month && month <= 11); |
| 409 | } |
| 410 | if (day()->IsSmi()) { |
| 411 | int day = Smi::cast(this->day())->value(); |
| 412 | CHECK(1 <= day && day <= 31); |
| 413 | } |
| 414 | if (hour()->IsSmi()) { |
| 415 | int hour = Smi::cast(this->hour())->value(); |
| 416 | CHECK(0 <= hour && hour <= 23); |
| 417 | } |
| 418 | if (min()->IsSmi()) { |
| 419 | int min = Smi::cast(this->min())->value(); |
| 420 | CHECK(0 <= min && min <= 59); |
| 421 | } |
| 422 | if (sec()->IsSmi()) { |
| 423 | int sec = Smi::cast(this->sec())->value(); |
| 424 | CHECK(0 <= sec && sec <= 59); |
| 425 | } |
| 426 | if (weekday()->IsSmi()) { |
| 427 | int weekday = Smi::cast(this->weekday())->value(); |
| 428 | CHECK(0 <= weekday && weekday <= 6); |
| 429 | } |
| 430 | if (cache_stamp()->IsSmi()) { |
| 431 | CHECK(Smi::cast(cache_stamp())->value() <= |
| 432 | Smi::cast(Isolate::Current()->date_cache()->stamp())->value()); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 437 | void JSMessageObject::JSMessageObjectVerify() { |
| 438 | CHECK(IsJSMessageObject()); |
| 439 | CHECK(type()->IsString()); |
| 440 | CHECK(arguments()->IsJSArray()); |
| 441 | VerifyObjectField(kStartPositionOffset); |
| 442 | VerifyObjectField(kEndPositionOffset); |
| 443 | VerifyObjectField(kArgumentsOffset); |
| 444 | VerifyObjectField(kScriptOffset); |
| 445 | VerifyObjectField(kStackTraceOffset); |
| 446 | VerifyObjectField(kStackFramesOffset); |
| 447 | } |
| 448 | |
| 449 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 450 | void String::StringVerify() { |
| 451 | CHECK(IsString()); |
| 452 | CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 453 | if (IsSymbol()) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 454 | CHECK(!HEAP->InNewSpace(this)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 455 | } |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 456 | if (IsConsString()) { |
| 457 | ConsString::cast(this)->ConsStringVerify(); |
| 458 | } else if (IsSlicedString()) { |
| 459 | SlicedString::cast(this)->SlicedStringVerify(); |
mstarzinger@chromium.org | 15613d0 | 2012-05-23 12:04:37 +0000 | [diff] [blame] | 460 | } else if (IsSeqAsciiString()) { |
| 461 | SeqAsciiString::cast(this)->SeqAsciiStringVerify(); |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 462 | } |
| 463 | } |
| 464 | |
| 465 | |
mstarzinger@chromium.org | 15613d0 | 2012-05-23 12:04:37 +0000 | [diff] [blame] | 466 | void SeqAsciiString::SeqAsciiStringVerify() { |
| 467 | CHECK(String::IsAscii(GetChars(), length())); |
| 468 | } |
| 469 | |
| 470 | |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 471 | void ConsString::ConsStringVerify() { |
| 472 | CHECK(this->first()->IsString()); |
| 473 | CHECK(this->second() == GetHeap()->empty_string() || |
| 474 | this->second()->IsString()); |
ulan@chromium.org | 2efb900 | 2012-01-19 15:36:35 +0000 | [diff] [blame] | 475 | CHECK(this->length() >= ConsString::kMinLength); |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 476 | if (this->IsFlat()) { |
| 477 | // A flat cons can only be created by String::SlowTryFlatten. |
| 478 | // Afterwards, the first part may be externalized. |
| 479 | CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | |
| 484 | void SlicedString::SlicedStringVerify() { |
| 485 | CHECK(!this->parent()->IsConsString()); |
| 486 | CHECK(!this->parent()->IsSlicedString()); |
| 487 | CHECK(this->length() >= SlicedString::kMinLength); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 491 | void JSFunction::JSFunctionVerify() { |
| 492 | CHECK(IsJSFunction()); |
| 493 | VerifyObjectField(kPrototypeOrInitialMapOffset); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 494 | VerifyObjectField(kNextFunctionLinkOffset); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 495 | CHECK(code()->IsCode()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 496 | CHECK(next_function_link()->IsUndefined() || |
| 497 | next_function_link()->IsJSFunction()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 498 | } |
| 499 | |
| 500 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 501 | void SharedFunctionInfo::SharedFunctionInfoVerify() { |
| 502 | CHECK(IsSharedFunctionInfo()); |
| 503 | VerifyObjectField(kNameOffset); |
| 504 | VerifyObjectField(kCodeOffset); |
ager@chromium.org | 6a2b0aa | 2010-07-13 20:58:03 +0000 | [diff] [blame] | 505 | VerifyObjectField(kScopeInfoOffset); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 506 | VerifyObjectField(kInstanceClassNameOffset); |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 507 | VerifyObjectField(kFunctionDataOffset); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 508 | VerifyObjectField(kScriptOffset); |
| 509 | VerifyObjectField(kDebugInfoOffset); |
| 510 | } |
| 511 | |
| 512 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 513 | void JSGlobalProxy::JSGlobalProxyVerify() { |
| 514 | CHECK(IsJSGlobalProxy()); |
| 515 | JSObjectVerify(); |
| 516 | VerifyObjectField(JSGlobalProxy::kContextOffset); |
| 517 | // Make sure that this object has no properties, elements. |
| 518 | CHECK_EQ(0, properties()->length()); |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 519 | CHECK(HasFastObjectElements()); |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 520 | CHECK_EQ(0, FixedArray::cast(elements())->length()); |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 524 | void JSGlobalObject::JSGlobalObjectVerify() { |
| 525 | CHECK(IsJSGlobalObject()); |
| 526 | JSObjectVerify(); |
| 527 | for (int i = GlobalObject::kBuiltinsOffset; |
| 528 | i < JSGlobalObject::kSize; |
| 529 | i += kPointerSize) { |
| 530 | VerifyObjectField(i); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 535 | void JSBuiltinsObject::JSBuiltinsObjectVerify() { |
| 536 | CHECK(IsJSBuiltinsObject()); |
| 537 | JSObjectVerify(); |
| 538 | for (int i = GlobalObject::kBuiltinsOffset; |
| 539 | i < JSBuiltinsObject::kSize; |
| 540 | i += kPointerSize) { |
| 541 | VerifyObjectField(i); |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | |
| 546 | void Oddball::OddballVerify() { |
| 547 | CHECK(IsOddball()); |
| 548 | VerifyHeapPointer(to_string()); |
| 549 | Object* number = to_number(); |
| 550 | if (number->IsHeapObject()) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 551 | ASSERT(number == HEAP->nan_value()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 552 | } else { |
| 553 | ASSERT(number->IsSmi()); |
| 554 | int value = Smi::cast(number)->value(); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 555 | // Hidden oddballs have negative smis. |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 556 | const int kLeastHiddenOddballNumber = -4; |
| 557 | ASSERT(value <= 1); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 558 | ASSERT(value >= kLeastHiddenOddballNumber); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 559 | } |
| 560 | } |
| 561 | |
| 562 | |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 563 | void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { |
| 564 | CHECK(IsJSGlobalPropertyCell()); |
| 565 | VerifyObjectField(kValueOffset); |
| 566 | } |
| 567 | |
| 568 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 569 | void Code::CodeVerify() { |
kasperl@chromium.org | 061ef74 | 2009-02-27 12:16:20 +0000 | [diff] [blame] | 570 | CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 571 | kCodeAlignment)); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 572 | relocation_info()->Verify(); |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 573 | Address last_gc_pc = NULL; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 574 | for (RelocIterator it(this); !it.done(); it.next()) { |
| 575 | it.rinfo()->Verify(); |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 576 | // Ensure that GC will not iterate twice over the same pointer. |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 577 | if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 578 | CHECK(it.rinfo()->pc() != last_gc_pc); |
| 579 | last_gc_pc = it.rinfo()->pc(); |
| 580 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 581 | } |
| 582 | } |
| 583 | |
| 584 | |
| 585 | void JSArray::JSArrayVerify() { |
| 586 | JSObjectVerify(); |
| 587 | ASSERT(length()->IsNumber() || length()->IsUndefined()); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 588 | ASSERT(elements()->IsUndefined() || |
| 589 | elements()->IsFixedArray() || |
| 590 | elements()->IsFixedDoubleArray()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 591 | } |
| 592 | |
| 593 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 594 | void JSSet::JSSetVerify() { |
| 595 | CHECK(IsJSSet()); |
| 596 | JSObjectVerify(); |
| 597 | VerifyHeapPointer(table()); |
| 598 | ASSERT(table()->IsHashTable() || table()->IsUndefined()); |
| 599 | } |
| 600 | |
| 601 | |
| 602 | void JSMap::JSMapVerify() { |
| 603 | CHECK(IsJSMap()); |
| 604 | JSObjectVerify(); |
| 605 | VerifyHeapPointer(table()); |
| 606 | ASSERT(table()->IsHashTable() || table()->IsUndefined()); |
| 607 | } |
| 608 | |
| 609 | |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 610 | void JSWeakMap::JSWeakMapVerify() { |
| 611 | CHECK(IsJSWeakMap()); |
| 612 | JSObjectVerify(); |
| 613 | VerifyHeapPointer(table()); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 614 | ASSERT(table()->IsHashTable() || table()->IsUndefined()); |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 615 | } |
| 616 | |
| 617 | |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 618 | void JSRegExp::JSRegExpVerify() { |
| 619 | JSObjectVerify(); |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 620 | ASSERT(data()->IsUndefined() || data()->IsFixedArray()); |
| 621 | switch (TypeTag()) { |
| 622 | case JSRegExp::ATOM: { |
| 623 | FixedArray* arr = FixedArray::cast(data()); |
| 624 | ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); |
| 625 | break; |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 626 | } |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 627 | case JSRegExp::IRREGEXP: { |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 628 | bool is_native = RegExpImpl::UsesNativeRegExp(); |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 629 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 630 | FixedArray* arr = FixedArray::cast(data()); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 631 | Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 632 | // Smi : Not compiled yet (-1) or code prepared for flushing. |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 633 | // JSObject: Compilation error. |
| 634 | // Code/ByteArray: Compiled code. |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 635 | ASSERT(ascii_data->IsSmi() || |
| 636 | (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 637 | Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 638 | ASSERT(uc16_data->IsSmi() || |
| 639 | (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); |
| 640 | |
| 641 | Object* ascii_saved = arr->get(JSRegExp::kIrregexpASCIICodeSavedIndex); |
| 642 | ASSERT(ascii_saved->IsSmi() || ascii_saved->IsString() || |
| 643 | ascii_saved->IsCode()); |
| 644 | Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex); |
| 645 | ASSERT(uc16_saved->IsSmi() || uc16_saved->IsString() || |
| 646 | uc16_saved->IsCode()); |
| 647 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 648 | ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); |
| 649 | ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 650 | break; |
| 651 | } |
| 652 | default: |
| 653 | ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); |
| 654 | ASSERT(data()->IsUndefined()); |
| 655 | break; |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 656 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 657 | } |
| 658 | |
| 659 | |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 660 | void JSProxy::JSProxyVerify() { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 661 | CHECK(IsJSProxy()); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 662 | VerifyPointer(handler()); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 663 | ASSERT(hash()->IsSmi() || hash()->IsUndefined()); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 664 | } |
| 665 | |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 666 | |
| 667 | void JSFunctionProxy::JSFunctionProxyVerify() { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 668 | CHECK(IsJSFunctionProxy()); |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 669 | JSProxyVerify(); |
| 670 | VerifyPointer(call_trap()); |
| 671 | VerifyPointer(construct_trap()); |
| 672 | } |
| 673 | |
| 674 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 675 | void Foreign::ForeignVerify() { |
| 676 | ASSERT(IsForeign()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 680 | void AccessorInfo::AccessorInfoVerify() { |
| 681 | CHECK(IsAccessorInfo()); |
| 682 | VerifyPointer(getter()); |
| 683 | VerifyPointer(setter()); |
| 684 | VerifyPointer(name()); |
| 685 | VerifyPointer(data()); |
| 686 | VerifyPointer(flag()); |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame^] | 687 | VerifyPointer(expected_receiver_type()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 688 | } |
| 689 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 690 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 691 | void AccessorPair::AccessorPairVerify() { |
| 692 | CHECK(IsAccessorPair()); |
| 693 | VerifyPointer(getter()); |
| 694 | VerifyPointer(setter()); |
| 695 | } |
| 696 | |
| 697 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 698 | void AccessCheckInfo::AccessCheckInfoVerify() { |
| 699 | CHECK(IsAccessCheckInfo()); |
| 700 | VerifyPointer(named_callback()); |
| 701 | VerifyPointer(indexed_callback()); |
| 702 | VerifyPointer(data()); |
| 703 | } |
| 704 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 705 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 706 | void InterceptorInfo::InterceptorInfoVerify() { |
| 707 | CHECK(IsInterceptorInfo()); |
| 708 | VerifyPointer(getter()); |
| 709 | VerifyPointer(setter()); |
| 710 | VerifyPointer(query()); |
| 711 | VerifyPointer(deleter()); |
| 712 | VerifyPointer(enumerator()); |
| 713 | VerifyPointer(data()); |
| 714 | } |
| 715 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 716 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 717 | void CallHandlerInfo::CallHandlerInfoVerify() { |
| 718 | CHECK(IsCallHandlerInfo()); |
| 719 | VerifyPointer(callback()); |
| 720 | VerifyPointer(data()); |
| 721 | } |
| 722 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 723 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 724 | void TemplateInfo::TemplateInfoVerify() { |
| 725 | VerifyPointer(tag()); |
| 726 | VerifyPointer(property_list()); |
| 727 | } |
| 728 | |
| 729 | void FunctionTemplateInfo::FunctionTemplateInfoVerify() { |
| 730 | CHECK(IsFunctionTemplateInfo()); |
| 731 | TemplateInfoVerify(); |
| 732 | VerifyPointer(serial_number()); |
| 733 | VerifyPointer(call_code()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 734 | VerifyPointer(property_accessors()); |
| 735 | VerifyPointer(prototype_template()); |
| 736 | VerifyPointer(parent_template()); |
| 737 | VerifyPointer(named_property_handler()); |
| 738 | VerifyPointer(indexed_property_handler()); |
| 739 | VerifyPointer(instance_template()); |
| 740 | VerifyPointer(signature()); |
| 741 | VerifyPointer(access_check_info()); |
| 742 | } |
| 743 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 744 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 745 | void ObjectTemplateInfo::ObjectTemplateInfoVerify() { |
| 746 | CHECK(IsObjectTemplateInfo()); |
| 747 | TemplateInfoVerify(); |
| 748 | VerifyPointer(constructor()); |
kasper.lund | 212ac23 | 2008-07-16 07:07:30 +0000 | [diff] [blame] | 749 | VerifyPointer(internal_field_count()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 750 | } |
| 751 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 752 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 753 | void SignatureInfo::SignatureInfoVerify() { |
| 754 | CHECK(IsSignatureInfo()); |
| 755 | VerifyPointer(receiver()); |
| 756 | VerifyPointer(args()); |
| 757 | } |
| 758 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 759 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 760 | void TypeSwitchInfo::TypeSwitchInfoVerify() { |
| 761 | CHECK(IsTypeSwitchInfo()); |
| 762 | VerifyPointer(types()); |
| 763 | } |
| 764 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 765 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 766 | void Script::ScriptVerify() { |
| 767 | CHECK(IsScript()); |
| 768 | VerifyPointer(source()); |
| 769 | VerifyPointer(name()); |
| 770 | line_offset()->SmiVerify(); |
| 771 | column_offset()->SmiVerify(); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 772 | VerifyPointer(data()); |
| 773 | VerifyPointer(wrapper()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 774 | type()->SmiVerify(); |
sgjesse@chromium.org | 499aaa5 | 2009-11-30 08:07:20 +0000 | [diff] [blame] | 775 | VerifyPointer(line_ends()); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 776 | VerifyPointer(id()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 777 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 778 | |
| 779 | |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 780 | #ifdef ENABLE_DEBUGGER_SUPPORT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 781 | void DebugInfo::DebugInfoVerify() { |
| 782 | CHECK(IsDebugInfo()); |
| 783 | VerifyPointer(shared()); |
| 784 | VerifyPointer(original_code()); |
| 785 | VerifyPointer(code()); |
| 786 | VerifyPointer(break_points()); |
| 787 | } |
| 788 | |
| 789 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 790 | void BreakPointInfo::BreakPointInfoVerify() { |
| 791 | CHECK(IsBreakPointInfo()); |
| 792 | code_position()->SmiVerify(); |
| 793 | source_position()->SmiVerify(); |
| 794 | statement_position()->SmiVerify(); |
| 795 | VerifyPointer(break_point_objects()); |
| 796 | } |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 797 | #endif // ENABLE_DEBUGGER_SUPPORT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 798 | |
| 799 | |
| 800 | void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
| 801 | info->number_of_objects_++; |
| 802 | // Named properties |
| 803 | if (HasFastProperties()) { |
| 804 | info->number_of_objects_with_fast_properties_++; |
| 805 | info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
| 806 | info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
| 807 | } else { |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 808 | StringDictionary* dict = property_dictionary(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 809 | info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
| 810 | info->number_of_slow_unused_properties_ += |
| 811 | dict->Capacity() - dict->NumberOfElements(); |
| 812 | } |
| 813 | // Indexed properties |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 814 | switch (GetElementsKind()) { |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 815 | case FAST_HOLEY_SMI_ELEMENTS: |
| 816 | case FAST_SMI_ELEMENTS: |
| 817 | case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 818 | case FAST_DOUBLE_ELEMENTS: |
| 819 | case FAST_HOLEY_ELEMENTS: |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 820 | case FAST_ELEMENTS: { |
| 821 | info->number_of_objects_with_fast_elements_++; |
| 822 | int holes = 0; |
| 823 | FixedArray* e = FixedArray::cast(elements()); |
| 824 | int len = e->length(); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 825 | Heap* heap = HEAP; |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 826 | for (int i = 0; i < len; i++) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 827 | if (e->get(i) == heap->the_hole_value()) holes++; |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 828 | } |
| 829 | info->number_of_fast_used_elements_ += len - holes; |
| 830 | info->number_of_fast_unused_elements_ += holes; |
| 831 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 832 | } |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 833 | case EXTERNAL_BYTE_ELEMENTS: |
| 834 | case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 835 | case EXTERNAL_SHORT_ELEMENTS: |
| 836 | case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 837 | case EXTERNAL_INT_ELEMENTS: |
| 838 | case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 839 | case EXTERNAL_FLOAT_ELEMENTS: |
| 840 | case EXTERNAL_DOUBLE_ELEMENTS: |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 841 | case EXTERNAL_PIXEL_ELEMENTS: { |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 842 | info->number_of_objects_with_fast_elements_++; |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 843 | ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 844 | info->number_of_fast_used_elements_ += e->length(); |
| 845 | break; |
| 846 | } |
| 847 | case DICTIONARY_ELEMENTS: { |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 848 | SeededNumberDictionary* dict = element_dictionary(); |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 849 | info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
| 850 | info->number_of_slow_unused_elements_ += |
| 851 | dict->Capacity() - dict->NumberOfElements(); |
| 852 | break; |
| 853 | } |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 854 | case NON_STRICT_ARGUMENTS_ELEMENTS: |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 855 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 856 | } |
| 857 | } |
| 858 | |
| 859 | |
| 860 | void JSObject::SpillInformation::Clear() { |
| 861 | number_of_objects_ = 0; |
| 862 | number_of_objects_with_fast_properties_ = 0; |
| 863 | number_of_objects_with_fast_elements_ = 0; |
| 864 | number_of_fast_used_fields_ = 0; |
| 865 | number_of_fast_unused_fields_ = 0; |
| 866 | number_of_slow_used_properties_ = 0; |
| 867 | number_of_slow_unused_properties_ = 0; |
| 868 | number_of_fast_used_elements_ = 0; |
| 869 | number_of_fast_unused_elements_ = 0; |
| 870 | number_of_slow_used_elements_ = 0; |
| 871 | number_of_slow_unused_elements_ = 0; |
| 872 | } |
| 873 | |
| 874 | void JSObject::SpillInformation::Print() { |
| 875 | PrintF("\n JSObject Spill Statistics (#%d):\n", number_of_objects_); |
| 876 | |
| 877 | PrintF(" - fast properties (#%d): %d (used) %d (unused)\n", |
| 878 | number_of_objects_with_fast_properties_, |
| 879 | number_of_fast_used_fields_, number_of_fast_unused_fields_); |
| 880 | |
| 881 | PrintF(" - slow properties (#%d): %d (used) %d (unused)\n", |
| 882 | number_of_objects_ - number_of_objects_with_fast_properties_, |
| 883 | number_of_slow_used_properties_, number_of_slow_unused_properties_); |
| 884 | |
| 885 | PrintF(" - fast elements (#%d): %d (used) %d (unused)\n", |
| 886 | number_of_objects_with_fast_elements_, |
| 887 | number_of_fast_used_elements_, number_of_fast_unused_elements_); |
| 888 | |
| 889 | PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", |
| 890 | number_of_objects_ - number_of_objects_with_fast_elements_, |
| 891 | number_of_slow_used_elements_, number_of_slow_unused_elements_); |
| 892 | |
| 893 | PrintF("\n"); |
| 894 | } |
| 895 | |
| 896 | |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 897 | bool DescriptorArray::IsSortedNoDuplicates() { |
| 898 | String* current_key = NULL; |
| 899 | uint32_t current = 0; |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 900 | for (int i = 0; i < number_of_descriptors(); i++) { |
| 901 | String* key = GetKey(i); |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 902 | if (key == current_key) { |
| 903 | PrintDescriptors(); |
| 904 | return false; |
| 905 | } |
| 906 | current_key = key; |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 907 | uint32_t hash = GetKey(i)->Hash(); |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 908 | if (hash < current) { |
| 909 | PrintDescriptors(); |
| 910 | return false; |
| 911 | } |
| 912 | current = hash; |
| 913 | } |
| 914 | return true; |
| 915 | } |
| 916 | |
| 917 | |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 918 | static bool CheckOneBackPointer(Map* current_map, Object* target) { |
| 919 | return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; |
| 920 | } |
| 921 | |
| 922 | |
| 923 | bool DescriptorArray::IsConsistentWithBackPointers(Map* current_map) { |
| 924 | for (int i = 0; i < number_of_descriptors(); ++i) { |
| 925 | switch (GetType(i)) { |
| 926 | case MAP_TRANSITION: |
| 927 | case CONSTANT_TRANSITION: |
| 928 | if (!CheckOneBackPointer(current_map, GetValue(i))) { |
| 929 | return false; |
| 930 | } |
| 931 | break; |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 932 | case CALLBACKS: { |
| 933 | Object* object = GetValue(i); |
| 934 | if (object->IsAccessorPair()) { |
| 935 | AccessorPair* accessors = AccessorPair::cast(object); |
| 936 | if (!CheckOneBackPointer(current_map, accessors->getter())) { |
| 937 | return false; |
| 938 | } |
| 939 | if (!CheckOneBackPointer(current_map, accessors->setter())) { |
| 940 | return false; |
| 941 | } |
| 942 | } |
| 943 | break; |
| 944 | } |
| 945 | case NORMAL: |
| 946 | case FIELD: |
| 947 | case CONSTANT_FUNCTION: |
| 948 | case HANDLER: |
| 949 | case INTERCEPTOR: |
| 950 | case NULL_DESCRIPTOR: |
| 951 | break; |
| 952 | } |
| 953 | } |
| 954 | return true; |
| 955 | } |
| 956 | |
| 957 | |
ager@chromium.org | ac091b7 | 2010-05-05 07:34:42 +0000 | [diff] [blame] | 958 | void JSFunctionResultCache::JSFunctionResultCacheVerify() { |
| 959 | JSFunction::cast(get(kFactoryIndex))->Verify(); |
| 960 | |
| 961 | int size = Smi::cast(get(kCacheSizeIndex))->value(); |
| 962 | ASSERT(kEntriesIndex <= size); |
| 963 | ASSERT(size <= length()); |
| 964 | ASSERT_EQ(0, size % kEntrySize); |
| 965 | |
| 966 | int finger = Smi::cast(get(kFingerIndex))->value(); |
| 967 | ASSERT(kEntriesIndex <= finger); |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 968 | ASSERT((finger < size) || (finger == kEntriesIndex && finger == size)); |
ager@chromium.org | ac091b7 | 2010-05-05 07:34:42 +0000 | [diff] [blame] | 969 | ASSERT_EQ(0, finger % kEntrySize); |
| 970 | |
| 971 | if (FLAG_enable_slow_asserts) { |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 972 | for (int i = kEntriesIndex; i < size; i++) { |
| 973 | ASSERT(!get(i)->IsTheHole()); |
ager@chromium.org | ac091b7 | 2010-05-05 07:34:42 +0000 | [diff] [blame] | 974 | get(i)->Verify(); |
erik.corry@gmail.com | 0511e24 | 2011-01-19 11:11:08 +0000 | [diff] [blame] | 975 | } |
| 976 | for (int i = size; i < length(); i++) { |
| 977 | ASSERT(get(i)->IsTheHole()); |
| 978 | get(i)->Verify(); |
ager@chromium.org | ac091b7 | 2010-05-05 07:34:42 +0000 | [diff] [blame] | 979 | } |
| 980 | } |
| 981 | } |
| 982 | |
| 983 | |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 984 | void NormalizedMapCache::NormalizedMapCacheVerify() { |
| 985 | FixedArray::cast(this)->Verify(); |
| 986 | if (FLAG_enable_slow_asserts) { |
| 987 | for (int i = 0; i < length(); i++) { |
| 988 | Object* e = get(i); |
| 989 | if (e->IsMap()) { |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 990 | Map::cast(e)->SharedMapVerify(); |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 991 | } else { |
| 992 | ASSERT(e->IsUndefined()); |
| 993 | } |
| 994 | } |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | |
yangguo@chromium.org | 5f0b8ea | 2012-05-16 12:37:04 +0000 | [diff] [blame] | 999 | void Map::ZapInstanceDescriptors() { |
| 1000 | DescriptorArray* descriptors = instance_descriptors(); |
| 1001 | if (descriptors == GetHeap()->empty_descriptor_array()) return; |
yangguo@chromium.org | 5f0b8ea | 2012-05-16 12:37:04 +0000 | [diff] [blame] | 1002 | MemsetPointer(descriptors->data_start(), |
| 1003 | GetHeap()->the_hole_value(), |
| 1004 | descriptors->length()); |
yangguo@chromium.org | 5f0b8ea | 2012-05-16 12:37:04 +0000 | [diff] [blame] | 1005 | } |
| 1006 | |
| 1007 | |
| 1008 | void Map::ZapPrototypeTransitions() { |
| 1009 | FixedArray* proto_transitions = prototype_transitions(); |
| 1010 | MemsetPointer(proto_transitions->data_start(), |
| 1011 | GetHeap()->the_hole_value(), |
| 1012 | proto_transitions->length()); |
| 1013 | } |
| 1014 | |
| 1015 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1016 | #endif // DEBUG |
| 1017 | |
| 1018 | } } // namespace v8::internal |