| 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 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 TransitionArray* transitions = map->transitions(); | 1570 TransitionArray* transitions = map->transitions(); |
| 1571 int transition = transitions->Search(*key); | 1571 int transition = transitions->Search(*key); |
| 1572 if (transition == TransitionArray::kNotFound) return Handle<Map>::null(); | 1572 if (transition == TransitionArray::kNotFound) return Handle<Map>::null(); |
| 1573 PropertyDetails target_details = transitions->GetTargetDetails(transition); | 1573 PropertyDetails target_details = transitions->GetTargetDetails(transition); |
| 1574 if (target_details.type() != FIELD) return Handle<Map>::null(); | 1574 if (target_details.type() != FIELD) return Handle<Map>::null(); |
| 1575 if (target_details.attributes() != NONE) return Handle<Map>::null(); | 1575 if (target_details.attributes() != NONE) return Handle<Map>::null(); |
| 1576 return Handle<Map>(transitions->GetTarget(transition)); | 1576 return Handle<Map>(transitions->GetTarget(transition)); |
| 1577 } | 1577 } |
| 1578 | 1578 |
| 1579 | 1579 |
| 1580 int JSObject::LastAddedFieldIndex() { | |
| 1581 Map* map = this->map(); | |
| 1582 int last_added = map->LastAdded(); | |
| 1583 return map->instance_descriptors()->GetFieldIndex(last_added); | |
| 1584 } | |
| 1585 | |
| 1586 | |
| 1587 ACCESSORS(Oddball, to_string, String, kToStringOffset) | 1580 ACCESSORS(Oddball, to_string, String, kToStringOffset) |
| 1588 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) | 1581 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) |
| 1589 | 1582 |
| 1590 | 1583 |
| 1591 byte Oddball::kind() { | 1584 byte Oddball::kind() { |
| 1592 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); | 1585 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); |
| 1593 } | 1586 } |
| 1594 | 1587 |
| 1595 | 1588 |
| 1596 void Oddball::set_kind(byte value) { | 1589 void Oddball::set_kind(byte value) { |
| (...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3749 return ExtractExtendedExtraICStateFromFlags(flags()); | 3742 return ExtractExtendedExtraICStateFromFlags(flags()); |
| 3750 } | 3743 } |
| 3751 | 3744 |
| 3752 | 3745 |
| 3753 Code::StubType Code::type() { | 3746 Code::StubType Code::type() { |
| 3754 return ExtractTypeFromFlags(flags()); | 3747 return ExtractTypeFromFlags(flags()); |
| 3755 } | 3748 } |
| 3756 | 3749 |
| 3757 | 3750 |
| 3758 int Code::arguments_count() { | 3751 int Code::arguments_count() { |
| 3759 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); | 3752 ASSERT(is_call_stub() || is_keyed_call_stub() || |
| 3753 kind() == STUB || is_handler()); |
| 3760 return ExtractArgumentsCountFromFlags(flags()); | 3754 return ExtractArgumentsCountFromFlags(flags()); |
| 3761 } | 3755 } |
| 3762 | 3756 |
| 3763 | 3757 |
| 3764 inline bool Code::is_crankshafted() { | 3758 inline bool Code::is_crankshafted() { |
| 3765 return IsCrankshaftedField::decode( | 3759 return IsCrankshaftedField::decode( |
| 3766 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 3760 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
| 3767 } | 3761 } |
| 3768 | 3762 |
| 3769 | 3763 |
| 3770 inline void Code::set_is_crankshafted(bool value) { | 3764 inline void Code::set_is_crankshafted(bool value) { |
| 3771 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 3765 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| 3772 int updated = IsCrankshaftedField::update(previous, value); | 3766 int updated = IsCrankshaftedField::update(previous, value); |
| 3773 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); | 3767 WRITE_UINT32_FIELD(this, kKindSpecificFlags2Offset, updated); |
| 3774 } | 3768 } |
| 3775 | 3769 |
| 3776 | 3770 |
| 3777 int Code::major_key() { | 3771 int Code::major_key() { |
| 3778 ASSERT(kind() == STUB || | 3772 ASSERT(kind() == STUB || |
| 3773 kind() == HANDLER || |
| 3779 kind() == BINARY_OP_IC || | 3774 kind() == BINARY_OP_IC || |
| 3780 kind() == COMPARE_IC || | 3775 kind() == COMPARE_IC || |
| 3781 kind() == COMPARE_NIL_IC || | 3776 kind() == COMPARE_NIL_IC || |
| 3782 kind() == STORE_IC || | 3777 kind() == STORE_IC || |
| 3783 kind() == LOAD_IC || | 3778 kind() == LOAD_IC || |
| 3784 kind() == KEYED_LOAD_IC || | 3779 kind() == KEYED_LOAD_IC || |
| 3785 kind() == TO_BOOLEAN_IC); | 3780 kind() == TO_BOOLEAN_IC); |
| 3786 return StubMajorKeyField::decode( | 3781 return StubMajorKeyField::decode( |
| 3787 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); | 3782 READ_UINT32_FIELD(this, kKindSpecificFlags2Offset)); |
| 3788 } | 3783 } |
| 3789 | 3784 |
| 3790 | 3785 |
| 3791 void Code::set_major_key(int major) { | 3786 void Code::set_major_key(int major) { |
| 3792 ASSERT(kind() == STUB || | 3787 ASSERT(kind() == STUB || |
| 3788 kind() == HANDLER || |
| 3793 kind() == BINARY_OP_IC || | 3789 kind() == BINARY_OP_IC || |
| 3794 kind() == COMPARE_IC || | 3790 kind() == COMPARE_IC || |
| 3795 kind() == COMPARE_NIL_IC || | 3791 kind() == COMPARE_NIL_IC || |
| 3796 kind() == LOAD_IC || | 3792 kind() == LOAD_IC || |
| 3797 kind() == KEYED_LOAD_IC || | 3793 kind() == KEYED_LOAD_IC || |
| 3798 kind() == STORE_IC || | 3794 kind() == STORE_IC || |
| 3799 kind() == KEYED_STORE_IC || | 3795 kind() == KEYED_STORE_IC || |
| 3800 kind() == TO_BOOLEAN_IC); | 3796 kind() == TO_BOOLEAN_IC); |
| 3801 ASSERT(0 <= major && major < 256); | 3797 ASSERT(0 <= major && major < 256); |
| 3802 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); | 3798 int previous = READ_UINT32_FIELD(this, kKindSpecificFlags2Offset); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4018 Kind kind = this->kind(); | 4014 Kind kind = this->kind(); |
| 4019 switch (kind) { | 4015 switch (kind) { |
| 4020 #define CASE(name) case name: return true; | 4016 #define CASE(name) case name: return true; |
| 4021 IC_KIND_LIST(CASE) | 4017 IC_KIND_LIST(CASE) |
| 4022 #undef CASE | 4018 #undef CASE |
| 4023 default: return false; | 4019 default: return false; |
| 4024 } | 4020 } |
| 4025 } | 4021 } |
| 4026 | 4022 |
| 4027 | 4023 |
| 4024 bool Code::is_keyed_stub() { |
| 4025 return is_keyed_load_stub() || is_keyed_store_stub() || is_keyed_call_stub(); |
| 4026 } |
| 4027 |
| 4028 |
| 4028 bool Code::is_debug_stub() { | 4029 bool Code::is_debug_stub() { |
| 4029 return ic_state() == DEBUG_STUB; | 4030 return ic_state() == DEBUG_STUB; |
| 4030 } | 4031 } |
| 4031 | 4032 |
| 4032 | 4033 |
| 4033 Code::Flags Code::ComputeFlags(Kind kind, | 4034 Code::Flags Code::ComputeFlags(Kind kind, |
| 4034 InlineCacheState ic_state, | 4035 InlineCacheState ic_state, |
| 4035 ExtraICState extra_ic_state, | 4036 ExtraICState extra_ic_state, |
| 4036 StubType type, | 4037 StubType type, |
| 4037 int argc, | 4038 int argc, |
| (...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5947 } | 5948 } |
| 5948 | 5949 |
| 5949 | 5950 |
| 5950 template <int entrysize> | 5951 template <int entrysize> |
| 5951 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, | 5952 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, |
| 5952 Object* key) { | 5953 Object* key) { |
| 5953 return key; | 5954 return key; |
| 5954 } | 5955 } |
| 5955 | 5956 |
| 5956 | 5957 |
| 5958 template <int entrysize> |
| 5959 bool WeakHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { |
| 5960 return key->SameValue(other); |
| 5961 } |
| 5962 |
| 5963 |
| 5964 template <int entrysize> |
| 5965 uint32_t WeakHashTableShape<entrysize>::Hash(Object* key) { |
| 5966 intptr_t hash = reinterpret_cast<intptr_t>(key); |
| 5967 return (uint32_t)(hash & 0xFFFFFFFF); |
| 5968 } |
| 5969 |
| 5970 |
| 5971 template <int entrysize> |
| 5972 uint32_t WeakHashTableShape<entrysize>::HashForObject(Object* key, |
| 5973 Object* other) { |
| 5974 intptr_t hash = reinterpret_cast<intptr_t>(other); |
| 5975 return (uint32_t)(hash & 0xFFFFFFFF); |
| 5976 } |
| 5977 |
| 5978 |
| 5979 template <int entrysize> |
| 5980 MaybeObject* WeakHashTableShape<entrysize>::AsObject(Heap* heap, |
| 5981 Object* key) { |
| 5982 return key; |
| 5983 } |
| 5984 |
| 5985 |
| 5957 void Map::ClearCodeCache(Heap* heap) { | 5986 void Map::ClearCodeCache(Heap* heap) { |
| 5958 // No write barrier is needed since empty_fixed_array is not in new space. | 5987 // No write barrier is needed since empty_fixed_array is not in new space. |
| 5959 // Please note this function is used during marking: | 5988 // Please note this function is used during marking: |
| 5960 // - MarkCompactCollector::MarkUnmarkedObject | 5989 // - MarkCompactCollector::MarkUnmarkedObject |
| 5961 // - IncrementalMarking::Step | 5990 // - IncrementalMarking::Step |
| 5962 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); | 5991 ASSERT(!heap->InNewSpace(heap->empty_fixed_array())); |
| 5963 WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array()); | 5992 WRITE_FIELD(this, kCodeCacheOffset, heap->empty_fixed_array()); |
| 5964 } | 5993 } |
| 5965 | 5994 |
| 5966 | 5995 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6251 #undef WRITE_UINT32_FIELD | 6280 #undef WRITE_UINT32_FIELD |
| 6252 #undef READ_SHORT_FIELD | 6281 #undef READ_SHORT_FIELD |
| 6253 #undef WRITE_SHORT_FIELD | 6282 #undef WRITE_SHORT_FIELD |
| 6254 #undef READ_BYTE_FIELD | 6283 #undef READ_BYTE_FIELD |
| 6255 #undef WRITE_BYTE_FIELD | 6284 #undef WRITE_BYTE_FIELD |
| 6256 | 6285 |
| 6257 | 6286 |
| 6258 } } // namespace v8::internal | 6287 } } // namespace v8::internal |
| 6259 | 6288 |
| 6260 #endif // V8_OBJECTS_INL_H_ | 6289 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |