| Index: src/objects.h
|
| diff --git a/src/objects.h b/src/objects.h
|
| index ab7778ffba5c302580064068085c476833b76cde..92a50979386c9aa353ecf9f7a5c34616a04465ba 100644
|
| --- a/src/objects.h
|
| +++ b/src/objects.h
|
| @@ -938,6 +938,7 @@ template <class C> inline bool Is(Object* obj);
|
| V(DeoptimizationInputData) \
|
| V(DeoptimizationOutputData) \
|
| V(DependentCode) \
|
| + V(HandlerTable) \
|
| V(FixedArray) \
|
| V(FixedDoubleArray) \
|
| V(WeakFixedArray) \
|
| @@ -4998,6 +4999,71 @@ class DeoptimizationOutputData: 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 , stack-depth ]
|
| +// 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:
|
| + // Accessors for handler table based on ranges.
|
| + void SetRangeStart(int index, int value) {
|
| + set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value));
|
| + }
|
| + void SetRangeEnd(int index, int value) {
|
| + set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value));
|
| + }
|
| + void SetRangeHandler(int index, int value) {
|
| + set(index * kRangeEntrySize + kRangeHandlerIndex, Smi::FromInt(value));
|
| + }
|
| + void SetRangeDepth(int index, int value) {
|
| + set(index * kRangeEntrySize + kRangeDepthIndex, Smi::FromInt(value));
|
| + }
|
| +
|
| + // Accessors for handler table based on return addresses.
|
| + void SetReturnOffset(int index, int value) {
|
| + set(index * kReturnEntrySize + kReturnOffsetIndex, Smi::FromInt(value));
|
| + }
|
| + void SetReturnHandler(int index, int value) {
|
| + set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value));
|
| + }
|
| +
|
| + // Lookup handler in a table based on ranges.
|
| + int LookupRange(int pc_offset, int* stack_depth);
|
| +
|
| + // Lookup handler in a table based on return addresses.
|
| + int LookupReturn(int pc_offset);
|
| +
|
| + // 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)
|
| +
|
| +#if defined(OBJECT_PRINT) || defined(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 kRangeDepthIndex = 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;
|
| +};
|
| +
|
| +
|
| // Forward declaration.
|
| class Cell;
|
| class PropertyCell;
|
| @@ -7280,11 +7346,6 @@ class JSGeneratorObject: public JSObject {
|
| // [operand_stack]: Saved operand stack.
|
| DECL_ACCESSORS(operand_stack, FixedArray)
|
|
|
| - // [stack_handler_index]: Index of first stack handler in operand_stack, or -1
|
| - // if the captured activation had no stack handler.
|
| - inline int stack_handler_index() const;
|
| - inline void set_stack_handler_index(int stack_handler_index);
|
| -
|
| DECLARE_CAST(JSGeneratorObject)
|
|
|
| // Dispatched behavior.
|
| @@ -7301,9 +7362,7 @@ class JSGeneratorObject: public JSObject {
|
| static const int kReceiverOffset = kContextOffset + kPointerSize;
|
| static const int kContinuationOffset = kReceiverOffset + kPointerSize;
|
| static const int kOperandStackOffset = kContinuationOffset + kPointerSize;
|
| - static const int kStackHandlerIndexOffset =
|
| - kOperandStackOffset + kPointerSize;
|
| - static const int kSize = kStackHandlerIndexOffset + kPointerSize;
|
| + static const int kSize = kOperandStackOffset + kPointerSize;
|
|
|
| // Resume mode, for use by runtime functions.
|
| enum ResumeMode { NEXT, THROW };
|
|
|