Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: src/objects.h

Issue 1010883002: Switch full-codegen from StackHandlers to handler table. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_cleanup-isolate-dead-code
Patch Set: Fix debugger-pause-on-promise-rejection. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 5961dc060f82ac581ccda19073d2375e2dfe9b34..26cf3964600080d3ddae3cf371b16687d66419d4 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) \
@@ -5062,6 +5063,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;
@@ -7344,11 +7410,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.
@@ -7365,9 +7426,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 };
« no previous file with comments | « src/isolate.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698