5 #ifndef V8_HANDLER_TABLE_H_ 6 #define V8_HANDLER_TABLE_H_ 8 #include "src/assert-scope.h" 9 #include "src/globals.h" 10 #include "src/utils.h" 35 enum CatchPrediction {
55 int GetRangeStart(
int index)
const;
56 int GetRangeEnd(
int index)
const;
57 int GetRangeHandler(
int index)
const;
58 int GetRangeData(
int index)
const;
61 void SetRangeStart(
int index,
int value);
62 void SetRangeEnd(
int index,
int value);
63 void SetRangeHandler(
int index,
int offset, CatchPrediction pred);
64 void SetRangeData(
int index,
int value);
67 static int LengthForRange(
int entries);
70 static int EmitReturnTableStart(
Assembler* masm,
int entries);
71 static void EmitReturnEntry(
Assembler* masm,
int offset,
int handler);
76 int LookupRange(
int pc_offset,
int* data, CatchPrediction* prediction);
79 int LookupReturn(
int pc_offset);
82 int NumberOfRangeEntries()
const;
83 int NumberOfReturnEntries()
const;
85 #ifdef ENABLE_DISASSEMBLER 86 void HandlerTableRangePrint(std::ostream& os);
87 void HandlerTableReturnPrint(std::ostream& os);
91 enum EncodingMode { kRangeBasedEncoding, kReturnAddressBasedEncoding };
94 CatchPrediction GetRangePrediction(
int index)
const;
97 int GetReturnOffset(
int index)
const;
98 int GetReturnHandler(
int index)
const;
101 int number_of_entries_;
113 DISALLOW_HEAP_ALLOCATION(no_gc_);
116 static const int kRangeStartIndex = 0;
117 static const int kRangeEndIndex = 1;
118 static const int kRangeHandlerIndex = 2;
119 static const int kRangeDataIndex = 3;
120 static const int kRangeEntrySize = 4;
123 static const int kReturnOffsetIndex = 0;
124 static const int kReturnHandlerIndex = 1;
125 static const int kReturnEntrySize = 2;
128 class HandlerPredictionField :
public BitField<CatchPrediction, 0, 3> {};
129 class HandlerOffsetField :
public BitField<int, 3, 29> {};
135 #endif // V8_HANDLER_TABLE_H_