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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 | 269 |
270 | 270 |
271 bool Object::HasValidElements() { | 271 bool Object::HasValidElements() { |
272 // Dictionary is covered under FixedArray. | 272 // Dictionary is covered under FixedArray. |
273 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || | 273 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || |
274 IsFixedTypedArrayBase(); | 274 IsFixedTypedArrayBase(); |
275 } | 275 } |
276 | 276 |
277 | 277 |
| 278 bool Object::KeyEquals(Object* second) { |
| 279 Object* first = this; |
| 280 if (second->IsNumber()) { |
| 281 if (first->IsNumber()) return first->Number() == second->Number(); |
| 282 Object* temp = first; |
| 283 first = second; |
| 284 second = temp; |
| 285 } |
| 286 if (first->IsNumber()) { |
| 287 DCHECK_LE(0, first->Number()); |
| 288 uint32_t expected = static_cast<uint32_t>(first->Number()); |
| 289 uint32_t index; |
| 290 return Name::cast(second)->AsArrayIndex(&index) && index == expected; |
| 291 } |
| 292 return Name::cast(first)->Equals(Name::cast(second)); |
| 293 } |
| 294 |
| 295 |
278 Handle<Object> Object::NewStorageFor(Isolate* isolate, | 296 Handle<Object> Object::NewStorageFor(Isolate* isolate, |
279 Handle<Object> object, | 297 Handle<Object> object, |
280 Representation representation) { | 298 Representation representation) { |
281 if (representation.IsSmi() && object->IsUninitialized()) { | 299 if (representation.IsSmi() && object->IsUninitialized()) { |
282 return handle(Smi::FromInt(0), isolate); | 300 return handle(Smi::FromInt(0), isolate); |
283 } | 301 } |
284 if (!representation.IsDouble()) return object; | 302 if (!representation.IsDouble()) return object; |
285 double value; | 303 double value; |
286 if (object->IsUninitialized()) { | 304 if (object->IsUninitialized()) { |
287 value = 0; | 305 value = 0; |
(...skipping 7326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7614 #undef READ_SHORT_FIELD | 7632 #undef READ_SHORT_FIELD |
7615 #undef WRITE_SHORT_FIELD | 7633 #undef WRITE_SHORT_FIELD |
7616 #undef READ_BYTE_FIELD | 7634 #undef READ_BYTE_FIELD |
7617 #undef WRITE_BYTE_FIELD | 7635 #undef WRITE_BYTE_FIELD |
7618 #undef NOBARRIER_READ_BYTE_FIELD | 7636 #undef NOBARRIER_READ_BYTE_FIELD |
7619 #undef NOBARRIER_WRITE_BYTE_FIELD | 7637 #undef NOBARRIER_WRITE_BYTE_FIELD |
7620 | 7638 |
7621 } } // namespace v8::internal | 7639 } } // namespace v8::internal |
7622 | 7640 |
7623 #endif // V8_OBJECTS_INL_H_ | 7641 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |