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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 bool Object::IsUnseededNumberDictionary() const { | 919 bool Object::IsUnseededNumberDictionary() const { |
920 return IsDictionary(); | 920 return IsDictionary(); |
921 } | 921 } |
922 | 922 |
923 | 923 |
924 bool Object::IsStringTable() const { | 924 bool Object::IsStringTable() const { |
925 return IsHashTable(); | 925 return IsHashTable(); |
926 } | 926 } |
927 | 927 |
928 | 928 |
929 bool Object::IsJSFunctionResultCache() const { | |
930 if (!IsFixedArray()) return false; | |
931 const FixedArray* self = FixedArray::cast(this); | |
932 int length = self->length(); | |
933 if (length < JSFunctionResultCache::kEntriesIndex) return false; | |
934 if ((length - JSFunctionResultCache::kEntriesIndex) | |
935 % JSFunctionResultCache::kEntrySize != 0) { | |
936 return false; | |
937 } | |
938 #ifdef VERIFY_HEAP | |
939 if (FLAG_verify_heap) { | |
940 // TODO(svenpanne) We use const_cast here and below to break our dependency | |
941 // cycle between the predicates and the verifiers. This can be removed when | |
942 // the verifiers are const-correct, too. | |
943 reinterpret_cast<JSFunctionResultCache*>(const_cast<Object*>(this))-> | |
944 JSFunctionResultCacheVerify(); | |
945 } | |
946 #endif | |
947 return true; | |
948 } | |
949 | |
950 | |
951 bool Object::IsNormalizedMapCache() const { | 929 bool Object::IsNormalizedMapCache() const { |
952 return NormalizedMapCache::IsNormalizedMapCache(this); | 930 return NormalizedMapCache::IsNormalizedMapCache(this); |
953 } | 931 } |
954 | 932 |
955 | 933 |
956 int NormalizedMapCache::GetIndex(Handle<Map> map) { | 934 int NormalizedMapCache::GetIndex(Handle<Map> map) { |
957 return map->Hash() % NormalizedMapCache::kEntries; | 935 return map->Hash() % NormalizedMapCache::kEntries; |
958 } | 936 } |
959 | 937 |
960 | 938 |
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3117 CAST_ACCESSOR(Int32x4) | 3095 CAST_ACCESSOR(Int32x4) |
3118 CAST_ACCESSOR(Int8x16) | 3096 CAST_ACCESSOR(Int8x16) |
3119 CAST_ACCESSOR(JSArray) | 3097 CAST_ACCESSOR(JSArray) |
3120 CAST_ACCESSOR(JSArrayBuffer) | 3098 CAST_ACCESSOR(JSArrayBuffer) |
3121 CAST_ACCESSOR(JSArrayBufferView) | 3099 CAST_ACCESSOR(JSArrayBufferView) |
3122 CAST_ACCESSOR(JSBuiltinsObject) | 3100 CAST_ACCESSOR(JSBuiltinsObject) |
3123 CAST_ACCESSOR(JSDataView) | 3101 CAST_ACCESSOR(JSDataView) |
3124 CAST_ACCESSOR(JSDate) | 3102 CAST_ACCESSOR(JSDate) |
3125 CAST_ACCESSOR(JSFunction) | 3103 CAST_ACCESSOR(JSFunction) |
3126 CAST_ACCESSOR(JSFunctionProxy) | 3104 CAST_ACCESSOR(JSFunctionProxy) |
3127 CAST_ACCESSOR(JSFunctionResultCache) | |
3128 CAST_ACCESSOR(JSGeneratorObject) | 3105 CAST_ACCESSOR(JSGeneratorObject) |
3129 CAST_ACCESSOR(JSGlobalObject) | 3106 CAST_ACCESSOR(JSGlobalObject) |
3130 CAST_ACCESSOR(JSGlobalProxy) | 3107 CAST_ACCESSOR(JSGlobalProxy) |
3131 CAST_ACCESSOR(JSMap) | 3108 CAST_ACCESSOR(JSMap) |
3132 CAST_ACCESSOR(JSMapIterator) | 3109 CAST_ACCESSOR(JSMapIterator) |
3133 CAST_ACCESSOR(JSMessageObject) | 3110 CAST_ACCESSOR(JSMessageObject) |
3134 CAST_ACCESSOR(JSModule) | 3111 CAST_ACCESSOR(JSModule) |
3135 CAST_ACCESSOR(JSObject) | 3112 CAST_ACCESSOR(JSObject) |
3136 CAST_ACCESSOR(JSProxy) | 3113 CAST_ACCESSOR(JSProxy) |
3137 CAST_ACCESSOR(JSReceiver) | 3114 CAST_ACCESSOR(JSReceiver) |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3714 | 3691 |
3715 | 3692 |
3716 void StringCharacterStream::VisitTwoByteString( | 3693 void StringCharacterStream::VisitTwoByteString( |
3717 const uint16_t* chars, int length) { | 3694 const uint16_t* chars, int length) { |
3718 is_one_byte_ = false; | 3695 is_one_byte_ = false; |
3719 buffer16_ = chars; | 3696 buffer16_ = chars; |
3720 end_ = reinterpret_cast<const uint8_t*>(chars + length); | 3697 end_ = reinterpret_cast<const uint8_t*>(chars + length); |
3721 } | 3698 } |
3722 | 3699 |
3723 | 3700 |
3724 void JSFunctionResultCache::MakeZeroSize() { | |
3725 set_finger_index(kEntriesIndex); | |
3726 set_size(kEntriesIndex); | |
3727 } | |
3728 | |
3729 | |
3730 void JSFunctionResultCache::Clear() { | |
3731 int cache_size = size(); | |
3732 Object** entries_start = RawFieldOfElementAt(kEntriesIndex); | |
3733 MemsetPointer(entries_start, | |
3734 GetHeap()->the_hole_value(), | |
3735 cache_size - kEntriesIndex); | |
3736 MakeZeroSize(); | |
3737 } | |
3738 | |
3739 | |
3740 int JSFunctionResultCache::size() { | |
3741 return Smi::cast(get(kCacheSizeIndex))->value(); | |
3742 } | |
3743 | |
3744 | |
3745 void JSFunctionResultCache::set_size(int size) { | |
3746 set(kCacheSizeIndex, Smi::FromInt(size)); | |
3747 } | |
3748 | |
3749 | |
3750 int JSFunctionResultCache::finger_index() { | |
3751 return Smi::cast(get(kFingerIndex))->value(); | |
3752 } | |
3753 | |
3754 | |
3755 void JSFunctionResultCache::set_finger_index(int finger_index) { | |
3756 set(kFingerIndex, Smi::FromInt(finger_index)); | |
3757 } | |
3758 | |
3759 | |
3760 byte ByteArray::get(int index) { | 3701 byte ByteArray::get(int index) { |
3761 DCHECK(index >= 0 && index < this->length()); | 3702 DCHECK(index >= 0 && index < this->length()); |
3762 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); | 3703 return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize); |
3763 } | 3704 } |
3764 | 3705 |
3765 | 3706 |
3766 void ByteArray::set(int index, byte value) { | 3707 void ByteArray::set(int index, byte value) { |
3767 DCHECK(index >= 0 && index < this->length()); | 3708 DCHECK(index >= 0 && index < this->length()); |
3768 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); | 3709 WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value); |
3769 } | 3710 } |
(...skipping 3518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7288 #undef READ_INT64_FIELD | 7229 #undef READ_INT64_FIELD |
7289 #undef WRITE_INT64_FIELD | 7230 #undef WRITE_INT64_FIELD |
7290 #undef READ_BYTE_FIELD | 7231 #undef READ_BYTE_FIELD |
7291 #undef WRITE_BYTE_FIELD | 7232 #undef WRITE_BYTE_FIELD |
7292 #undef NOBARRIER_READ_BYTE_FIELD | 7233 #undef NOBARRIER_READ_BYTE_FIELD |
7293 #undef NOBARRIER_WRITE_BYTE_FIELD | 7234 #undef NOBARRIER_WRITE_BYTE_FIELD |
7294 | 7235 |
7295 } } // namespace v8::internal | 7236 } } // namespace v8::internal |
7296 | 7237 |
7297 #endif // V8_OBJECTS_INL_H_ | 7238 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |