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/elements.h" | 15 #include "src/elements.h" |
16 #include "src/objects.h" | 16 #include "src/objects.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/field-index-inl.h" | |
19 #include "src/heap.h" | 20 #include "src/heap.h" |
20 #include "src/isolate.h" | 21 #include "src/isolate.h" |
21 #include "src/heap-inl.h" | 22 #include "src/heap-inl.h" |
22 #include "src/property.h" | 23 #include "src/property.h" |
23 #include "src/spaces.h" | 24 #include "src/spaces.h" |
24 #include "src/store-buffer.h" | 25 #include "src/store-buffer.h" |
25 #include "src/v8memory.h" | 26 #include "src/v8memory.h" |
26 #include "src/factory.h" | 27 #include "src/factory.h" |
27 #include "src/incremental-marking.h" | 28 #include "src/incremental-marking.h" |
28 #include "src/transitions-inl.h" | 29 #include "src/transitions-inl.h" |
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1934 // properties are at the end of the object. Therefore there is no need | 1935 // properties are at the end of the object. Therefore there is no need |
1935 // to adjust the index here. | 1936 // to adjust the index here. |
1936 int offset = GetHeaderSize() + (kPointerSize * index); | 1937 int offset = GetHeaderSize() + (kPointerSize * index); |
1937 WRITE_FIELD(this, offset, value); | 1938 WRITE_FIELD(this, offset, value); |
1938 } | 1939 } |
1939 | 1940 |
1940 | 1941 |
1941 // Access fast-case object properties at index. The use of these routines | 1942 // Access fast-case object properties at index. The use of these routines |
1942 // is needed to correctly distinguish between properties stored in-object and | 1943 // is needed to correctly distinguish between properties stored in-object and |
1943 // properties stored in the properties array. | 1944 // properties stored in the properties array. |
1944 Object* JSObject::RawFastPropertyAt(int index) { | 1945 Object* JSObject::RawFastPropertyAt(FieldIndex index) { |
1945 // Adjust for the number of properties stored in the object. | 1946 // Adjust for the number of properties stored in the object. |
Toon Verwaest
2014/06/06 12:00:33
Remove leftover comment
danno
2014/06/06 14:09:57
Done.
| |
1946 index -= map()->inobject_properties(); | 1947 if (index.is_inobject()) { |
1947 if (index < 0) { | 1948 return READ_FIELD(this, index.offset()); |
1948 int offset = map()->instance_size() + (index * kPointerSize); | |
1949 return READ_FIELD(this, offset); | |
1950 } else { | 1949 } else { |
1951 ASSERT(index < properties()->length()); | 1950 return properties()->get(index.property_index()); |
1952 return properties()->get(index); | |
1953 } | 1951 } |
1954 } | 1952 } |
1955 | 1953 |
1956 | 1954 |
1957 void JSObject::FastPropertyAtPut(int index, Object* value) { | 1955 void JSObject::FastPropertyAtPut(FieldIndex index, Object* value) { |
1958 // Adjust for the number of properties stored in the object. | 1956 // Adjust for the number of properties stored in the object. |
Toon Verwaest
2014/06/06 12:00:33
Same as above
danno
2014/06/06 14:09:57
Done.
| |
1959 index -= map()->inobject_properties(); | 1957 if (index.is_inobject()) { |
1960 if (index < 0) { | 1958 int offset = index.offset(); |
1961 int offset = map()->instance_size() + (index * kPointerSize); | |
1962 WRITE_FIELD(this, offset, value); | 1959 WRITE_FIELD(this, offset, value); |
1963 WRITE_BARRIER(GetHeap(), this, offset, value); | 1960 WRITE_BARRIER(GetHeap(), this, offset, value); |
1964 } else { | 1961 } else { |
1965 ASSERT(index < properties()->length()); | 1962 properties()->set(index.property_index(), value); |
1966 properties()->set(index, value); | |
1967 } | 1963 } |
1968 } | 1964 } |
1969 | 1965 |
1970 | 1966 |
1971 int JSObject::GetInObjectPropertyOffset(int index) { | 1967 int JSObject::GetInObjectPropertyOffset(int index) { |
1972 return map()->GetInObjectPropertyOffset(index); | 1968 return map()->GetInObjectPropertyOffset(index); |
1973 } | 1969 } |
1974 | 1970 |
1975 | 1971 |
1976 Object* JSObject::InObjectPropertyAt(int index) { | 1972 Object* JSObject::InObjectPropertyAt(int index) { |
(...skipping 5010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6987 #undef READ_SHORT_FIELD | 6983 #undef READ_SHORT_FIELD |
6988 #undef WRITE_SHORT_FIELD | 6984 #undef WRITE_SHORT_FIELD |
6989 #undef READ_BYTE_FIELD | 6985 #undef READ_BYTE_FIELD |
6990 #undef WRITE_BYTE_FIELD | 6986 #undef WRITE_BYTE_FIELD |
6991 #undef NOBARRIER_READ_BYTE_FIELD | 6987 #undef NOBARRIER_READ_BYTE_FIELD |
6992 #undef NOBARRIER_WRITE_BYTE_FIELD | 6988 #undef NOBARRIER_WRITE_BYTE_FIELD |
6993 | 6989 |
6994 } } // namespace v8::internal | 6990 } } // namespace v8::internal |
6995 | 6991 |
6996 #endif // V8_OBJECTS_INL_H_ | 6992 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |