Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index 161d3ecfaf36af29175c77fc2735f8f965207a7f..83b8d83c74c9f090eb5e3282dfb81ae44b31222e 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -982,12 +982,10 @@ int JavaScriptFrame::LookupExceptionHandlerInTable( |
int* stack_depth, HandlerTable::CatchPrediction* prediction) { |
Code* code = LookupCode(); |
DCHECK(!code->is_optimized_code()); |
- HandlerTable* table = HandlerTable::cast(code->handler_table()); |
int pc_offset = static_cast<int>(pc() - code->entry()); |
- return table->LookupRange(pc_offset, stack_depth, prediction); |
+ return code->LookupRangeInHandlerTable(pc_offset, stack_depth, prediction); |
} |
- |
void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, Code* code, |
Address pc, FILE* file, |
bool print_line_number) { |
@@ -1236,11 +1234,15 @@ void OptimizedFrame::Summarize(List<FrameSummary>* frames, |
int OptimizedFrame::LookupExceptionHandlerInTable( |
int* stack_slots, HandlerTable::CatchPrediction* prediction) { |
+ // We cannot perform exception prediction on optimized code. Instead, we need |
+ // to use FrameSummary to find the corresponding code offset in unoptimized |
+ // code to perform prediction there. |
+ DCHECK_NULL(prediction); |
Code* code = LookupCode(); |
HandlerTable* table = HandlerTable::cast(code->handler_table()); |
int pc_offset = static_cast<int>(pc() - code->entry()); |
if (stack_slots) *stack_slots = code->stack_slots(); |
- return table->LookupReturn(pc_offset, prediction); |
+ return table->LookupReturn(pc_offset); |
} |
@@ -1337,9 +1339,8 @@ Object* OptimizedFrame::StackSlotAt(int index) const { |
int InterpretedFrame::LookupExceptionHandlerInTable( |
int* context_register, HandlerTable::CatchPrediction* prediction) { |
BytecodeArray* bytecode = function()->shared()->bytecode_array(); |
- HandlerTable* table = HandlerTable::cast(bytecode->handler_table()); |
- int pc_offset = GetBytecodeOffset() + 1; // Point after current bytecode. |
- return table->LookupRange(pc_offset, context_register, prediction); |
+ return bytecode->LookupRangeInHandlerTable(GetBytecodeOffset(), |
+ context_register, prediction); |
} |
int InterpretedFrame::GetBytecodeOffset() const { |