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-inl.h" | 17 #include "src/contexts-inl.h" |
18 #include "src/conversions-inl.h" | 18 #include "src/conversions-inl.h" |
19 #include "src/factory.h" | 19 #include "src/factory.h" |
20 #include "src/field-index-inl.h" | 20 #include "src/field-index-inl.h" |
21 #include "src/handles-inl.h" | 21 #include "src/handles-inl.h" |
22 #include "src/heap/heap-inl.h" | 22 #include "src/heap/heap-inl.h" |
23 #include "src/heap/heap.h" | 23 #include "src/heap/heap.h" |
24 #include "src/isolate.h" | 24 #include "src/isolate.h" |
| 25 #include "src/isolate-inl.h" |
25 #include "src/layout-descriptor-inl.h" | 26 #include "src/layout-descriptor-inl.h" |
26 #include "src/lookup.h" | 27 #include "src/lookup.h" |
27 #include "src/objects.h" | 28 #include "src/objects.h" |
28 #include "src/property.h" | 29 #include "src/property.h" |
29 #include "src/prototype.h" | 30 #include "src/prototype.h" |
30 #include "src/transitions-inl.h" | 31 #include "src/transitions-inl.h" |
31 #include "src/type-feedback-vector-inl.h" | 32 #include "src/type-feedback-vector-inl.h" |
32 #include "src/v8memory.h" | 33 #include "src/v8memory.h" |
33 | 34 |
34 namespace v8 { | 35 namespace v8 { |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 } | 2255 } |
2255 | 2256 |
2256 | 2257 |
2257 void Struct::InitializeBody(int object_size) { | 2258 void Struct::InitializeBody(int object_size) { |
2258 Object* value = GetHeap()->undefined_value(); | 2259 Object* value = GetHeap()->undefined_value(); |
2259 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 2260 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
2260 WRITE_FIELD(this, offset, value); | 2261 WRITE_FIELD(this, offset, value); |
2261 } | 2262 } |
2262 } | 2263 } |
2263 | 2264 |
2264 | |
2265 bool Object::ToArrayLength(uint32_t* index) { return Object::ToUint32(index); } | 2265 bool Object::ToArrayLength(uint32_t* index) { return Object::ToUint32(index); } |
2266 | 2266 |
2267 | 2267 |
2268 bool Object::ToArrayIndex(uint32_t* index) { | 2268 bool Object::ToArrayIndex(uint32_t* index) { |
2269 return Object::ToUint32(index) && *index != kMaxUInt32; | 2269 return Object::ToUint32(index) && *index != kMaxUInt32; |
2270 } | 2270 } |
2271 | 2271 |
2272 | 2272 |
2273 void Object::VerifyApiCallResultType() { | 2273 void Object::VerifyApiCallResultType() { |
2274 #if DEBUG | 2274 #if DEBUG |
(...skipping 5304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7579 IsFastDoubleElementsKind(array->GetElementsKind())) || | 7579 IsFastDoubleElementsKind(array->GetElementsKind())) || |
7580 ((storage->map() != array->GetHeap()->fixed_double_array_map()) && | 7580 ((storage->map() != array->GetHeap()->fixed_double_array_map()) && |
7581 (IsFastObjectElementsKind(array->GetElementsKind()) || | 7581 (IsFastObjectElementsKind(array->GetElementsKind()) || |
7582 (IsFastSmiElementsKind(array->GetElementsKind()) && | 7582 (IsFastSmiElementsKind(array->GetElementsKind()) && |
7583 Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles())))); | 7583 Handle<FixedArray>::cast(storage)->ContainsOnlySmisOrHoles())))); |
7584 array->set_elements(*storage); | 7584 array->set_elements(*storage); |
7585 array->set_length(Smi::FromInt(storage->length())); | 7585 array->set_length(Smi::FromInt(storage->length())); |
7586 } | 7586 } |
7587 | 7587 |
7588 | 7588 |
| 7589 bool JSArray::HasArrayPrototype(Isolate* isolate) { |
| 7590 return map()->prototype() == *isolate->initial_array_prototype(); |
| 7591 } |
| 7592 |
| 7593 |
7589 int TypeFeedbackInfo::ic_total_count() { | 7594 int TypeFeedbackInfo::ic_total_count() { |
7590 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 7595 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
7591 return ICTotalCountField::decode(current); | 7596 return ICTotalCountField::decode(current); |
7592 } | 7597 } |
7593 | 7598 |
7594 | 7599 |
7595 void TypeFeedbackInfo::set_ic_total_count(int count) { | 7600 void TypeFeedbackInfo::set_ic_total_count(int count) { |
7596 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 7601 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
7597 value = ICTotalCountField::update(value, | 7602 value = ICTotalCountField::update(value, |
7598 ICTotalCountField::decode(count)); | 7603 ICTotalCountField::decode(count)); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7851 #undef WRITE_INT64_FIELD | 7856 #undef WRITE_INT64_FIELD |
7852 #undef READ_BYTE_FIELD | 7857 #undef READ_BYTE_FIELD |
7853 #undef WRITE_BYTE_FIELD | 7858 #undef WRITE_BYTE_FIELD |
7854 #undef NOBARRIER_READ_BYTE_FIELD | 7859 #undef NOBARRIER_READ_BYTE_FIELD |
7855 #undef NOBARRIER_WRITE_BYTE_FIELD | 7860 #undef NOBARRIER_WRITE_BYTE_FIELD |
7856 | 7861 |
7857 } // namespace internal | 7862 } // namespace internal |
7858 } // namespace v8 | 7863 } // namespace v8 |
7859 | 7864 |
7860 #endif // V8_OBJECTS_INL_H_ | 7865 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |