| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index a9c2439e61bbf077ad484031025d9fff7d03369e..24d41913dd8f33ecc8e6c498088cf9ee5bf36d18 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -4448,6 +4448,82 @@ class NormalizedMapCache: public FixedArray {
|
| void set(int index, Object* value);
|
| };
|
|
|
| +// HandlerTable is a fixed array containing entries for exception handlers in
|
| +// the code object it is associated with. The tables comes in two flavors:
|
| +// 1) Based on ranges: Used for unoptimized code. Contains one entry per
|
| +// exception handler and a range representing the try-block covered by that
|
| +// handler. Layout looks as follows:
|
| +// [ range-start , range-end , handler-offset , handler-data ]
|
| +// 2) Based on return addresses: Used for turbofanned code. Contains one entry
|
| +// per call-site that could throw an exception. Layout looks as follows:
|
| +// [ return-address-offset , handler-offset ]
|
| +class HandlerTable : public FixedArray {
|
| + public:
|
| + // Conservative prediction whether a given handler will locally catch an
|
| + // exception or cause a re-throw to outside the code boundary. Since this is
|
| + // undecidable it is merely an approximation (e.g. useful for debugger).
|
| + enum CatchPrediction {
|
| + UNCAUGHT, // the handler will (likely) rethrow the exception.
|
| + CAUGHT, // the exception will be caught by the handler.
|
| + PROMISE // the exception will be caught and cause a promise rejection.
|
| + };
|
| +
|
| + // Getters for handler table based on ranges.
|
| + inline int GetRangeStart(int index) const;
|
| + inline int GetRangeEnd(int index) const;
|
| + inline int GetRangeHandler(int index) const;
|
| + inline int GetRangeData(int index) const;
|
| +
|
| + // Setters for handler table based on ranges.
|
| + inline void SetRangeStart(int index, int value);
|
| + inline void SetRangeEnd(int index, int value);
|
| + inline void SetRangeHandler(int index, int offset, CatchPrediction pred);
|
| + inline void SetRangeData(int index, int value);
|
| +
|
| + // Setters for handler table based on return addresses.
|
| + inline void SetReturnOffset(int index, int value);
|
| + inline void SetReturnHandler(int index, int offset, CatchPrediction pred);
|
| +
|
| + // Lookup handler in a table based on ranges.
|
| + int LookupRange(int pc_offset, int* data, CatchPrediction* prediction);
|
| +
|
| + // Lookup handler in a table based on return addresses.
|
| + int LookupReturn(int pc_offset);
|
| +
|
| + // Returns the conservative catch predication.
|
| + inline CatchPrediction GetRangePrediction(int index) const;
|
| +
|
| + // Returns the number of entries in the table.
|
| + inline int NumberOfRangeEntries() const;
|
| +
|
| + // Returns the required length of the underlying fixed array.
|
| + static int LengthForRange(int entries) { return entries * kRangeEntrySize; }
|
| + static int LengthForReturn(int entries) { return entries * kReturnEntrySize; }
|
| +
|
| + DECLARE_CAST(HandlerTable)
|
| +
|
| +#ifdef ENABLE_DISASSEMBLER
|
| + void HandlerTableRangePrint(std::ostream& os); // NOLINT
|
| + void HandlerTableReturnPrint(std::ostream& os); // NOLINT
|
| +#endif
|
| +
|
| + private:
|
| + // Layout description for handler table based on ranges.
|
| + static const int kRangeStartIndex = 0;
|
| + static const int kRangeEndIndex = 1;
|
| + static const int kRangeHandlerIndex = 2;
|
| + static const int kRangeDataIndex = 3;
|
| + static const int kRangeEntrySize = 4;
|
| +
|
| + // Layout description for handler table based on return addresses.
|
| + static const int kReturnOffsetIndex = 0;
|
| + static const int kReturnHandlerIndex = 1;
|
| + static const int kReturnEntrySize = 2;
|
| +
|
| + // Encoding of the {handler} field.
|
| + class HandlerPredictionField : public BitField<CatchPrediction, 0, 2> {};
|
| + class HandlerOffsetField : public BitField<int, 2, 30> {};
|
| +};
|
|
|
| // ByteArray represents fixed sized byte arrays. Used for the relocation info
|
| // that is attached to code objects.
|
| @@ -4571,6 +4647,9 @@ class BytecodeArray : public FixedArrayBase {
|
|
|
| void CopyBytecodesTo(BytecodeArray* to);
|
|
|
| + int LookupRangeInHandlerTable(int code_offset, int* data,
|
| + HandlerTable::CatchPrediction* prediction);
|
| +
|
| // Layout description.
|
| static const int kConstantPoolOffset = FixedArrayBase::kHeaderSize;
|
| static const int kHandlerTableOffset = kConstantPoolOffset + kPointerSize;
|
| @@ -4878,83 +4957,6 @@ class LiteralsArray : public FixedArray {
|
| };
|
|
|
|
|
| -// HandlerTable is a fixed array containing entries for exception handlers in
|
| -// the code object it is associated with. The tables comes in two flavors:
|
| -// 1) Based on ranges: Used for unoptimized code. Contains one entry per
|
| -// exception handler and a range representing the try-block covered by that
|
| -// handler. Layout looks as follows:
|
| -// [ range-start , range-end , handler-offset , handler-data ]
|
| -// 2) Based on return addresses: Used for turbofanned code. Contains one entry
|
| -// per call-site that could throw an exception. Layout looks as follows:
|
| -// [ return-address-offset , handler-offset ]
|
| -class HandlerTable : public FixedArray {
|
| - public:
|
| - // Conservative prediction whether a given handler will locally catch an
|
| - // exception or cause a re-throw to outside the code boundary. Since this is
|
| - // undecidable it is merely an approximation (e.g. useful for debugger).
|
| - enum CatchPrediction {
|
| - UNCAUGHT, // the handler will (likely) rethrow the exception.
|
| - CAUGHT, // the exception will be caught by the handler.
|
| - PROMISE // the exception will be caught and cause a promise rejection.
|
| - };
|
| -
|
| - // Getters for handler table based on ranges.
|
| - inline int GetRangeStart(int index) const;
|
| - inline int GetRangeEnd(int index) const;
|
| - inline int GetRangeHandler(int index) const;
|
| - inline int GetRangeData(int index) const;
|
| -
|
| - // Setters for handler table based on ranges.
|
| - inline void SetRangeStart(int index, int value);
|
| - inline void SetRangeEnd(int index, int value);
|
| - inline void SetRangeHandler(int index, int offset, CatchPrediction pred);
|
| - inline void SetRangeData(int index, int value);
|
| -
|
| - // Setters for handler table based on return addresses.
|
| - inline void SetReturnOffset(int index, int value);
|
| - inline void SetReturnHandler(int index, int offset, CatchPrediction pred);
|
| -
|
| - // Lookup handler in a table based on ranges.
|
| - int LookupRange(int pc_offset, int* data, CatchPrediction* prediction);
|
| -
|
| - // Lookup handler in a table based on return addresses.
|
| - int LookupReturn(int pc_offset, CatchPrediction* prediction);
|
| -
|
| - // Returns the conservative catch predication.
|
| - inline CatchPrediction GetRangePrediction(int index) const;
|
| -
|
| - // Returns the number of entries in the table.
|
| - inline int NumberOfRangeEntries() const;
|
| -
|
| - // Returns the required length of the underlying fixed array.
|
| - static int LengthForRange(int entries) { return entries * kRangeEntrySize; }
|
| - static int LengthForReturn(int entries) { return entries * kReturnEntrySize; }
|
| -
|
| - DECLARE_CAST(HandlerTable)
|
| -
|
| -#ifdef ENABLE_DISASSEMBLER
|
| - void HandlerTableRangePrint(std::ostream& os); // NOLINT
|
| - void HandlerTableReturnPrint(std::ostream& os); // NOLINT
|
| -#endif
|
| -
|
| - private:
|
| - // Layout description for handler table based on ranges.
|
| - static const int kRangeStartIndex = 0;
|
| - static const int kRangeEndIndex = 1;
|
| - static const int kRangeHandlerIndex = 2;
|
| - static const int kRangeDataIndex = 3;
|
| - static const int kRangeEntrySize = 4;
|
| -
|
| - // Layout description for handler table based on return addresses.
|
| - static const int kReturnOffsetIndex = 0;
|
| - static const int kReturnHandlerIndex = 1;
|
| - static const int kReturnEntrySize = 2;
|
| -
|
| - // Encoding of the {handler} field.
|
| - class HandlerPredictionField : public BitField<CatchPrediction, 0, 2> {};
|
| - class HandlerOffsetField : public BitField<int, 2, 30> {};
|
| -};
|
| -
|
| class TemplateList : public FixedArray {
|
| public:
|
| static Handle<TemplateList> New(Isolate* isolate, int size);
|
| @@ -5341,6 +5343,9 @@ class Code: public HeapObject {
|
| BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
|
| uint32_t TranslateAstIdToPcOffset(BailoutId ast_id);
|
|
|
| + int LookupRangeInHandlerTable(int code_offset, int* data,
|
| + HandlerTable::CatchPrediction* prediction);
|
| +
|
| #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
|
| enum Age {
|
| kToBeExecutedOnceCodeAge = -3,
|
| @@ -5554,6 +5559,10 @@ class AbstractCode : public HeapObject {
|
| // Return the source position table.
|
| inline ByteArray* source_position_table();
|
|
|
| + // Return the exception handler table.
|
| + inline int LookupRangeInHandlerTable(
|
| + int code_offset, int* data, HandlerTable::CatchPrediction* prediction);
|
| +
|
| // Returns the size of instructions and the metadata.
|
| inline int SizeIncludingMetadata();
|
|
|
|
|