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 // |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 } | 1127 } |
1128 | 1128 |
1129 // static | 1129 // static |
1130 MUST_USE_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( | 1130 MUST_USE_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( |
1131 Handle<JSReceiver> object) { | 1131 Handle<JSReceiver> object) { |
1132 return KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly, | 1132 return KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly, |
1133 ALL_PROPERTIES, | 1133 ALL_PROPERTIES, |
1134 GetKeysConversion::kConvertToString); | 1134 GetKeysConversion::kConvertToString); |
1135 } | 1135 } |
1136 | 1136 |
| 1137 bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject* object) { |
| 1138 DisallowHeapAllocation no_gc; |
| 1139 HeapObject* prototype = HeapObject::cast(object->map()->prototype()); |
| 1140 HeapObject* null = isolate->heap()->null_value(); |
| 1141 HeapObject* empty = isolate->heap()->empty_fixed_array(); |
| 1142 while (prototype != null) { |
| 1143 Map* map = prototype->map(); |
| 1144 if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER) return false; |
| 1145 if (JSObject::cast(prototype)->elements() != empty) return false; |
| 1146 prototype = HeapObject::cast(map->prototype()); |
| 1147 } |
| 1148 return true; |
| 1149 } |
| 1150 |
1137 #define FIELD_ADDR(p, offset) \ | 1151 #define FIELD_ADDR(p, offset) \ |
1138 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1152 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1139 | 1153 |
1140 #define FIELD_ADDR_CONST(p, offset) \ | 1154 #define FIELD_ADDR_CONST(p, offset) \ |
1141 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) | 1155 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1142 | 1156 |
1143 #define READ_FIELD(p, offset) \ | 1157 #define READ_FIELD(p, offset) \ |
1144 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) | 1158 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) |
1145 | 1159 |
1146 #define ACQUIRE_READ_FIELD(p, offset) \ | 1160 #define ACQUIRE_READ_FIELD(p, offset) \ |
(...skipping 6977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8124 #undef WRITE_INT64_FIELD | 8138 #undef WRITE_INT64_FIELD |
8125 #undef READ_BYTE_FIELD | 8139 #undef READ_BYTE_FIELD |
8126 #undef WRITE_BYTE_FIELD | 8140 #undef WRITE_BYTE_FIELD |
8127 #undef NOBARRIER_READ_BYTE_FIELD | 8141 #undef NOBARRIER_READ_BYTE_FIELD |
8128 #undef NOBARRIER_WRITE_BYTE_FIELD | 8142 #undef NOBARRIER_WRITE_BYTE_FIELD |
8129 | 8143 |
8130 } // namespace internal | 8144 } // namespace internal |
8131 } // namespace v8 | 8145 } // namespace v8 |
8132 | 8146 |
8133 #endif // V8_OBJECTS_INL_H_ | 8147 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |