| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 5498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5509 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. | 5509 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. |
| 5510 FixedArray::cast(data())->set(index, value); | 5510 FixedArray::cast(data())->set(index, value); |
| 5511 } | 5511 } |
| 5512 | 5512 |
| 5513 | 5513 |
| 5514 ElementsKind JSObject::GetElementsKind() { | 5514 ElementsKind JSObject::GetElementsKind() { |
| 5515 ElementsKind kind = map()->elements_kind(); | 5515 ElementsKind kind = map()->elements_kind(); |
| 5516 #if DEBUG | 5516 #if DEBUG |
| 5517 FixedArrayBase* fixed_array = | 5517 FixedArrayBase* fixed_array = |
| 5518 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); | 5518 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); |
| 5519 Map* map = fixed_array->map(); | 5519 |
| 5520 ASSERT((IsFastSmiOrObjectElementsKind(kind) && | 5520 // If a GC was caused while constructing this object, the elements |
| 5521 (map == GetHeap()->fixed_array_map() || | 5521 // pointer may point to a one pointer filler map. |
| 5522 map == GetHeap()->fixed_cow_array_map())) || | 5522 if (ElementsAreSafeToExamine()) { |
| 5523 (IsFastDoubleElementsKind(kind) && | 5523 Map* map = fixed_array->map(); |
| 5524 (fixed_array->IsFixedDoubleArray() || | 5524 ASSERT((IsFastSmiOrObjectElementsKind(kind) && |
| 5525 fixed_array == GetHeap()->empty_fixed_array())) || | 5525 (map == GetHeap()->fixed_array_map() || |
| 5526 (kind == DICTIONARY_ELEMENTS && | 5526 map == GetHeap()->fixed_cow_array_map())) || |
| 5527 (IsFastDoubleElementsKind(kind) && |
| 5528 (fixed_array->IsFixedDoubleArray() || |
| 5529 fixed_array == GetHeap()->empty_fixed_array())) || |
| 5530 (kind == DICTIONARY_ELEMENTS && |
| 5527 fixed_array->IsFixedArray() && | 5531 fixed_array->IsFixedArray() && |
| 5528 fixed_array->IsDictionary()) || | 5532 fixed_array->IsDictionary()) || |
| 5529 (kind > DICTIONARY_ELEMENTS)); | 5533 (kind > DICTIONARY_ELEMENTS)); |
| 5530 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || | 5534 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || |
| 5531 (elements()->IsFixedArray() && elements()->length() >= 2)); | 5535 (elements()->IsFixedArray() && elements()->length() >= 2)); |
| 5536 } |
| 5532 #endif | 5537 #endif |
| 5533 return kind; | 5538 return kind; |
| 5534 } | 5539 } |
| 5535 | 5540 |
| 5536 | 5541 |
| 5537 ElementsAccessor* JSObject::GetElementsAccessor() { | 5542 ElementsAccessor* JSObject::GetElementsAccessor() { |
| 5538 return ElementsAccessor::ForKind(GetElementsKind()); | 5543 return ElementsAccessor::ForKind(GetElementsKind()); |
| 5539 } | 5544 } |
| 5540 | 5545 |
| 5541 | 5546 |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6393 #undef WRITE_UINT32_FIELD | 6398 #undef WRITE_UINT32_FIELD |
| 6394 #undef READ_SHORT_FIELD | 6399 #undef READ_SHORT_FIELD |
| 6395 #undef WRITE_SHORT_FIELD | 6400 #undef WRITE_SHORT_FIELD |
| 6396 #undef READ_BYTE_FIELD | 6401 #undef READ_BYTE_FIELD |
| 6397 #undef WRITE_BYTE_FIELD | 6402 #undef WRITE_BYTE_FIELD |
| 6398 | 6403 |
| 6399 | 6404 |
| 6400 } } // namespace v8::internal | 6405 } } // namespace v8::internal |
| 6401 | 6406 |
| 6402 #endif // V8_OBJECTS_INL_H_ | 6407 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |