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()); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 306 | if (HasTransitionArray()) { |
| 307 | SLOW_ASSERT(transitions()->IsSortedNoDuplicates()); |
| 308 | SLOW_ASSERT(transitions()->IsConsistentWithBackPointers(this)); |
| 309 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 310 | } |
| 311 | |
| 312 | |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 313 | void Map::SharedMapVerify() { |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 314 | MapVerify(); |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 315 | ASSERT(is_shared()); |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 316 | ASSERT(instance_descriptors()->IsEmpty()); |
ricow@chromium.org | 65fae84 | 2010-08-25 15:26:24 +0000 | [diff] [blame] | 317 | ASSERT_EQ(0, pre_allocated_property_fields()); |
| 318 | ASSERT_EQ(0, unused_property_fields()); |
| 319 | ASSERT_EQ(StaticVisitorBase::GetVisitorId(instance_type(), instance_size()), |
| 320 | visitor_id()); |
| 321 | } |
| 322 | |
| 323 | |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 324 | void CodeCache::CodeCacheVerify() { |
| 325 | VerifyHeapPointer(default_cache()); |
| 326 | VerifyHeapPointer(normal_type_cache()); |
| 327 | ASSERT(default_cache()->IsFixedArray()); |
| 328 | ASSERT(normal_type_cache()->IsUndefined() |
| 329 | || normal_type_cache()->IsCodeCacheHashTable()); |
| 330 | } |
| 331 | |
| 332 | |
jkummerow@chromium.org | e297f59 | 2011-06-08 10:05:15 +0000 | [diff] [blame] | 333 | void PolymorphicCodeCache::PolymorphicCodeCacheVerify() { |
| 334 | VerifyHeapPointer(cache()); |
| 335 | ASSERT(cache()->IsUndefined() || cache()->IsPolymorphicCodeCacheHashTable()); |
| 336 | } |
| 337 | |
| 338 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 339 | void TypeFeedbackInfo::TypeFeedbackInfoVerify() { |
| 340 | VerifyObjectField(kIcTotalCountOffset); |
| 341 | VerifyObjectField(kIcWithTypeinfoCountOffset); |
| 342 | VerifyHeapPointer(type_feedback_cells()); |
| 343 | } |
| 344 | |
| 345 | |
yangguo@chromium.org | ab30bb8 | 2012-02-24 14:41:46 +0000 | [diff] [blame] | 346 | void AliasedArgumentsEntry::AliasedArgumentsEntryVerify() { |
| 347 | VerifySmiField(kAliasedContextSlot); |
| 348 | } |
| 349 | |
| 350 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 351 | void FixedArray::FixedArrayVerify() { |
| 352 | for (int i = 0; i < length(); i++) { |
| 353 | Object* e = get(i); |
| 354 | if (e->IsHeapObject()) { |
| 355 | VerifyHeapPointer(e); |
| 356 | } else { |
| 357 | e->Verify(); |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 363 | void FixedDoubleArray::FixedDoubleArrayVerify() { |
| 364 | for (int i = 0; i < length(); i++) { |
| 365 | if (!is_the_hole(i)) { |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 366 | double value = get_scalar(i); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 367 | ASSERT(!isnan(value) || |
svenpanne@chromium.org | 84bcc55 | 2011-07-18 09:50:57 +0000 | [diff] [blame] | 368 | (BitCast<uint64_t>(value) == |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 369 | BitCast<uint64_t>(canonical_not_the_hole_nan_as_double())) || |
| 370 | ((BitCast<uint64_t>(value) & Double::kSignMask) != 0)); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 371 | } |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 376 | void JSModule::JSModuleVerify() { |
danno@chromium.org | 81cac2b | 2012-07-10 11:28:27 +0000 | [diff] [blame] | 377 | VerifyObjectField(kContextOffset); |
| 378 | VerifyObjectField(kScopeInfoOffset); |
| 379 | CHECK(context()->IsUndefined() || context()->IsModuleContext()); |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 383 | void JSValue::JSValueVerify() { |
| 384 | Object* v = value(); |
| 385 | if (v->IsHeapObject()) { |
| 386 | VerifyHeapPointer(v); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | |
svenpanne@chromium.org | 4efbdb1 | 2012-03-12 08:18:42 +0000 | [diff] [blame] | 391 | void JSDate::JSDateVerify() { |
| 392 | if (value()->IsHeapObject()) { |
| 393 | VerifyHeapPointer(value()); |
| 394 | } |
| 395 | CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); |
| 396 | CHECK(year()->IsUndefined() || year()->IsSmi() || year()->IsNaN()); |
| 397 | CHECK(month()->IsUndefined() || month()->IsSmi() || month()->IsNaN()); |
| 398 | CHECK(day()->IsUndefined() || day()->IsSmi() || day()->IsNaN()); |
| 399 | CHECK(weekday()->IsUndefined() || weekday()->IsSmi() || weekday()->IsNaN()); |
| 400 | CHECK(hour()->IsUndefined() || hour()->IsSmi() || hour()->IsNaN()); |
| 401 | CHECK(min()->IsUndefined() || min()->IsSmi() || min()->IsNaN()); |
| 402 | CHECK(sec()->IsUndefined() || sec()->IsSmi() || sec()->IsNaN()); |
| 403 | CHECK(cache_stamp()->IsUndefined() || |
| 404 | cache_stamp()->IsSmi() || |
| 405 | cache_stamp()->IsNaN()); |
| 406 | |
| 407 | if (month()->IsSmi()) { |
| 408 | int month = Smi::cast(this->month())->value(); |
| 409 | CHECK(0 <= month && month <= 11); |
| 410 | } |
| 411 | if (day()->IsSmi()) { |
| 412 | int day = Smi::cast(this->day())->value(); |
| 413 | CHECK(1 <= day && day <= 31); |
| 414 | } |
| 415 | if (hour()->IsSmi()) { |
| 416 | int hour = Smi::cast(this->hour())->value(); |
| 417 | CHECK(0 <= hour && hour <= 23); |
| 418 | } |
| 419 | if (min()->IsSmi()) { |
| 420 | int min = Smi::cast(this->min())->value(); |
| 421 | CHECK(0 <= min && min <= 59); |
| 422 | } |
| 423 | if (sec()->IsSmi()) { |
| 424 | int sec = Smi::cast(this->sec())->value(); |
| 425 | CHECK(0 <= sec && sec <= 59); |
| 426 | } |
| 427 | if (weekday()->IsSmi()) { |
| 428 | int weekday = Smi::cast(this->weekday())->value(); |
| 429 | CHECK(0 <= weekday && weekday <= 6); |
| 430 | } |
| 431 | if (cache_stamp()->IsSmi()) { |
| 432 | CHECK(Smi::cast(cache_stamp())->value() <= |
| 433 | Smi::cast(Isolate::Current()->date_cache()->stamp())->value()); |
| 434 | } |
| 435 | } |
| 436 | |
| 437 | |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 438 | void JSMessageObject::JSMessageObjectVerify() { |
| 439 | CHECK(IsJSMessageObject()); |
| 440 | CHECK(type()->IsString()); |
| 441 | CHECK(arguments()->IsJSArray()); |
| 442 | VerifyObjectField(kStartPositionOffset); |
| 443 | VerifyObjectField(kEndPositionOffset); |
| 444 | VerifyObjectField(kArgumentsOffset); |
| 445 | VerifyObjectField(kScriptOffset); |
| 446 | VerifyObjectField(kStackTraceOffset); |
| 447 | VerifyObjectField(kStackFramesOffset); |
| 448 | } |
| 449 | |
| 450 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 451 | void String::StringVerify() { |
| 452 | CHECK(IsString()); |
| 453 | CHECK(length() >= 0 && length() <= Smi::kMaxValue); |
| 454 | if (IsSymbol()) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 455 | CHECK(!HEAP->InNewSpace(this)); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 456 | } |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 457 | if (IsConsString()) { |
| 458 | ConsString::cast(this)->ConsStringVerify(); |
| 459 | } else if (IsSlicedString()) { |
| 460 | SlicedString::cast(this)->SlicedStringVerify(); |
mstarzinger@chromium.org | 15613d0 | 2012-05-23 12:04:37 +0000 | [diff] [blame] | 461 | } else if (IsSeqAsciiString()) { |
| 462 | SeqAsciiString::cast(this)->SeqAsciiStringVerify(); |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 463 | } |
| 464 | } |
| 465 | |
| 466 | |
mstarzinger@chromium.org | 15613d0 | 2012-05-23 12:04:37 +0000 | [diff] [blame] | 467 | void SeqAsciiString::SeqAsciiStringVerify() { |
| 468 | CHECK(String::IsAscii(GetChars(), length())); |
| 469 | } |
| 470 | |
| 471 | |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 472 | void ConsString::ConsStringVerify() { |
| 473 | CHECK(this->first()->IsString()); |
| 474 | CHECK(this->second() == GetHeap()->empty_string() || |
| 475 | this->second()->IsString()); |
ulan@chromium.org | 2efb900 | 2012-01-19 15:36:35 +0000 | [diff] [blame] | 476 | CHECK(this->length() >= ConsString::kMinLength); |
ricow@chromium.org | 4668a2c | 2011-08-29 10:41:00 +0000 | [diff] [blame] | 477 | if (this->IsFlat()) { |
| 478 | // A flat cons can only be created by String::SlowTryFlatten. |
| 479 | // Afterwards, the first part may be externalized. |
| 480 | CHECK(this->first()->IsSeqString() || this->first()->IsExternalString()); |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | |
| 485 | void SlicedString::SlicedStringVerify() { |
| 486 | CHECK(!this->parent()->IsConsString()); |
| 487 | CHECK(!this->parent()->IsSlicedString()); |
| 488 | CHECK(this->length() >= SlicedString::kMinLength); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 492 | void JSFunction::JSFunctionVerify() { |
| 493 | CHECK(IsJSFunction()); |
| 494 | VerifyObjectField(kPrototypeOrInitialMapOffset); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 495 | VerifyObjectField(kNextFunctionLinkOffset); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 496 | CHECK(code()->IsCode()); |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 497 | CHECK(next_function_link()->IsUndefined() || |
| 498 | next_function_link()->IsJSFunction()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 499 | } |
| 500 | |
| 501 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 502 | void SharedFunctionInfo::SharedFunctionInfoVerify() { |
| 503 | CHECK(IsSharedFunctionInfo()); |
| 504 | VerifyObjectField(kNameOffset); |
| 505 | VerifyObjectField(kCodeOffset); |
yangguo@chromium.org | 5a11aaf | 2012-06-20 11:29:00 +0000 | [diff] [blame] | 506 | VerifyObjectField(kOptimizedCodeMapOffset); |
ager@chromium.org | 6a2b0aa | 2010-07-13 20:58:03 +0000 | [diff] [blame] | 507 | VerifyObjectField(kScopeInfoOffset); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 508 | VerifyObjectField(kInstanceClassNameOffset); |
vegorov@chromium.org | f837290 | 2010-03-15 10:26:20 +0000 | [diff] [blame] | 509 | VerifyObjectField(kFunctionDataOffset); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 510 | VerifyObjectField(kScriptOffset); |
| 511 | VerifyObjectField(kDebugInfoOffset); |
| 512 | } |
| 513 | |
| 514 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 515 | void JSGlobalProxy::JSGlobalProxyVerify() { |
| 516 | CHECK(IsJSGlobalProxy()); |
| 517 | JSObjectVerify(); |
| 518 | VerifyObjectField(JSGlobalProxy::kContextOffset); |
| 519 | // Make sure that this object has no properties, elements. |
| 520 | CHECK_EQ(0, properties()->length()); |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 521 | CHECK(HasFastObjectElements()); |
ricow@chromium.org | 30ce411 | 2010-05-31 10:38:25 +0000 | [diff] [blame] | 522 | CHECK_EQ(0, FixedArray::cast(elements())->length()); |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 526 | void JSGlobalObject::JSGlobalObjectVerify() { |
| 527 | CHECK(IsJSGlobalObject()); |
| 528 | JSObjectVerify(); |
| 529 | for (int i = GlobalObject::kBuiltinsOffset; |
| 530 | i < JSGlobalObject::kSize; |
| 531 | i += kPointerSize) { |
| 532 | VerifyObjectField(i); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 537 | void JSBuiltinsObject::JSBuiltinsObjectVerify() { |
| 538 | CHECK(IsJSBuiltinsObject()); |
| 539 | JSObjectVerify(); |
| 540 | for (int i = GlobalObject::kBuiltinsOffset; |
| 541 | i < JSBuiltinsObject::kSize; |
| 542 | i += kPointerSize) { |
| 543 | VerifyObjectField(i); |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | |
| 548 | void Oddball::OddballVerify() { |
| 549 | CHECK(IsOddball()); |
| 550 | VerifyHeapPointer(to_string()); |
| 551 | Object* number = to_number(); |
| 552 | if (number->IsHeapObject()) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 553 | ASSERT(number == HEAP->nan_value()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 554 | } else { |
| 555 | ASSERT(number->IsSmi()); |
| 556 | int value = Smi::cast(number)->value(); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 557 | // Hidden oddballs have negative smis. |
rossberg@chromium.org | 2c067b1 | 2012-03-19 11:01:52 +0000 | [diff] [blame] | 558 | const int kLeastHiddenOddballNumber = -4; |
| 559 | ASSERT(value <= 1); |
kmillikin@chromium.org | d2c22f0 | 2011-01-10 08:15:37 +0000 | [diff] [blame] | 560 | ASSERT(value >= kLeastHiddenOddballNumber); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 561 | } |
| 562 | } |
| 563 | |
| 564 | |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 565 | void JSGlobalPropertyCell::JSGlobalPropertyCellVerify() { |
| 566 | CHECK(IsJSGlobalPropertyCell()); |
| 567 | VerifyObjectField(kValueOffset); |
| 568 | } |
| 569 | |
| 570 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 571 | void Code::CodeVerify() { |
kasperl@chromium.org | 061ef74 | 2009-02-27 12:16:20 +0000 | [diff] [blame] | 572 | CHECK(IsAligned(reinterpret_cast<intptr_t>(instruction_start()), |
whesse@chromium.org | 4a1fe7d | 2010-09-27 12:32:04 +0000 | [diff] [blame] | 573 | kCodeAlignment)); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 574 | relocation_info()->Verify(); |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 575 | Address last_gc_pc = NULL; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 576 | for (RelocIterator it(this); !it.done(); it.next()) { |
| 577 | it.rinfo()->Verify(); |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 578 | // Ensure that GC will not iterate twice over the same pointer. |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 579 | if (RelocInfo::IsGCRelocMode(it.rinfo()->rmode())) { |
kasper.lund | 7276f14 | 2008-07-30 08:49:36 +0000 | [diff] [blame] | 580 | CHECK(it.rinfo()->pc() != last_gc_pc); |
| 581 | last_gc_pc = it.rinfo()->pc(); |
| 582 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 583 | } |
| 584 | } |
| 585 | |
| 586 | |
| 587 | void JSArray::JSArrayVerify() { |
| 588 | JSObjectVerify(); |
| 589 | ASSERT(length()->IsNumber() || length()->IsUndefined()); |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 590 | ASSERT(elements()->IsUndefined() || |
| 591 | elements()->IsFixedArray() || |
| 592 | elements()->IsFixedDoubleArray()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 596 | void JSSet::JSSetVerify() { |
| 597 | CHECK(IsJSSet()); |
| 598 | JSObjectVerify(); |
| 599 | VerifyHeapPointer(table()); |
| 600 | ASSERT(table()->IsHashTable() || table()->IsUndefined()); |
| 601 | } |
| 602 | |
| 603 | |
| 604 | void JSMap::JSMapVerify() { |
| 605 | CHECK(IsJSMap()); |
| 606 | JSObjectVerify(); |
| 607 | VerifyHeapPointer(table()); |
| 608 | ASSERT(table()->IsHashTable() || table()->IsUndefined()); |
| 609 | } |
| 610 | |
| 611 | |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 612 | void JSWeakMap::JSWeakMapVerify() { |
| 613 | CHECK(IsJSWeakMap()); |
| 614 | JSObjectVerify(); |
| 615 | VerifyHeapPointer(table()); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 616 | ASSERT(table()->IsHashTable() || table()->IsUndefined()); |
kmillikin@chromium.org | 7c2628c | 2011-08-10 11:27:35 +0000 | [diff] [blame] | 617 | } |
| 618 | |
| 619 | |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 620 | void JSRegExp::JSRegExpVerify() { |
| 621 | JSObjectVerify(); |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 622 | ASSERT(data()->IsUndefined() || data()->IsFixedArray()); |
| 623 | switch (TypeTag()) { |
| 624 | case JSRegExp::ATOM: { |
| 625 | FixedArray* arr = FixedArray::cast(data()); |
| 626 | ASSERT(arr->get(JSRegExp::kAtomPatternIndex)->IsString()); |
| 627 | break; |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 628 | } |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 629 | case JSRegExp::IRREGEXP: { |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 630 | bool is_native = RegExpImpl::UsesNativeRegExp(); |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 631 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 632 | FixedArray* arr = FixedArray::cast(data()); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 633 | Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 634 | // Smi : Not compiled yet (-1) or code prepared for flushing. |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 635 | // JSObject: Compilation error. |
| 636 | // Code/ByteArray: Compiled code. |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 637 | ASSERT(ascii_data->IsSmi() || |
| 638 | (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 639 | Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); |
jkummerow@chromium.org | ddda9e8 | 2011-07-06 11:27:02 +0000 | [diff] [blame] | 640 | ASSERT(uc16_data->IsSmi() || |
| 641 | (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); |
| 642 | |
| 643 | Object* ascii_saved = arr->get(JSRegExp::kIrregexpASCIICodeSavedIndex); |
| 644 | ASSERT(ascii_saved->IsSmi() || ascii_saved->IsString() || |
| 645 | ascii_saved->IsCode()); |
| 646 | Object* uc16_saved = arr->get(JSRegExp::kIrregexpUC16CodeSavedIndex); |
| 647 | ASSERT(uc16_saved->IsSmi() || uc16_saved->IsString() || |
| 648 | uc16_saved->IsCode()); |
| 649 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 650 | ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); |
| 651 | ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 652 | break; |
| 653 | } |
| 654 | default: |
| 655 | ASSERT_EQ(JSRegExp::NOT_COMPILED, TypeTag()); |
| 656 | ASSERT(data()->IsUndefined()); |
| 657 | break; |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 658 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 662 | void JSProxy::JSProxyVerify() { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 663 | CHECK(IsJSProxy()); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 664 | VerifyPointer(handler()); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 665 | ASSERT(hash()->IsSmi() || hash()->IsUndefined()); |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 666 | } |
| 667 | |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 668 | |
| 669 | void JSFunctionProxy::JSFunctionProxyVerify() { |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 670 | CHECK(IsJSFunctionProxy()); |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 671 | JSProxyVerify(); |
| 672 | VerifyPointer(call_trap()); |
| 673 | VerifyPointer(construct_trap()); |
| 674 | } |
| 675 | |
| 676 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 677 | void Foreign::ForeignVerify() { |
| 678 | ASSERT(IsForeign()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 679 | } |
| 680 | |
| 681 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 682 | void AccessorInfo::AccessorInfoVerify() { |
| 683 | CHECK(IsAccessorInfo()); |
| 684 | VerifyPointer(getter()); |
| 685 | VerifyPointer(setter()); |
| 686 | VerifyPointer(name()); |
| 687 | VerifyPointer(data()); |
| 688 | VerifyPointer(flag()); |
mmassi@chromium.org | 7028c05 | 2012-06-13 11:51:58 +0000 | [diff] [blame] | 689 | VerifyPointer(expected_receiver_type()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 690 | } |
| 691 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 692 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 693 | void AccessorPair::AccessorPairVerify() { |
| 694 | CHECK(IsAccessorPair()); |
| 695 | VerifyPointer(getter()); |
| 696 | VerifyPointer(setter()); |
| 697 | } |
| 698 | |
| 699 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 700 | void AccessCheckInfo::AccessCheckInfoVerify() { |
| 701 | CHECK(IsAccessCheckInfo()); |
| 702 | VerifyPointer(named_callback()); |
| 703 | VerifyPointer(indexed_callback()); |
| 704 | VerifyPointer(data()); |
| 705 | } |
| 706 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 707 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 708 | void InterceptorInfo::InterceptorInfoVerify() { |
| 709 | CHECK(IsInterceptorInfo()); |
| 710 | VerifyPointer(getter()); |
| 711 | VerifyPointer(setter()); |
| 712 | VerifyPointer(query()); |
| 713 | VerifyPointer(deleter()); |
| 714 | VerifyPointer(enumerator()); |
| 715 | VerifyPointer(data()); |
| 716 | } |
| 717 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 718 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 719 | void CallHandlerInfo::CallHandlerInfoVerify() { |
| 720 | CHECK(IsCallHandlerInfo()); |
| 721 | VerifyPointer(callback()); |
| 722 | VerifyPointer(data()); |
| 723 | } |
| 724 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 725 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 726 | void TemplateInfo::TemplateInfoVerify() { |
| 727 | VerifyPointer(tag()); |
| 728 | VerifyPointer(property_list()); |
| 729 | } |
| 730 | |
| 731 | void FunctionTemplateInfo::FunctionTemplateInfoVerify() { |
| 732 | CHECK(IsFunctionTemplateInfo()); |
| 733 | TemplateInfoVerify(); |
| 734 | VerifyPointer(serial_number()); |
| 735 | VerifyPointer(call_code()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 736 | VerifyPointer(property_accessors()); |
| 737 | VerifyPointer(prototype_template()); |
| 738 | VerifyPointer(parent_template()); |
| 739 | VerifyPointer(named_property_handler()); |
| 740 | VerifyPointer(indexed_property_handler()); |
| 741 | VerifyPointer(instance_template()); |
| 742 | VerifyPointer(signature()); |
| 743 | VerifyPointer(access_check_info()); |
| 744 | } |
| 745 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 746 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 747 | void ObjectTemplateInfo::ObjectTemplateInfoVerify() { |
| 748 | CHECK(IsObjectTemplateInfo()); |
| 749 | TemplateInfoVerify(); |
| 750 | VerifyPointer(constructor()); |
kasper.lund | 212ac23 | 2008-07-16 07:07:30 +0000 | [diff] [blame] | 751 | VerifyPointer(internal_field_count()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 752 | } |
| 753 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 754 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 755 | void SignatureInfo::SignatureInfoVerify() { |
| 756 | CHECK(IsSignatureInfo()); |
| 757 | VerifyPointer(receiver()); |
| 758 | VerifyPointer(args()); |
| 759 | } |
| 760 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 761 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 762 | void TypeSwitchInfo::TypeSwitchInfoVerify() { |
| 763 | CHECK(IsTypeSwitchInfo()); |
| 764 | VerifyPointer(types()); |
| 765 | } |
| 766 | |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 767 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 768 | void Script::ScriptVerify() { |
| 769 | CHECK(IsScript()); |
| 770 | VerifyPointer(source()); |
| 771 | VerifyPointer(name()); |
| 772 | line_offset()->SmiVerify(); |
| 773 | column_offset()->SmiVerify(); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 774 | VerifyPointer(data()); |
| 775 | VerifyPointer(wrapper()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 776 | type()->SmiVerify(); |
sgjesse@chromium.org | 499aaa5 | 2009-11-30 08:07:20 +0000 | [diff] [blame] | 777 | VerifyPointer(line_ends()); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 778 | VerifyPointer(id()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 779 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 780 | |
| 781 | |
kasperl@chromium.org | e959c18 | 2009-07-27 08:59:04 +0000 | [diff] [blame] | 782 | #ifdef ENABLE_DEBUGGER_SUPPORT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 783 | void DebugInfo::DebugInfoVerify() { |
| 784 | CHECK(IsDebugInfo()); |
| 785 | VerifyPointer(shared()); |
| 786 | VerifyPointer(original_code()); |
| 787 | VerifyPointer(code()); |
| 788 | VerifyPointer(break_points()); |
| 789 | } |
| 790 | |
| 791 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 792 | void BreakPointInfo::BreakPointInfoVerify() { |
| 793 | CHECK(IsBreakPointInfo()); |
| 794 | code_position()->SmiVerify(); |
| 795 | source_position()->SmiVerify(); |
| 796 | statement_position()->SmiVerify(); |
| 797 | VerifyPointer(break_point_objects()); |
| 798 | } |
whesse@chromium.org | 023421e | 2010-12-21 12:19:12 +0000 | [diff] [blame] | 799 | #endif // ENABLE_DEBUGGER_SUPPORT |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 800 | |
| 801 | |
| 802 | void JSObject::IncrementSpillStatistics(SpillInformation* info) { |
| 803 | info->number_of_objects_++; |
| 804 | // Named properties |
| 805 | if (HasFastProperties()) { |
| 806 | info->number_of_objects_with_fast_properties_++; |
| 807 | info->number_of_fast_used_fields_ += map()->NextFreePropertyIndex(); |
| 808 | info->number_of_fast_unused_fields_ += map()->unused_property_fields(); |
| 809 | } else { |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 810 | StringDictionary* dict = property_dictionary(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 811 | info->number_of_slow_used_properties_ += dict->NumberOfElements(); |
| 812 | info->number_of_slow_unused_properties_ += |
| 813 | dict->Capacity() - dict->NumberOfElements(); |
| 814 | } |
| 815 | // Indexed properties |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 816 | switch (GetElementsKind()) { |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 817 | case FAST_HOLEY_SMI_ELEMENTS: |
| 818 | case FAST_SMI_ELEMENTS: |
| 819 | case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 820 | case FAST_DOUBLE_ELEMENTS: |
| 821 | case FAST_HOLEY_ELEMENTS: |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 822 | case FAST_ELEMENTS: { |
| 823 | info->number_of_objects_with_fast_elements_++; |
| 824 | int holes = 0; |
| 825 | FixedArray* e = FixedArray::cast(elements()); |
| 826 | int len = e->length(); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 827 | Heap* heap = HEAP; |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 828 | for (int i = 0; i < len; i++) { |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 829 | if (e->get(i) == heap->the_hole_value()) holes++; |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 830 | } |
| 831 | info->number_of_fast_used_elements_ += len - holes; |
| 832 | info->number_of_fast_unused_elements_ += holes; |
| 833 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 834 | } |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 835 | case EXTERNAL_BYTE_ELEMENTS: |
| 836 | case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 837 | case EXTERNAL_SHORT_ELEMENTS: |
| 838 | case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 839 | case EXTERNAL_INT_ELEMENTS: |
| 840 | case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 841 | case EXTERNAL_FLOAT_ELEMENTS: |
| 842 | case EXTERNAL_DOUBLE_ELEMENTS: |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 843 | case EXTERNAL_PIXEL_ELEMENTS: { |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 844 | info->number_of_objects_with_fast_elements_++; |
danno@chromium.org | 4d3fe4e | 2011-03-10 10:14:28 +0000 | [diff] [blame] | 845 | ExternalPixelArray* e = ExternalPixelArray::cast(elements()); |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 846 | info->number_of_fast_used_elements_ += e->length(); |
| 847 | break; |
| 848 | } |
| 849 | case DICTIONARY_ELEMENTS: { |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 850 | SeededNumberDictionary* dict = element_dictionary(); |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 851 | info->number_of_slow_used_elements_ += dict->NumberOfElements(); |
| 852 | info->number_of_slow_unused_elements_ += |
| 853 | dict->Capacity() - dict->NumberOfElements(); |
| 854 | break; |
| 855 | } |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 856 | case NON_STRICT_ARGUMENTS_ELEMENTS: |
sgjesse@chromium.org | 0b6db59 | 2009-07-30 14:48:31 +0000 | [diff] [blame] | 857 | break; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 858 | } |
| 859 | } |
| 860 | |
| 861 | |
| 862 | void JSObject::SpillInformation::Clear() { |
| 863 | number_of_objects_ = 0; |
| 864 | number_of_objects_with_fast_properties_ = 0; |
| 865 | number_of_objects_with_fast_elements_ = 0; |
| 866 | number_of_fast_used_fields_ = 0; |
| 867 | number_of_fast_unused_fields_ = 0; |
| 868 | number_of_slow_used_properties_ = 0; |
| 869 | number_of_slow_unused_properties_ = 0; |
| 870 | number_of_fast_used_elements_ = 0; |
| 871 | number_of_fast_unused_elements_ = 0; |
| 872 | number_of_slow_used_elements_ = 0; |
| 873 | number_of_slow_unused_elements_ = 0; |
| 874 | } |
| 875 | |
| 876 | void JSObject::SpillInformation::Print() { |
| 877 | PrintF("\n JSObject Spill Statistics (#%d):\n", number_of_objects_); |
| 878 | |
| 879 | PrintF(" - fast properties (#%d): %d (used) %d (unused)\n", |
| 880 | number_of_objects_with_fast_properties_, |
| 881 | number_of_fast_used_fields_, number_of_fast_unused_fields_); |
| 882 | |
| 883 | PrintF(" - slow properties (#%d): %d (used) %d (unused)\n", |
| 884 | number_of_objects_ - number_of_objects_with_fast_properties_, |
| 885 | number_of_slow_used_properties_, number_of_slow_unused_properties_); |
| 886 | |
| 887 | PrintF(" - fast elements (#%d): %d (used) %d (unused)\n", |
| 888 | number_of_objects_with_fast_elements_, |
| 889 | number_of_fast_used_elements_, number_of_fast_unused_elements_); |
| 890 | |
| 891 | PrintF(" - slow elements (#%d): %d (used) %d (unused)\n", |
| 892 | number_of_objects_ - number_of_objects_with_fast_elements_, |
| 893 | number_of_slow_used_elements_, number_of_slow_unused_elements_); |
| 894 | |
| 895 | PrintF("\n"); |
| 896 | } |
| 897 | |
| 898 | |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 899 | bool DescriptorArray::IsSortedNoDuplicates() { |
| 900 | String* current_key = NULL; |
| 901 | uint32_t current = 0; |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 902 | for (int i = 0; i < number_of_descriptors(); i++) { |
| 903 | String* key = GetKey(i); |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 904 | if (key == current_key) { |
| 905 | PrintDescriptors(); |
| 906 | return false; |
| 907 | } |
| 908 | current_key = key; |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 909 | uint32_t hash = GetKey(i)->Hash(); |
mads.s.ager@gmail.com | 769cc96 | 2008-08-06 10:02:49 +0000 | [diff] [blame] | 910 | if (hash < current) { |
| 911 | PrintDescriptors(); |
| 912 | return false; |
| 913 | } |
| 914 | current = hash; |
| 915 | } |
| 916 | return true; |
| 917 | } |
| 918 | |
| 919 | |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 920 | bool TransitionArray::IsSortedNoDuplicates() { |
| 921 | String* current_key = NULL; |
| 922 | uint32_t current = 0; |
| 923 | for (int i = 0; i < number_of_transitions(); i++) { |
| 924 | String* key = GetKey(i); |
| 925 | if (key == current_key) { |
| 926 | PrintTransitions(); |
| 927 | return false; |
| 928 | } |
| 929 | current_key = key; |
| 930 | uint32_t hash = GetKey(i)->Hash(); |
| 931 | if (hash < current) { |
| 932 | PrintTransitions(); |
| 933 | return false; |
| 934 | } |
| 935 | current = hash; |
| 936 | } |
| 937 | return true; |
| 938 | } |
| 939 | |
| 940 | |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 941 | static bool CheckOneBackPointer(Map* current_map, Object* target) { |
| 942 | return !target->IsMap() || Map::cast(target)->GetBackPointer() == current_map; |
| 943 | } |
| 944 | |
| 945 | |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 946 | bool TransitionArray::IsConsistentWithBackPointers(Map* current_map) { |
| 947 | if (HasElementsTransition() && |
| 948 | !CheckOneBackPointer(current_map, elements_transition())) { |
yangguo@chromium.org | 5a11aaf | 2012-06-20 11:29:00 +0000 | [diff] [blame] | 949 | return false; |
| 950 | } |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 951 | for (int i = 0; i < number_of_transitions(); ++i) { |
verwaest@chromium.org | 753aee4 | 2012-07-17 16:15:42 +0000 | [diff] [blame^] | 952 | if (!CheckOneBackPointer(current_map, GetTarget(i))) return false; |
jkummerow@chromium.org | 212d964 | 2012-05-11 15:02:09 +0000 | [diff] [blame] | 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 | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 999 | void Map::ZapTransitions() { |
| 1000 | TransitionArray* transition_array = transitions(); |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 1001 | MemsetPointer(transition_array->data_start(), |
yangguo@chromium.org | 5f0b8ea | 2012-05-16 12:37:04 +0000 | [diff] [blame] | 1002 | GetHeap()->the_hole_value(), |
yangguo@chromium.org | 99aa490 | 2012-07-06 16:21:55 +0000 | [diff] [blame] | 1003 | transition_array->length()); |
yangguo@chromium.org | 5f0b8ea | 2012-05-16 12:37:04 +0000 | [diff] [blame] | 1004 | } |
| 1005 | |
| 1006 | |
| 1007 | void Map::ZapPrototypeTransitions() { |
danno@chromium.org | 81cac2b | 2012-07-10 11:28:27 +0000 | [diff] [blame] | 1008 | FixedArray* proto_transitions = GetPrototypeTransitions(); |
yangguo@chromium.org | 5f0b8ea | 2012-05-16 12:37:04 +0000 | [diff] [blame] | 1009 | MemsetPointer(proto_transitions->data_start(), |
| 1010 | GetHeap()->the_hole_value(), |
| 1011 | proto_transitions->length()); |
| 1012 | } |
| 1013 | |
| 1014 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 1015 | #endif // DEBUG |
| 1016 | |
| 1017 | } } // namespace v8::internal |