OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 4737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4748 // 2) Based on return addresses: Used for turbofanned code. Contains one entry | 4748 // 2) Based on return addresses: Used for turbofanned code. Contains one entry |
4749 // per call-site that could throw an exception. Layout looks as follows: | 4749 // per call-site that could throw an exception. Layout looks as follows: |
4750 // [ return-address-offset , handler-offset ] | 4750 // [ return-address-offset , handler-offset ] |
4751 class HandlerTable : public FixedArray { | 4751 class HandlerTable : public FixedArray { |
4752 public: | 4752 public: |
4753 // Conservative prediction whether a given handler will locally catch an | 4753 // Conservative prediction whether a given handler will locally catch an |
4754 // exception or cause a re-throw to outside the code boundary. Since this is | 4754 // exception or cause a re-throw to outside the code boundary. Since this is |
4755 // undecidable it is merely an approximation (e.g. useful for debugger). | 4755 // undecidable it is merely an approximation (e.g. useful for debugger). |
4756 enum CatchPrediction { UNCAUGHT, CAUGHT }; | 4756 enum CatchPrediction { UNCAUGHT, CAUGHT }; |
4757 | 4757 |
4758 // Accessors for handler table based on ranges. | 4758 // Getters for handler table based on ranges. |
| 4759 inline int GetRangeStart(int index) const; |
| 4760 inline int GetRangeEnd(int index) const; |
| 4761 inline int GetRangeHandler(int index) const; |
| 4762 |
| 4763 // Setters for handler table based on ranges. |
4759 inline void SetRangeStart(int index, int value); | 4764 inline void SetRangeStart(int index, int value); |
4760 inline void SetRangeEnd(int index, int value); | 4765 inline void SetRangeEnd(int index, int value); |
4761 inline void SetRangeHandler(int index, int offset, CatchPrediction pred); | 4766 inline void SetRangeHandler(int index, int offset, CatchPrediction pred); |
4762 inline void SetRangeDepth(int index, int value); | 4767 inline void SetRangeDepth(int index, int value); |
4763 | 4768 |
4764 // Accessors for handler table based on return addresses. | 4769 // Setters for handler table based on return addresses. |
4765 inline void SetReturnOffset(int index, int value); | 4770 inline void SetReturnOffset(int index, int value); |
4766 inline void SetReturnHandler(int index, int offset, CatchPrediction pred); | 4771 inline void SetReturnHandler(int index, int offset, CatchPrediction pred); |
4767 | 4772 |
4768 // Lookup handler in a table based on ranges. | 4773 // Lookup handler in a table based on ranges. |
4769 int LookupRange(int pc_offset, int* stack_depth, CatchPrediction* prediction); | 4774 int LookupRange(int pc_offset, int* stack_depth, CatchPrediction* prediction); |
4770 | 4775 |
4771 // Lookup handler in a table based on return addresses. | 4776 // Lookup handler in a table based on return addresses. |
4772 int LookupReturn(int pc_offset, CatchPrediction* prediction); | 4777 int LookupReturn(int pc_offset, CatchPrediction* prediction); |
4773 | 4778 |
| 4779 // Returns the number of entries in the table. |
| 4780 inline int NumberOfRangeEntries() const; |
| 4781 |
4774 // Returns the required length of the underlying fixed array. | 4782 // Returns the required length of the underlying fixed array. |
4775 static int LengthForRange(int entries) { return entries * kRangeEntrySize; } | 4783 static int LengthForRange(int entries) { return entries * kRangeEntrySize; } |
4776 static int LengthForReturn(int entries) { return entries * kReturnEntrySize; } | 4784 static int LengthForReturn(int entries) { return entries * kReturnEntrySize; } |
4777 | 4785 |
4778 DECLARE_CAST(HandlerTable) | 4786 DECLARE_CAST(HandlerTable) |
4779 | 4787 |
4780 #ifdef ENABLE_DISASSEMBLER | 4788 #ifdef ENABLE_DISASSEMBLER |
4781 void HandlerTableRangePrint(std::ostream& os); // NOLINT | 4789 void HandlerTableRangePrint(std::ostream& os); // NOLINT |
4782 void HandlerTableReturnPrint(std::ostream& os); // NOLINT | 4790 void HandlerTableReturnPrint(std::ostream& os); // NOLINT |
4783 #endif | 4791 #endif |
(...skipping 5994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10778 } | 10786 } |
10779 return value; | 10787 return value; |
10780 } | 10788 } |
10781 }; | 10789 }; |
10782 | 10790 |
10783 | 10791 |
10784 } // NOLINT, false-positive due to second-order macros. | 10792 } // NOLINT, false-positive due to second-order macros. |
10785 } // NOLINT, false-positive due to second-order macros. | 10793 } // NOLINT, false-positive due to second-order macros. |
10786 | 10794 |
10787 #endif // V8_OBJECTS_H_ | 10795 #endif // V8_OBJECTS_H_ |
OLD | NEW |