| 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/assert-scope.h" | 10 #include "src/assert-scope.h" |
| (...skipping 4842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4853 // handler. Layout looks as follows: | 4853 // handler. Layout looks as follows: |
| 4854 // [ range-start , range-end , handler-offset , handler-data ] | 4854 // [ range-start , range-end , handler-offset , handler-data ] |
| 4855 // 2) Based on return addresses: Used for turbofanned code. Contains one entry | 4855 // 2) Based on return addresses: Used for turbofanned code. Contains one entry |
| 4856 // per call-site that could throw an exception. Layout looks as follows: | 4856 // per call-site that could throw an exception. Layout looks as follows: |
| 4857 // [ return-address-offset , handler-offset ] | 4857 // [ return-address-offset , handler-offset ] |
| 4858 class HandlerTable : public FixedArray { | 4858 class HandlerTable : public FixedArray { |
| 4859 public: | 4859 public: |
| 4860 // Conservative prediction whether a given handler will locally catch an | 4860 // Conservative prediction whether a given handler will locally catch an |
| 4861 // exception or cause a re-throw to outside the code boundary. Since this is | 4861 // exception or cause a re-throw to outside the code boundary. Since this is |
| 4862 // undecidable it is merely an approximation (e.g. useful for debugger). | 4862 // undecidable it is merely an approximation (e.g. useful for debugger). |
| 4863 enum CatchPrediction { UNCAUGHT, CAUGHT }; | 4863 enum CatchPrediction { |
| 4864 UNCAUGHT, // the handler will (likely) rethrow the exception. |
| 4865 CAUGHT, // the exception will be caught by the handler. |
| 4866 PROMISE // the exception will be caught and cause a promise rejection. |
| 4867 }; |
| 4864 | 4868 |
| 4865 // Getters for handler table based on ranges. | 4869 // Getters for handler table based on ranges. |
| 4866 inline int GetRangeStart(int index) const; | 4870 inline int GetRangeStart(int index) const; |
| 4867 inline int GetRangeEnd(int index) const; | 4871 inline int GetRangeEnd(int index) const; |
| 4868 inline int GetRangeHandler(int index) const; | 4872 inline int GetRangeHandler(int index) const; |
| 4869 inline int GetRangeData(int index) const; | 4873 inline int GetRangeData(int index) const; |
| 4870 | 4874 |
| 4871 // Setters for handler table based on ranges. | 4875 // Setters for handler table based on ranges. |
| 4872 inline void SetRangeStart(int index, int value); | 4876 inline void SetRangeStart(int index, int value); |
| 4873 inline void SetRangeEnd(int index, int value); | 4877 inline void SetRangeEnd(int index, int value); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4908 static const int kRangeHandlerIndex = 2; | 4912 static const int kRangeHandlerIndex = 2; |
| 4909 static const int kRangeDataIndex = 3; | 4913 static const int kRangeDataIndex = 3; |
| 4910 static const int kRangeEntrySize = 4; | 4914 static const int kRangeEntrySize = 4; |
| 4911 | 4915 |
| 4912 // Layout description for handler table based on return addresses. | 4916 // Layout description for handler table based on return addresses. |
| 4913 static const int kReturnOffsetIndex = 0; | 4917 static const int kReturnOffsetIndex = 0; |
| 4914 static const int kReturnHandlerIndex = 1; | 4918 static const int kReturnHandlerIndex = 1; |
| 4915 static const int kReturnEntrySize = 2; | 4919 static const int kReturnEntrySize = 2; |
| 4916 | 4920 |
| 4917 // Encoding of the {handler} field. | 4921 // Encoding of the {handler} field. |
| 4918 class HandlerPredictionField : public BitField<CatchPrediction, 0, 1> {}; | 4922 class HandlerPredictionField : public BitField<CatchPrediction, 0, 2> {}; |
| 4919 class HandlerOffsetField : public BitField<int, 1, 30> {}; | 4923 class HandlerOffsetField : public BitField<int, 2, 30> {}; |
| 4920 }; | 4924 }; |
| 4921 | 4925 |
| 4922 | 4926 |
| 4923 // Code describes objects with on-the-fly generated machine code. | 4927 // Code describes objects with on-the-fly generated machine code. |
| 4924 class Code: public HeapObject { | 4928 class Code: public HeapObject { |
| 4925 public: | 4929 public: |
| 4926 // Opaque data type for encapsulating code flags like kind, inline | 4930 // Opaque data type for encapsulating code flags like kind, inline |
| 4927 // cache state, and arguments count. | 4931 // cache state, and arguments count. |
| 4928 typedef uint32_t Flags; | 4932 typedef uint32_t Flags; |
| 4929 | 4933 |
| (...skipping 6059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10989 } | 10993 } |
| 10990 return value; | 10994 return value; |
| 10991 } | 10995 } |
| 10992 }; | 10996 }; |
| 10993 | 10997 |
| 10994 | 10998 |
| 10995 } // NOLINT, false-positive due to second-order macros. | 10999 } // NOLINT, false-positive due to second-order macros. |
| 10996 } // NOLINT, false-positive due to second-order macros. | 11000 } // NOLINT, false-positive due to second-order macros. |
| 10997 | 11001 |
| 10998 #endif // V8_OBJECTS_H_ | 11002 #endif // V8_OBJECTS_H_ |
| OLD | NEW |