OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5164 // undecidable it is merely an approximation (e.g. useful for debugger). | 5164 // undecidable it is merely an approximation (e.g. useful for debugger). |
5165 enum CatchPrediction { UNCAUGHT, CAUGHT }; | 5165 enum CatchPrediction { UNCAUGHT, CAUGHT }; |
5166 | 5166 |
5167 // Accessors for handler table based on ranges. | 5167 // Accessors for handler table based on ranges. |
5168 void SetRangeStart(int index, int value) { | 5168 void SetRangeStart(int index, int value) { |
5169 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); | 5169 set(index * kRangeEntrySize + kRangeStartIndex, Smi::FromInt(value)); |
5170 } | 5170 } |
5171 void SetRangeEnd(int index, int value) { | 5171 void SetRangeEnd(int index, int value) { |
5172 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); | 5172 set(index * kRangeEntrySize + kRangeEndIndex, Smi::FromInt(value)); |
5173 } | 5173 } |
5174 void SetRangeHandler(int index, int value) { | 5174 void SetRangeHandler(int index, int offset, CatchPrediction prediction) { |
| 5175 int value = HandlerOffsetField::encode(offset) | |
| 5176 HandlerPredictionField::encode(prediction); |
5175 set(index * kRangeEntrySize + kRangeHandlerIndex, Smi::FromInt(value)); | 5177 set(index * kRangeEntrySize + kRangeHandlerIndex, Smi::FromInt(value)); |
5176 } | 5178 } |
5177 void SetRangeDepth(int index, int value) { | 5179 void SetRangeDepth(int index, int value) { |
5178 set(index * kRangeEntrySize + kRangeDepthIndex, Smi::FromInt(value)); | 5180 set(index * kRangeEntrySize + kRangeDepthIndex, Smi::FromInt(value)); |
5179 } | 5181 } |
5180 | 5182 |
5181 // Accessors for handler table based on return addresses. | 5183 // Accessors for handler table based on return addresses. |
5182 void SetReturnOffset(int index, int value) { | 5184 void SetReturnOffset(int index, int value) { |
5183 set(index * kReturnEntrySize + kReturnOffsetIndex, Smi::FromInt(value)); | 5185 set(index * kReturnEntrySize + kReturnOffsetIndex, Smi::FromInt(value)); |
5184 } | 5186 } |
5185 void SetReturnHandler(int index, int offset, CatchPrediction prediction) { | 5187 void SetReturnHandler(int index, int offset, CatchPrediction prediction) { |
5186 int value = HandlerOffsetField::encode(offset) | | 5188 int value = HandlerOffsetField::encode(offset) | |
5187 HandlerPredictionField::encode(prediction); | 5189 HandlerPredictionField::encode(prediction); |
5188 set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value)); | 5190 set(index * kReturnEntrySize + kReturnHandlerIndex, Smi::FromInt(value)); |
5189 } | 5191 } |
5190 | 5192 |
5191 // Lookup handler in a table based on ranges. | 5193 // Lookup handler in a table based on ranges. |
5192 int LookupRange(int pc_offset, int* stack_depth); | 5194 int LookupRange(int pc_offset, int* stack_depth, CatchPrediction* prediction); |
5193 | 5195 |
5194 // Lookup handler in a table based on return addresses. | 5196 // Lookup handler in a table based on return addresses. |
5195 int LookupReturn(int pc_offset, CatchPrediction* prediction); | 5197 int LookupReturn(int pc_offset, CatchPrediction* prediction); |
5196 | 5198 |
5197 // Returns the required length of the underlying fixed array. | 5199 // Returns the required length of the underlying fixed array. |
5198 static int LengthForRange(int entries) { return entries * kRangeEntrySize; } | 5200 static int LengthForRange(int entries) { return entries * kRangeEntrySize; } |
5199 static int LengthForReturn(int entries) { return entries * kReturnEntrySize; } | 5201 static int LengthForReturn(int entries) { return entries * kReturnEntrySize; } |
5200 | 5202 |
5201 DECLARE_CAST(HandlerTable) | 5203 DECLARE_CAST(HandlerTable) |
5202 | 5204 |
(...skipping 5985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11188 } else { | 11190 } else { |
11189 value &= ~(1 << bit_position); | 11191 value &= ~(1 << bit_position); |
11190 } | 11192 } |
11191 return value; | 11193 return value; |
11192 } | 11194 } |
11193 }; | 11195 }; |
11194 | 11196 |
11195 } } // namespace v8::internal | 11197 } } // namespace v8::internal |
11196 | 11198 |
11197 #endif // V8_OBJECTS_H_ | 11199 #endif // V8_OBJECTS_H_ |
OLD | NEW |