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 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3443 | 3443 |
3444 int HandlerTable::GetRangeHandler(int index) const { | 3444 int HandlerTable::GetRangeHandler(int index) const { |
3445 return HandlerOffsetField::decode( | 3445 return HandlerOffsetField::decode( |
3446 Smi::cast(get(index * kRangeEntrySize + kRangeHandlerIndex))->value()); | 3446 Smi::cast(get(index * kRangeEntrySize + kRangeHandlerIndex))->value()); |
3447 } | 3447 } |
3448 | 3448 |
3449 int HandlerTable::GetRangeData(int index) const { | 3449 int HandlerTable::GetRangeData(int index) const { |
3450 return Smi::cast(get(index * kRangeEntrySize + kRangeDataIndex))->value(); | 3450 return Smi::cast(get(index * kRangeEntrySize + kRangeDataIndex))->value(); |
3451 } | 3451 } |
3452 | 3452 |
3453 HandlerTable::CatchPrediction HandlerTable::GetRangePrediction( | |
3454 int index) const { | |
3455 return HandlerPredictionField::decode( | |
3456 Smi::cast(get(index * kRangeEntrySize + kRangeHandlerIndex))->value()); | |
3457 } | |
3458 | |
3459 void HandlerTable::SetRangeStart(int index, int value) { | 3453 void HandlerTable::SetRangeStart(int index, int value) { |
3460 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 3454 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
3461 } | 3455 } |
3462 | 3456 |
3463 | 3457 |
3464 void HandlerTable::SetRangeEnd(int index, int value) { | 3458 void HandlerTable::SetRangeEnd(int index, int value) { |
3465 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); | 3459 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); |
3466 } | 3460 } |
3467 | 3461 |
3468 | 3462 |
3469 void HandlerTable::SetRangeHandler(int index, int offset, | 3463 void HandlerTable::SetRangeHandler(int index, int offset, |
3470 CatchPrediction prediction) { | 3464 CatchPrediction prediction) { |
3471 int value = HandlerOffsetField::encode(offset) | | 3465 int value = HandlerOffsetField::encode(offset) | |
3472 HandlerPredictionField::encode(prediction); | 3466 HandlerPredictionField::encode(prediction); |
3473 set(index * kRangeEntrySize + kRangeHandlerIndex, Smi::FromInt(value)); | 3467 set(index * kRangeEntrySize + kRangeHandlerIndex, Smi::FromInt(value)); |
3474 } | 3468 } |
3475 | 3469 |
3476 void HandlerTable::SetRangeData(int index, int value) { | 3470 void HandlerTable::SetRangeData(int index, int value) { |
3477 set(index * kRangeEntrySize + kRangeDataIndex, Smi::FromInt(value)); | 3471 set(index * kRangeEntrySize + kRangeDataIndex, Smi::FromInt(value)); |
3478 } | 3472 } |
3479 | 3473 |
3480 | 3474 |
3481 void HandlerTable::SetReturnOffset(int index, int value) { | 3475 void HandlerTable::SetReturnOffset(int index, int value) { |
3482 set(index * kReturnEntrySize + kReturnOffsetIndex, Smi::FromInt(value)); | 3476 set(index * kReturnEntrySize + kReturnOffsetIndex, Smi::FromInt(value)); |
3483 } | 3477 } |
3484 | 3478 |
3485 | 3479 void HandlerTable::SetReturnHandler(int index, int offset) { |
3486 void HandlerTable::SetReturnHandler(int index, int offset, | 3480 int value = HandlerOffsetField::encode(offset); |
3487 CatchPrediction prediction) { | |
3488 int value = HandlerOffsetField::encode(offset) | | |
3489 HandlerPredictionField::encode(prediction); | |
3490 set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value)); | 3481 set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value)); |
3491 } | 3482 } |
3492 | 3483 |
3493 int HandlerTable::NumberOfRangeEntries() const { | 3484 int HandlerTable::NumberOfRangeEntries() const { |
3494 return length() / kRangeEntrySize; | 3485 return length() / kRangeEntrySize; |
3495 } | 3486 } |
3496 | 3487 |
3497 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) | 3488 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) |
3498 STRUCT_LIST(MAKE_STRUCT_CAST) | 3489 STRUCT_LIST(MAKE_STRUCT_CAST) |
3499 #undef MAKE_STRUCT_CAST | 3490 #undef MAKE_STRUCT_CAST |
(...skipping 4682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8182 #undef WRITE_INT64_FIELD | 8173 #undef WRITE_INT64_FIELD |
8183 #undef READ_BYTE_FIELD | 8174 #undef READ_BYTE_FIELD |
8184 #undef WRITE_BYTE_FIELD | 8175 #undef WRITE_BYTE_FIELD |
8185 #undef NOBARRIER_READ_BYTE_FIELD | 8176 #undef NOBARRIER_READ_BYTE_FIELD |
8186 #undef NOBARRIER_WRITE_BYTE_FIELD | 8177 #undef NOBARRIER_WRITE_BYTE_FIELD |
8187 | 8178 |
8188 } // namespace internal | 8179 } // namespace internal |
8189 } // namespace v8 | 8180 } // namespace v8 |
8190 | 8181 |
8191 #endif // V8_OBJECTS_INL_H_ | 8182 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |