OLD | NEW |
1 // Copyright 2014 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 // Redistribution and use in source and binary forms, with or without |
3 // found in the LICENSE file. | 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 // Review notes: |
| 29 // |
| 30 // - The use of macros in these inline functions may seem superfluous |
| 31 // but it is absolutely needed to make sure gcc generates optimal |
| 32 // code. gcc is not happy when attempting to inline too deep. |
| 33 // |
4 | 34 |
5 #ifndef V8_OBJECTS_INL_H_ | 35 #ifndef V8_OBJECTS_INL_H_ |
6 #define V8_OBJECTS_INL_H_ | 36 #define V8_OBJECTS_INL_H_ |
7 | 37 |
| 38 #include "elements.h" |
8 #include "objects.h" | 39 #include "objects.h" |
9 | |
10 #include "contexts.h" | 40 #include "contexts.h" |
11 #include "conversions-inl.h" | 41 #include "conversions-inl.h" |
12 #include "elements.h" | |
13 #include "factory.h" | |
14 #include "heap.h" | 42 #include "heap.h" |
| 43 #include "isolate.h" |
15 #include "heap-inl.h" | 44 #include "heap-inl.h" |
16 #include "incremental-marking.h" | |
17 #include "objects-visiting.h" | |
18 #include "property.h" | 45 #include "property.h" |
19 #include "spaces.h" | 46 #include "spaces.h" |
20 #include "store-buffer.h" | 47 #include "store-buffer.h" |
| 48 #include "v8memory.h" |
| 49 #include "factory.h" |
| 50 #include "incremental-marking.h" |
21 #include "transitions-inl.h" | 51 #include "transitions-inl.h" |
22 #include "v8memory.h" | 52 #include "objects-visiting.h" |
23 | 53 |
24 namespace v8 { | 54 namespace v8 { |
25 namespace internal { | 55 namespace internal { |
26 | 56 |
27 PropertyDetails::PropertyDetails(Smi* smi) { | 57 PropertyDetails::PropertyDetails(Smi* smi) { |
28 value_ = smi->value(); | 58 value_ = smi->value(); |
29 } | 59 } |
30 | 60 |
31 | 61 |
32 Smi* PropertyDetails::AsSmi() const { | 62 Smi* PropertyDetails::AsSmi() const { |
33 // Ensure the upper 2 bits have the same value by sign extending it. This is | 63 // Ensure the upper 2 bits have the same value by sign extending it. This is |
34 // necessary to be able to use the 31st bit of the property details. | 64 // necessary to be able to use the 31st bit of the property details. |
35 int value = value_ << 1; | 65 int value = value_ << 1; |
36 return Smi::FromInt(value >> 1); | 66 return Smi::FromInt(value >> 1); |
37 } | 67 } |
38 | 68 |
39 | 69 |
40 PropertyDetails PropertyDetails::AsDeleted() const { | 70 PropertyDetails PropertyDetails::AsDeleted() const { |
41 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); | 71 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1)); |
42 return PropertyDetails(smi); | 72 return PropertyDetails(smi); |
43 } | 73 } |
44 | 74 |
45 | 75 |
46 // Review notes: | |
47 // | |
48 // - The use of macros in these inline functions may seem superfluous | |
49 // but it is absolutely needed to make sure gcc generates optimal | |
50 // code. gcc is not happy when attempting to inline too deep. | |
51 // | |
52 #define TYPE_CHECKER(type, instancetype) \ | 76 #define TYPE_CHECKER(type, instancetype) \ |
53 bool Object::Is##type() { \ | 77 bool Object::Is##type() { \ |
54 return Object::IsHeapObject() && \ | 78 return Object::IsHeapObject() && \ |
55 HeapObject::cast(this)->map()->instance_type() == instancetype; \ | 79 HeapObject::cast(this)->map()->instance_type() == instancetype; \ |
56 } | 80 } |
57 | 81 |
58 | 82 |
59 #define CAST_ACCESSOR(type) \ | 83 #define CAST_ACCESSOR(type) \ |
60 type* type::cast(Object* object) { \ | 84 type* type::cast(Object* object) { \ |
61 SLOW_ASSERT(object->Is##type()); \ | 85 SLOW_ASSERT(object->Is##type()); \ |
(...skipping 6935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6997 #undef READ_SHORT_FIELD | 7021 #undef READ_SHORT_FIELD |
6998 #undef WRITE_SHORT_FIELD | 7022 #undef WRITE_SHORT_FIELD |
6999 #undef READ_BYTE_FIELD | 7023 #undef READ_BYTE_FIELD |
7000 #undef WRITE_BYTE_FIELD | 7024 #undef WRITE_BYTE_FIELD |
7001 #undef NOBARRIER_READ_BYTE_FIELD | 7025 #undef NOBARRIER_READ_BYTE_FIELD |
7002 #undef NOBARRIER_WRITE_BYTE_FIELD | 7026 #undef NOBARRIER_WRITE_BYTE_FIELD |
7003 | 7027 |
7004 } } // namespace v8::internal | 7028 } } // namespace v8::internal |
7005 | 7029 |
7006 #endif // V8_OBJECTS_INL_H_ | 7030 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |