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 3395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 | 3406 |
3407 void LiteralsArray::set_literal(int literal_index, Object* literal) { | 3407 void LiteralsArray::set_literal(int literal_index, Object* literal) { |
3408 set(kFirstLiteralIndex + literal_index, literal); | 3408 set(kFirstLiteralIndex + literal_index, literal); |
3409 } | 3409 } |
3410 | 3410 |
3411 | 3411 |
3412 int LiteralsArray::literals_count() const { | 3412 int LiteralsArray::literals_count() const { |
3413 return length() - kFirstLiteralIndex; | 3413 return length() - kFirstLiteralIndex; |
3414 } | 3414 } |
3415 | 3415 |
| 3416 int HandlerTable::GetRangeStart(int index) const { |
| 3417 return Smi::cast(get(index * kRangeEntrySize + kRangeStartIndex))->value(); |
| 3418 } |
| 3419 |
| 3420 int HandlerTable::GetRangeEnd(int index) const { |
| 3421 return Smi::cast(get(index * kRangeEntrySize + kRangeEndIndex))->value(); |
| 3422 } |
| 3423 |
| 3424 int HandlerTable::GetRangeHandler(int index) const { |
| 3425 return HandlerOffsetField::decode( |
| 3426 Smi::cast(get(index * kRangeEntrySize + kRangeHandlerIndex))->value()); |
| 3427 } |
3416 | 3428 |
3417 void HandlerTable::SetRangeStart(int index, int value) { | 3429 void HandlerTable::SetRangeStart(int index, int value) { |
3418 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 3430 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
3419 } | 3431 } |
3420 | 3432 |
3421 | 3433 |
3422 void HandlerTable::SetRangeEnd(int index, int value) { | 3434 void HandlerTable::SetRangeEnd(int index, int value) { |
3423 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); | 3435 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); |
3424 } | 3436 } |
3425 | 3437 |
(...skipping 16 matching lines...) Expand all Loading... |
3442 } | 3454 } |
3443 | 3455 |
3444 | 3456 |
3445 void HandlerTable::SetReturnHandler(int index, int offset, | 3457 void HandlerTable::SetReturnHandler(int index, int offset, |
3446 CatchPrediction prediction) { | 3458 CatchPrediction prediction) { |
3447 int value = HandlerOffsetField::encode(offset) | | 3459 int value = HandlerOffsetField::encode(offset) | |
3448 HandlerPredictionField::encode(prediction); | 3460 HandlerPredictionField::encode(prediction); |
3449 set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value)); | 3461 set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value)); |
3450 } | 3462 } |
3451 | 3463 |
| 3464 int HandlerTable::NumberOfRangeEntries() const { |
| 3465 return length() / kRangeEntrySize; |
| 3466 } |
3452 | 3467 |
3453 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) | 3468 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) |
3454 STRUCT_LIST(MAKE_STRUCT_CAST) | 3469 STRUCT_LIST(MAKE_STRUCT_CAST) |
3455 #undef MAKE_STRUCT_CAST | 3470 #undef MAKE_STRUCT_CAST |
3456 | 3471 |
3457 | 3472 |
3458 template <typename Derived, typename Shape, typename Key> | 3473 template <typename Derived, typename Shape, typename Key> |
3459 HashTable<Derived, Shape, Key>* | 3474 HashTable<Derived, Shape, Key>* |
3460 HashTable<Derived, Shape, Key>::cast(Object* obj) { | 3475 HashTable<Derived, Shape, Key>::cast(Object* obj) { |
3461 SLOW_DCHECK(obj->IsHashTable()); | 3476 SLOW_DCHECK(obj->IsHashTable()); |
(...skipping 4356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7818 #undef WRITE_INT64_FIELD | 7833 #undef WRITE_INT64_FIELD |
7819 #undef READ_BYTE_FIELD | 7834 #undef READ_BYTE_FIELD |
7820 #undef WRITE_BYTE_FIELD | 7835 #undef WRITE_BYTE_FIELD |
7821 #undef NOBARRIER_READ_BYTE_FIELD | 7836 #undef NOBARRIER_READ_BYTE_FIELD |
7822 #undef NOBARRIER_WRITE_BYTE_FIELD | 7837 #undef NOBARRIER_WRITE_BYTE_FIELD |
7823 | 7838 |
7824 } // namespace internal | 7839 } // namespace internal |
7825 } // namespace v8 | 7840 } // namespace v8 |
7826 | 7841 |
7827 #endif // V8_OBJECTS_INL_H_ | 7842 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |