| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 return (type_ & kStringRepresentationMask) == kSeqStringTag; | 299 return (type_ & kStringRepresentationMask) == kSeqStringTag; |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| 303 StringRepresentationTag StringShape::representation_tag() { | 303 StringRepresentationTag StringShape::representation_tag() { |
| 304 uint32_t tag = (type_ & kStringRepresentationMask); | 304 uint32_t tag = (type_ & kStringRepresentationMask); |
| 305 return static_cast<StringRepresentationTag>(tag); | 305 return static_cast<StringRepresentationTag>(tag); |
| 306 } | 306 } |
| 307 | 307 |
| 308 | 308 |
| 309 uint32_t StringShape::encoding_tag() { |
| 310 return type_ & kStringEncodingMask; |
| 311 } |
| 312 |
| 313 |
| 309 uint32_t StringShape::full_representation_tag() { | 314 uint32_t StringShape::full_representation_tag() { |
| 310 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); | 315 return (type_ & (kStringRepresentationMask | kStringEncodingMask)); |
| 311 } | 316 } |
| 312 | 317 |
| 313 | 318 |
| 314 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) == | 319 STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) == |
| 315 Internals::kFullStringRepresentationMask); | 320 Internals::kFullStringRepresentationMask); |
| 316 | 321 |
| 317 | 322 |
| 318 bool StringShape::IsSequentialAscii() { | 323 bool StringShape::IsSequentialAscii() { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 } | 572 } |
| 568 | 573 |
| 569 | 574 |
| 570 bool Object::IsContext() { | 575 bool Object::IsContext() { |
| 571 if (Object::IsHeapObject()) { | 576 if (Object::IsHeapObject()) { |
| 572 Map* map = HeapObject::cast(this)->map(); | 577 Map* map = HeapObject::cast(this)->map(); |
| 573 Heap* heap = map->GetHeap(); | 578 Heap* heap = map->GetHeap(); |
| 574 return (map == heap->function_context_map() || | 579 return (map == heap->function_context_map() || |
| 575 map == heap->catch_context_map() || | 580 map == heap->catch_context_map() || |
| 576 map == heap->with_context_map() || | 581 map == heap->with_context_map() || |
| 577 map == heap->global_context_map()); | 582 map == heap->global_context_map() || |
| 583 map == heap->block_context_map()); |
| 578 } | 584 } |
| 579 return false; | 585 return false; |
| 580 } | 586 } |
| 581 | 587 |
| 582 | 588 |
| 583 bool Object::IsGlobalContext() { | 589 bool Object::IsGlobalContext() { |
| 584 return Object::IsHeapObject() && | 590 return Object::IsHeapObject() && |
| 585 HeapObject::cast(this)->map() == | 591 HeapObject::cast(this)->map() == |
| 586 HeapObject::cast(this)->GetHeap()->global_context_map(); | 592 HeapObject::cast(this)->GetHeap()->global_context_map(); |
| 587 } | 593 } |
| 588 | 594 |
| 589 | 595 |
| 596 bool Object::IsSerializedScopeInfo() { |
| 597 return Object::IsHeapObject() && |
| 598 HeapObject::cast(this)->map() == |
| 599 HeapObject::cast(this)->GetHeap()->serialized_scope_info_map(); |
| 600 } |
| 601 |
| 602 |
| 590 bool Object::IsJSFunction() { | 603 bool Object::IsJSFunction() { |
| 591 return Object::IsHeapObject() | 604 return Object::IsHeapObject() |
| 592 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; | 605 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; |
| 593 } | 606 } |
| 594 | 607 |
| 595 | 608 |
| 596 template <> inline bool Is<JSFunction>(Object* obj) { | 609 template <> inline bool Is<JSFunction>(Object* obj) { |
| 597 return obj->IsJSFunction(); | 610 return obj->IsJSFunction(); |
| 598 } | 611 } |
| 599 | 612 |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 | 1234 |
| 1222 | 1235 |
| 1223 int HeapNumber::get_sign() { | 1236 int HeapNumber::get_sign() { |
| 1224 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; | 1237 return READ_INT_FIELD(this, kExponentOffset) & kSignMask; |
| 1225 } | 1238 } |
| 1226 | 1239 |
| 1227 | 1240 |
| 1228 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) | 1241 ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset) |
| 1229 | 1242 |
| 1230 | 1243 |
| 1231 HeapObject* JSObject::elements() { | 1244 FixedArrayBase* JSObject::elements() { |
| 1232 Object* array = READ_FIELD(this, kElementsOffset); | 1245 Object* array = READ_FIELD(this, kElementsOffset); |
| 1233 ASSERT(array->HasValidElements()); | 1246 ASSERT(array->HasValidElements()); |
| 1234 return reinterpret_cast<HeapObject*>(array); | 1247 return static_cast<FixedArrayBase*>(array); |
| 1235 } | 1248 } |
| 1236 | 1249 |
| 1237 | 1250 |
| 1238 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { | 1251 void JSObject::set_elements(FixedArrayBase* value, WriteBarrierMode mode) { |
| 1239 ASSERT(map()->has_fast_elements() == | 1252 ASSERT(map()->has_fast_elements() == |
| 1240 (value->map() == GetHeap()->fixed_array_map() || | 1253 (value->map() == GetHeap()->fixed_array_map() || |
| 1241 value->map() == GetHeap()->fixed_cow_array_map())); | 1254 value->map() == GetHeap()->fixed_cow_array_map())); |
| 1242 ASSERT(map()->has_fast_double_elements() == | 1255 ASSERT(map()->has_fast_double_elements() == |
| 1243 value->IsFixedDoubleArray()); | 1256 value->IsFixedDoubleArray()); |
| 1244 ASSERT(value->HasValidElements()); | 1257 ASSERT(value->HasValidElements()); |
| 1245 WRITE_FIELD(this, kElementsOffset, value); | 1258 WRITE_FIELD(this, kElementsOffset, value); |
| 1246 WRITE_BARRIER(GetHeap(), this, kElementsOffset, value); | 1259 WRITE_BARRIER(GetHeap(), this, kElementsOffset, value); |
| 1247 } | 1260 } |
| 1248 | 1261 |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 | 2020 |
| 2008 | 2021 |
| 2009 template <typename Shape, typename Key> | 2022 template <typename Shape, typename Key> |
| 2010 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { | 2023 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { |
| 2011 ASSERT(obj->IsHashTable()); | 2024 ASSERT(obj->IsHashTable()); |
| 2012 return reinterpret_cast<HashTable*>(obj); | 2025 return reinterpret_cast<HashTable*>(obj); |
| 2013 } | 2026 } |
| 2014 | 2027 |
| 2015 | 2028 |
| 2016 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) | 2029 SMI_ACCESSORS(FixedArrayBase, length, kLengthOffset) |
| 2017 SMI_ACCESSORS(ByteArray, length, kLengthOffset) | |
| 2018 SMI_ACCESSORS(FreeSpace, size, kSizeOffset) | 2030 SMI_ACCESSORS(FreeSpace, size, kSizeOffset) |
| 2019 | 2031 |
| 2020 // TODO(1493): Investigate if it's possible to s/INT/SMI/ here (and | |
| 2021 // subsequently unify H{Fixed,External}ArrayLength). | |
| 2022 INT_ACCESSORS(ExternalArray, length, kLengthOffset) | |
| 2023 | |
| 2024 | |
| 2025 SMI_ACCESSORS(String, length, kLengthOffset) | 2032 SMI_ACCESSORS(String, length, kLengthOffset) |
| 2026 | 2033 |
| 2027 | 2034 |
| 2028 uint32_t String::hash_field() { | 2035 uint32_t String::hash_field() { |
| 2029 return READ_UINT32_FIELD(this, kHashFieldOffset); | 2036 return READ_UINT32_FIELD(this, kHashFieldOffset); |
| 2030 } | 2037 } |
| 2031 | 2038 |
| 2032 | 2039 |
| 2033 void String::set_hash_field(uint32_t value) { | 2040 void String::set_hash_field(uint32_t value) { |
| 2034 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); | 2041 WRITE_UINT32_FIELD(this, kHashFieldOffset, value); |
| (...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4474 #undef WRITE_INT_FIELD | 4481 #undef WRITE_INT_FIELD |
| 4475 #undef READ_SHORT_FIELD | 4482 #undef READ_SHORT_FIELD |
| 4476 #undef WRITE_SHORT_FIELD | 4483 #undef WRITE_SHORT_FIELD |
| 4477 #undef READ_BYTE_FIELD | 4484 #undef READ_BYTE_FIELD |
| 4478 #undef WRITE_BYTE_FIELD | 4485 #undef WRITE_BYTE_FIELD |
| 4479 | 4486 |
| 4480 | 4487 |
| 4481 } } // namespace v8::internal | 4488 } } // namespace v8::internal |
| 4482 | 4489 |
| 4483 #endif // V8_OBJECTS_INL_H_ | 4490 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |