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 | |
1161 #define FIELD_ADDR(p, offset) \ | 1147 #define FIELD_ADDR(p, offset) \ |
1162 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) | 1148 (reinterpret_cast<byte*>(p) + offset - kHeapObjectTag) |
1163 | 1149 |
1164 #define FIELD_ADDR_CONST(p, offset) \ | 1150 #define FIELD_ADDR_CONST(p, offset) \ |
1165 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) | 1151 (reinterpret_cast<const byte*>(p) + offset - kHeapObjectTag) |
1166 | 1152 |
1167 #define READ_FIELD(p, offset) \ | 1153 #define READ_FIELD(p, offset) \ |
1168 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) | 1154 (*reinterpret_cast<Object* const*>(FIELD_ADDR_CONST(p, offset))) |
1169 | 1155 |
1170 #define ACQUIRE_READ_FIELD(p, offset) \ | 1156 #define ACQUIRE_READ_FIELD(p, offset) \ |
(...skipping 7015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8186 #undef WRITE_INT64_FIELD | 8172 #undef WRITE_INT64_FIELD |
8187 #undef READ_BYTE_FIELD | 8173 #undef READ_BYTE_FIELD |
8188 #undef WRITE_BYTE_FIELD | 8174 #undef WRITE_BYTE_FIELD |
8189 #undef NOBARRIER_READ_BYTE_FIELD | 8175 #undef NOBARRIER_READ_BYTE_FIELD |
8190 #undef NOBARRIER_WRITE_BYTE_FIELD | 8176 #undef NOBARRIER_WRITE_BYTE_FIELD |
8191 | 8177 |
8192 } // namespace internal | 8178 } // namespace internal |
8193 } // namespace v8 | 8179 } // namespace v8 |
8194 | 8180 |
8195 #endif // V8_OBJECTS_INL_H_ | 8181 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |