| 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 #include "src/frames.h" | 5 #include "src/frames.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 int offset = static_cast<int>(pc() - code_pointer->address()); | 754 int offset = static_cast<int>(pc() - code_pointer->address()); |
| 755 FrameSummary summary(receiver(), | 755 FrameSummary summary(receiver(), |
| 756 function(), | 756 function(), |
| 757 code_pointer, | 757 code_pointer, |
| 758 offset, | 758 offset, |
| 759 IsConstructor()); | 759 IsConstructor()); |
| 760 functions->Add(summary); | 760 functions->Add(summary); |
| 761 } | 761 } |
| 762 | 762 |
| 763 | 763 |
| 764 int JavaScriptFrame::LookupExceptionHandlerInTable(int* stack_slots) { | 764 int JavaScriptFrame::LookupExceptionHandlerInTable( |
| 765 int* stack_slots, HandlerTable::CatchPrediction* prediction) { |
| 765 Code* code = LookupCode(); | 766 Code* code = LookupCode(); |
| 766 DCHECK(!code->is_optimized_code()); | 767 DCHECK(!code->is_optimized_code()); |
| 767 HandlerTable* table = HandlerTable::cast(code->handler_table()); | 768 HandlerTable* table = HandlerTable::cast(code->handler_table()); |
| 768 int pc_offset = static_cast<int>(pc() - code->entry()); | 769 int pc_offset = static_cast<int>(pc() - code->entry()); |
| 769 return table->LookupRange(pc_offset, stack_slots); | 770 return table->LookupRange(pc_offset, stack_slots, prediction); |
| 770 } | 771 } |
| 771 | 772 |
| 772 | 773 |
| 773 void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, Code* code, | 774 void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, Code* code, |
| 774 Address pc, FILE* file, | 775 Address pc, FILE* file, |
| 775 bool print_line_number) { | 776 bool print_line_number) { |
| 776 PrintF(file, "%s", function->IsOptimized() ? "*" : "~"); | 777 PrintF(file, "%s", function->IsOptimized() ? "*" : "~"); |
| 777 function->PrintName(file); | 778 function->PrintName(file); |
| 778 int code_offset = static_cast<int>(pc - code->instruction_start()); | 779 int code_offset = static_cast<int>(pc - code->instruction_start()); |
| 779 PrintF(file, "+%d", code_offset); | 780 PrintF(file, "+%d", code_offset); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 is_constructor = true; | 971 is_constructor = true; |
| 971 } else { | 972 } else { |
| 972 // Skip over operands to advance to the next opcode. | 973 // Skip over operands to advance to the next opcode. |
| 973 it.Skip(Translation::NumberOfOperandsFor(opcode)); | 974 it.Skip(Translation::NumberOfOperandsFor(opcode)); |
| 974 } | 975 } |
| 975 } | 976 } |
| 976 DCHECK(!is_constructor); | 977 DCHECK(!is_constructor); |
| 977 } | 978 } |
| 978 | 979 |
| 979 | 980 |
| 980 int OptimizedFrame::LookupExceptionHandlerInTable(int* stack_slots) { | 981 int OptimizedFrame::LookupExceptionHandlerInTable( |
| 982 int* stack_slots, HandlerTable::CatchPrediction* prediction) { |
| 981 Code* code = LookupCode(); | 983 Code* code = LookupCode(); |
| 982 DCHECK(code->is_optimized_code()); | 984 DCHECK(code->is_optimized_code()); |
| 983 HandlerTable* table = HandlerTable::cast(code->handler_table()); | 985 HandlerTable* table = HandlerTable::cast(code->handler_table()); |
| 984 int pc_offset = static_cast<int>(pc() - code->entry()); | 986 int pc_offset = static_cast<int>(pc() - code->entry()); |
| 985 *stack_slots = code->stack_slots(); | 987 *stack_slots = code->stack_slots(); |
| 986 HandlerTable::CatchPrediction prediction; // TODO(yangguo): For debugger. | 988 return table->LookupReturn(pc_offset, prediction); |
| 987 return table->LookupReturn(pc_offset, &prediction); | |
| 988 } | 989 } |
| 989 | 990 |
| 990 | 991 |
| 991 DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData( | 992 DeoptimizationInputData* OptimizedFrame::GetDeoptimizationData( |
| 992 int* deopt_index) { | 993 int* deopt_index) { |
| 993 DCHECK(is_optimized()); | 994 DCHECK(is_optimized()); |
| 994 | 995 |
| 995 JSFunction* opt_function = function(); | 996 JSFunction* opt_function = function(); |
| 996 Code* code = opt_function->code(); | 997 Code* code = opt_function->code(); |
| 997 | 998 |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 ZoneList<StackFrame*> list(10, zone); | 1519 ZoneList<StackFrame*> list(10, zone); |
| 1519 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1520 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1520 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1521 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1521 list.Add(frame, zone); | 1522 list.Add(frame, zone); |
| 1522 } | 1523 } |
| 1523 return list.ToVector(); | 1524 return list.ToVector(); |
| 1524 } | 1525 } |
| 1525 | 1526 |
| 1526 | 1527 |
| 1527 } } // namespace v8::internal | 1528 } } // namespace v8::internal |
| OLD | NEW |