OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 607 |
608 | 608 |
609 bool Object::IsHashTable() { | 609 bool Object::IsHashTable() { |
610 return Object::IsHeapObject() && | 610 return Object::IsHeapObject() && |
611 HeapObject::cast(this)->map() == | 611 HeapObject::cast(this)->map() == |
612 HeapObject::cast(this)->GetHeap()->hash_table_map(); | 612 HeapObject::cast(this)->GetHeap()->hash_table_map(); |
613 } | 613 } |
614 | 614 |
615 | 615 |
616 bool Object::IsDictionary() { | 616 bool Object::IsDictionary() { |
617 return IsHashTable() && this != | 617 return IsHashTable() && |
618 HeapObject::cast(this)->GetHeap()->symbol_table(); | 618 this != HeapObject::cast(this)->GetHeap()->symbol_table(); |
619 } | 619 } |
620 | 620 |
621 | 621 |
622 bool Object::IsSymbolTable() { | 622 bool Object::IsSymbolTable() { |
623 return IsHashTable() && this == | 623 return IsHashTable() && this == |
624 HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table(); | 624 HeapObject::cast(this)->GetHeap()->raw_unchecked_symbol_table(); |
625 } | 625 } |
626 | 626 |
627 | 627 |
628 bool Object::IsJSFunctionResultCache() { | 628 bool Object::IsJSFunctionResultCache() { |
(...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3554 | 3554 |
3555 | 3555 |
3556 JSObject::ElementsKind JSObject::GetElementsKind() { | 3556 JSObject::ElementsKind JSObject::GetElementsKind() { |
3557 if (map()->has_fast_elements()) { | 3557 if (map()->has_fast_elements()) { |
3558 ASSERT(elements()->map() == GetHeap()->fixed_array_map() || | 3558 ASSERT(elements()->map() == GetHeap()->fixed_array_map() || |
3559 elements()->map() == GetHeap()->fixed_cow_array_map()); | 3559 elements()->map() == GetHeap()->fixed_cow_array_map()); |
3560 return FAST_ELEMENTS; | 3560 return FAST_ELEMENTS; |
3561 } | 3561 } |
3562 HeapObject* array = elements(); | 3562 HeapObject* array = elements(); |
3563 if (array->IsFixedArray()) { | 3563 if (array->IsFixedArray()) { |
3564 // FAST_ELEMENTS or DICTIONARY_ELEMENTS are both stored in a | 3564 // FAST_ELEMENTS, DICTIONARY_ELEMENTS, and NON_STRICT_ARGUMENTS_ELEMENTS |
3565 // FixedArray, but FAST_ELEMENTS is already handled above. | 3565 // are all stored in a FixedArray, but FAST_ELEMENTS is already handled |
| 3566 // above. |
| 3567 if (array->map() == GetHeap()->non_strict_arguments_elements()) { |
| 3568 return NON_STRICT_ARGUMENTS_ELEMENTS; |
| 3569 } |
3566 ASSERT(array->IsDictionary()); | 3570 ASSERT(array->IsDictionary()); |
3567 return DICTIONARY_ELEMENTS; | 3571 return DICTIONARY_ELEMENTS; |
3568 } | 3572 } |
3569 ASSERT(!map()->has_fast_elements()); | 3573 ASSERT(array->IsExternalArray()); |
3570 if (array->IsExternalArray()) { | 3574 switch (array->map()->instance_type()) { |
3571 switch (array->map()->instance_type()) { | 3575 case EXTERNAL_BYTE_ARRAY_TYPE: |
3572 case EXTERNAL_BYTE_ARRAY_TYPE: | 3576 return EXTERNAL_BYTE_ELEMENTS; |
3573 return EXTERNAL_BYTE_ELEMENTS; | 3577 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
3574 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 3578 return EXTERNAL_UNSIGNED_BYTE_ELEMENTS; |
3575 return EXTERNAL_UNSIGNED_BYTE_ELEMENTS; | 3579 case EXTERNAL_SHORT_ARRAY_TYPE: |
3576 case EXTERNAL_SHORT_ARRAY_TYPE: | 3580 return EXTERNAL_SHORT_ELEMENTS; |
3577 return EXTERNAL_SHORT_ELEMENTS; | 3581 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
3578 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 3582 return EXTERNAL_UNSIGNED_SHORT_ELEMENTS; |
3579 return EXTERNAL_UNSIGNED_SHORT_ELEMENTS; | 3583 case EXTERNAL_INT_ARRAY_TYPE: |
3580 case EXTERNAL_INT_ARRAY_TYPE: | 3584 return EXTERNAL_INT_ELEMENTS; |
3581 return EXTERNAL_INT_ELEMENTS; | 3585 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
3582 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 3586 return EXTERNAL_UNSIGNED_INT_ELEMENTS; |
3583 return EXTERNAL_UNSIGNED_INT_ELEMENTS; | 3587 case EXTERNAL_PIXEL_ARRAY_TYPE: |
3584 case EXTERNAL_PIXEL_ARRAY_TYPE: | 3588 return EXTERNAL_PIXEL_ELEMENTS; |
3585 return EXTERNAL_PIXEL_ELEMENTS; | |
3586 default: | |
3587 break; | |
3588 } | |
3589 } | 3589 } |
3590 ASSERT(array->map()->instance_type() == EXTERNAL_FLOAT_ARRAY_TYPE); | 3590 ASSERT(array->map()->instance_type() == EXTERNAL_FLOAT_ARRAY_TYPE); |
3591 return EXTERNAL_FLOAT_ELEMENTS; | 3591 return EXTERNAL_FLOAT_ELEMENTS; |
3592 } | 3592 } |
3593 | 3593 |
3594 | 3594 |
3595 bool JSObject::HasFastElements() { | 3595 bool JSObject::HasFastElements() { |
3596 return GetElementsKind() == FAST_ELEMENTS; | 3596 return GetElementsKind() == FAST_ELEMENTS; |
3597 } | 3597 } |
3598 | 3598 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4091 #undef WRITE_INT_FIELD | 4091 #undef WRITE_INT_FIELD |
4092 #undef READ_SHORT_FIELD | 4092 #undef READ_SHORT_FIELD |
4093 #undef WRITE_SHORT_FIELD | 4093 #undef WRITE_SHORT_FIELD |
4094 #undef READ_BYTE_FIELD | 4094 #undef READ_BYTE_FIELD |
4095 #undef WRITE_BYTE_FIELD | 4095 #undef WRITE_BYTE_FIELD |
4096 | 4096 |
4097 | 4097 |
4098 } } // namespace v8::internal | 4098 } } // namespace v8::internal |
4099 | 4099 |
4100 #endif // V8_OBJECTS_INL_H_ | 4100 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |