| 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 7043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7054 } | 7054 } |
| 7055 | 7055 |
| 7056 | 7056 |
| 7057 int TypeFeedbackInfo::ic_with_type_info_count() { | 7057 int TypeFeedbackInfo::ic_with_type_info_count() { |
| 7058 int current = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 7058 int current = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); |
| 7059 return ICsWithTypeInfoCountField::decode(current); | 7059 return ICsWithTypeInfoCountField::decode(current); |
| 7060 } | 7060 } |
| 7061 | 7061 |
| 7062 | 7062 |
| 7063 void TypeFeedbackInfo::change_ic_with_type_info_count(int delta) { | 7063 void TypeFeedbackInfo::change_ic_with_type_info_count(int delta) { |
| 7064 if (delta == 0) return; |
| 7064 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 7065 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); |
| 7065 int new_count = ICsWithTypeInfoCountField::decode(value) + delta; | 7066 int new_count = ICsWithTypeInfoCountField::decode(value) + delta; |
| 7066 // We can get negative count here when the type-feedback info is | 7067 // We can get negative count here when the type-feedback info is |
| 7067 // shared between two code objects. The can only happen when | 7068 // shared between two code objects. The can only happen when |
| 7068 // the debugger made a shallow copy of code object (see Heap::CopyCode). | 7069 // the debugger made a shallow copy of code object (see Heap::CopyCode). |
| 7069 // Since we do not optimize when the debugger is active, we can skip | 7070 // Since we do not optimize when the debugger is active, we can skip |
| 7070 // this counter update. | 7071 // this counter update. |
| 7071 if (new_count >= 0) { | 7072 if (new_count >= 0) { |
| 7072 new_count &= ICsWithTypeInfoCountField::kMask; | 7073 new_count &= ICsWithTypeInfoCountField::kMask; |
| 7073 value = ICsWithTypeInfoCountField::update(value, new_count); | 7074 value = ICsWithTypeInfoCountField::update(value, new_count); |
| 7074 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value)); | 7075 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(value)); |
| 7075 } | 7076 } |
| 7076 } | 7077 } |
| 7077 | 7078 |
| 7078 | 7079 |
| 7080 int TypeFeedbackInfo::ic_generic_count() { |
| 7081 return Smi::cast(READ_FIELD(this, kStorage3Offset))->value(); |
| 7082 } |
| 7083 |
| 7084 |
| 7085 void TypeFeedbackInfo::change_ic_generic_count(int delta) { |
| 7086 if (delta == 0) return; |
| 7087 int new_count = ic_generic_count() + delta; |
| 7088 if (new_count >= 0) { |
| 7089 new_count &= ~Smi::kMinValue; |
| 7090 WRITE_FIELD(this, kStorage3Offset, Smi::FromInt(new_count)); |
| 7091 } |
| 7092 } |
| 7093 |
| 7094 |
| 7079 void TypeFeedbackInfo::initialize_storage() { | 7095 void TypeFeedbackInfo::initialize_storage() { |
| 7080 WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(0)); | 7096 WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(0)); |
| 7081 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(0)); | 7097 WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(0)); |
| 7098 WRITE_FIELD(this, kStorage3Offset, Smi::FromInt(0)); |
| 7082 } | 7099 } |
| 7083 | 7100 |
| 7084 | 7101 |
| 7085 void TypeFeedbackInfo::change_own_type_change_checksum() { | 7102 void TypeFeedbackInfo::change_own_type_change_checksum() { |
| 7086 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 7103 int value = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
| 7087 int checksum = OwnTypeChangeChecksum::decode(value); | 7104 int checksum = OwnTypeChangeChecksum::decode(value); |
| 7088 checksum = (checksum + 1) % (1 << kTypeChangeChecksumBits); | 7105 checksum = (checksum + 1) % (1 << kTypeChangeChecksumBits); |
| 7089 value = OwnTypeChangeChecksum::update(value, checksum); | 7106 value = OwnTypeChangeChecksum::update(value, checksum); |
| 7090 // Ensure packed bit field is in Smi range. | 7107 // Ensure packed bit field is in Smi range. |
| 7091 if (value > Smi::kMaxValue) value |= Smi::kMinValue; | 7108 if (value > Smi::kMaxValue) value |= Smi::kMinValue; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7259 #undef READ_SHORT_FIELD | 7276 #undef READ_SHORT_FIELD |
| 7260 #undef WRITE_SHORT_FIELD | 7277 #undef WRITE_SHORT_FIELD |
| 7261 #undef READ_BYTE_FIELD | 7278 #undef READ_BYTE_FIELD |
| 7262 #undef WRITE_BYTE_FIELD | 7279 #undef WRITE_BYTE_FIELD |
| 7263 #undef NOBARRIER_READ_BYTE_FIELD | 7280 #undef NOBARRIER_READ_BYTE_FIELD |
| 7264 #undef NOBARRIER_WRITE_BYTE_FIELD | 7281 #undef NOBARRIER_WRITE_BYTE_FIELD |
| 7265 | 7282 |
| 7266 } } // namespace v8::internal | 7283 } } // namespace v8::internal |
| 7267 | 7284 |
| 7268 #endif // V8_OBJECTS_INL_H_ | 7285 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |