OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Review notes: | 5 // Review notes: |
6 // | 6 // |
7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous |
8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal |
9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. |
10 // | 10 // |
11 | 11 |
12 #ifndef V8_OBJECTS_INL_H_ | 12 #ifndef V8_OBJECTS_INL_H_ |
13 #define V8_OBJECTS_INL_H_ | 13 #define V8_OBJECTS_INL_H_ |
14 | 14 |
15 #include "src/base/atomicops.h" | 15 #include "src/base/atomicops.h" |
16 #include "src/base/bits.h" | 16 #include "src/base/bits.h" |
17 #include "src/contexts.h" | 17 #include "src/contexts.h" |
18 #include "src/conversions-inl.h" | 18 #include "src/conversions-inl.h" |
19 #include "src/elements.h" | |
20 #include "src/factory.h" | 19 #include "src/factory.h" |
21 #include "src/field-index-inl.h" | 20 #include "src/field-index-inl.h" |
22 #include "src/heap/heap-inl.h" | 21 #include "src/heap/heap-inl.h" |
23 #include "src/heap/heap.h" | 22 #include "src/heap/heap.h" |
24 #include "src/heap/incremental-marking.h" | 23 #include "src/heap/incremental-marking.h" |
25 #include "src/heap/objects-visiting.h" | 24 #include "src/heap/objects-visiting.h" |
26 #include "src/heap/spaces.h" | 25 #include "src/heap/spaces.h" |
27 #include "src/heap/store-buffer.h" | 26 #include "src/heap/store-buffer.h" |
28 #include "src/isolate.h" | 27 #include "src/isolate.h" |
29 #include "src/layout-descriptor-inl.h" | 28 #include "src/layout-descriptor-inl.h" |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 return true; | 1597 return true; |
1599 } | 1598 } |
1600 | 1599 |
1601 | 1600 |
1602 FixedArrayBase* JSObject::elements() const { | 1601 FixedArrayBase* JSObject::elements() const { |
1603 Object* array = READ_FIELD(this, kElementsOffset); | 1602 Object* array = READ_FIELD(this, kElementsOffset); |
1604 return static_cast<FixedArrayBase*>(array); | 1603 return static_cast<FixedArrayBase*>(array); |
1605 } | 1604 } |
1606 | 1605 |
1607 | 1606 |
1608 void JSObject::ValidateElements(Handle<JSObject> object) { | |
1609 #ifdef ENABLE_SLOW_DCHECKS | |
1610 if (FLAG_enable_slow_asserts) { | |
1611 ElementsAccessor* accessor = object->GetElementsAccessor(); | |
1612 accessor->Validate(object); | |
1613 } | |
1614 #endif | |
1615 } | |
1616 | |
1617 | |
1618 void AllocationSite::Initialize() { | 1607 void AllocationSite::Initialize() { |
1619 set_transition_info(Smi::FromInt(0)); | 1608 set_transition_info(Smi::FromInt(0)); |
1620 SetElementsKind(GetInitialFastElementsKind()); | 1609 SetElementsKind(GetInitialFastElementsKind()); |
1621 set_nested_site(Smi::FromInt(0)); | 1610 set_nested_site(Smi::FromInt(0)); |
1622 set_pretenure_data(Smi::FromInt(0)); | 1611 set_pretenure_data(Smi::FromInt(0)); |
1623 set_pretenure_create_count(Smi::FromInt(0)); | 1612 set_pretenure_create_count(Smi::FromInt(0)); |
1624 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), | 1613 set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()), |
1625 SKIP_WRITE_BARRIER); | 1614 SKIP_WRITE_BARRIER); |
1626 } | 1615 } |
1627 | 1616 |
(...skipping 4592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6220 fixed_array->IsDictionary()) || | 6209 fixed_array->IsDictionary()) || |
6221 (kind > DICTIONARY_ELEMENTS)); | 6210 (kind > DICTIONARY_ELEMENTS)); |
6222 DCHECK((kind != SLOPPY_ARGUMENTS_ELEMENTS) || | 6211 DCHECK((kind != SLOPPY_ARGUMENTS_ELEMENTS) || |
6223 (elements()->IsFixedArray() && elements()->length() >= 2)); | 6212 (elements()->IsFixedArray() && elements()->length() >= 2)); |
6224 } | 6213 } |
6225 #endif | 6214 #endif |
6226 return kind; | 6215 return kind; |
6227 } | 6216 } |
6228 | 6217 |
6229 | 6218 |
6230 ElementsAccessor* JSObject::GetElementsAccessor() { | |
6231 return ElementsAccessor::ForKind(GetElementsKind()); | |
6232 } | |
6233 | |
6234 | |
6235 bool JSObject::HasFastObjectElements() { | 6219 bool JSObject::HasFastObjectElements() { |
6236 return IsFastObjectElementsKind(GetElementsKind()); | 6220 return IsFastObjectElementsKind(GetElementsKind()); |
6237 } | 6221 } |
6238 | 6222 |
6239 | 6223 |
6240 bool JSObject::HasFastSmiElements() { | 6224 bool JSObject::HasFastSmiElements() { |
6241 return IsFastSmiElementsKind(GetElementsKind()); | 6225 return IsFastSmiElementsKind(GetElementsKind()); |
6242 } | 6226 } |
6243 | 6227 |
6244 | 6228 |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7301 #undef READ_SHORT_FIELD | 7285 #undef READ_SHORT_FIELD |
7302 #undef WRITE_SHORT_FIELD | 7286 #undef WRITE_SHORT_FIELD |
7303 #undef READ_BYTE_FIELD | 7287 #undef READ_BYTE_FIELD |
7304 #undef WRITE_BYTE_FIELD | 7288 #undef WRITE_BYTE_FIELD |
7305 #undef NOBARRIER_READ_BYTE_FIELD | 7289 #undef NOBARRIER_READ_BYTE_FIELD |
7306 #undef NOBARRIER_WRITE_BYTE_FIELD | 7290 #undef NOBARRIER_WRITE_BYTE_FIELD |
7307 | 7291 |
7308 } } // namespace v8::internal | 7292 } } // namespace v8::internal |
7309 | 7293 |
7310 #endif // V8_OBJECTS_INL_H_ | 7294 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |