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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 } | 1137 } |
1138 | 1138 |
1139 // static | 1139 // static |
1140 MUST_USE_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( | 1140 MUST_USE_RESULT MaybeHandle<FixedArray> JSReceiver::OwnPropertyKeys( |
1141 Handle<JSReceiver> object) { | 1141 Handle<JSReceiver> object) { |
1142 return KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly, | 1142 return KeyAccumulator::GetKeys(object, KeyCollectionMode::kOwnOnly, |
1143 ALL_PROPERTIES, | 1143 ALL_PROPERTIES, |
1144 GetKeysConversion::kConvertToString); | 1144 GetKeysConversion::kConvertToString); |
1145 } | 1145 } |
1146 | 1146 |
| 1147 bool JSObject::PrototypeHasNoElements(Isolate* isolate, JSObject* object) { |
| 1148 DisallowHeapAllocation no_gc; |
| 1149 HeapObject* prototype = HeapObject::cast(object->map()->prototype()); |
| 1150 HeapObject* null = isolate->heap()->null_value(); |
| 1151 HeapObject* empty = isolate->heap()->empty_fixed_array(); |
| 1152 while (prototype != null) { |
| 1153 Map* map = prototype->map(); |
| 1154 if (map->instance_type() <= LAST_CUSTOM_ELEMENTS_RECEIVER) return false; |
| 1155 if (JSObject::cast(prototype)->elements() != empty) return false; |
| 1156 prototype = HeapObject::cast(map->prototype()); |
| 1157 } |
| 1158 return true; |
| 1159 } |
| 1160 |
1147 #define FIELD_ADDR(p, offset) \ | 1161 #define FIELD_ADDR(p, offset) \ |
1148 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1162 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1149 | 1163 |
1150 #define FIELD_ADDR_CONST(p, offset) \ | 1164 #define FIELD_ADDR_CONST(p, offset) \ |
1151 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) | 1165 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1152 | 1166 |
1153 #define READ_FIELD(p, offset) \ | 1167 #define READ_FIELD(p, offset) \ |
1154 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) | 1168 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) |
1155 | 1169 |
1156 #define ACQUIRE_READ_FIELD(p, offset) \ | 1170 #define ACQUIRE_READ_FIELD(p, offset) \ |
(...skipping 7025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8182 #undef WRITE_INT64_FIELD | 8196 #undef WRITE_INT64_FIELD |
8183 #undef READ_BYTE_FIELD | 8197 #undef READ_BYTE_FIELD |
8184 #undef WRITE_BYTE_FIELD | 8198 #undef WRITE_BYTE_FIELD |
8185 #undef NOBARRIER_READ_BYTE_FIELD | 8199 #undef NOBARRIER_READ_BYTE_FIELD |
8186 #undef NOBARRIER_WRITE_BYTE_FIELD | 8200 #undef NOBARRIER_WRITE_BYTE_FIELD |
8187 | 8201 |
8188 } // namespace internal | 8202 } // namespace internal |
8189 } // namespace v8 | 8203 } // namespace v8 |
8190 | 8204 |
8191 #endif // V8_OBJECTS_INL_H_ | 8205 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |