OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 JavaScriptFrame* frame, | 109 JavaScriptFrame* frame, |
110 int frame_index, | 110 int frame_index, |
111 Isolate* isolate) { | 111 Isolate* isolate) { |
112 ASSERT(isolate == Isolate::Current()); | 112 ASSERT(isolate == Isolate::Current()); |
113 ASSERT(frame->is_optimized()); | 113 ASSERT(frame->is_optimized()); |
114 ASSERT(isolate->deoptimizer_data()->deoptimized_frame_info_ == NULL); | 114 ASSERT(isolate->deoptimizer_data()->deoptimized_frame_info_ == NULL); |
115 | 115 |
116 // Get the function and code from the frame. | 116 // Get the function and code from the frame. |
117 JSFunction* function = JSFunction::cast(frame->function()); | 117 JSFunction* function = JSFunction::cast(frame->function()); |
118 Code* code = frame->LookupCode(); | 118 Code* code = frame->LookupCode(); |
119 Address code_start_address = code->instruction_start(); | |
120 | 119 |
121 // Locate the deoptimization point in the code. As we are at a call the | 120 // Locate the deoptimization point in the code. As we are at a call the |
122 // return address must be at a place in the code with deoptimization support. | 121 // return address must be at a place in the code with deoptimization support. |
123 int deoptimization_index = Safepoint::kNoDeoptimizationIndex; | 122 SafepointEntry safepoint_entry = code->GetSafepointEntry(frame->pc()); |
124 // Scope this as the safe point constructor will disallow allocation. | 123 int deoptimization_index = safepoint_entry.deoptimization_index(); |
125 { | |
126 SafepointTable table(code); | |
127 for (unsigned i = 0; i < table.length(); ++i) { | |
128 Address address = code_start_address + table.GetPcOffset(i); | |
129 if (address == frame->pc()) { | |
130 SafepointEntry safepoint_entry = table.GetEntry(i); | |
131 ASSERT(safepoint_entry.deoptimization_index() != | |
132 Safepoint::kNoDeoptimizationIndex); | |
133 deoptimization_index = safepoint_entry.deoptimization_index(); | |
134 break; | |
135 } | |
136 } | |
137 } | |
138 ASSERT(deoptimization_index != Safepoint::kNoDeoptimizationIndex); | 124 ASSERT(deoptimization_index != Safepoint::kNoDeoptimizationIndex); |
139 | 125 |
140 // Always use the actual stack slots when calculating the fp to sp | 126 // Always use the actual stack slots when calculating the fp to sp |
141 // delta adding two for the function and context. | 127 // delta adding two for the function and context. |
142 unsigned stack_slots = code->stack_slots(); | 128 unsigned stack_slots = code->stack_slots(); |
143 unsigned fp_to_sp_delta = ((stack_slots + 2) * kPointerSize); | 129 unsigned fp_to_sp_delta = ((stack_slots + 2) * kPointerSize); |
144 | 130 |
145 Deoptimizer* deoptimizer = new Deoptimizer(isolate, | 131 Deoptimizer* deoptimizer = new Deoptimizer(isolate, |
146 function, | 132 function, |
147 Deoptimizer::DEBUGGER, | 133 Deoptimizer::DEBUGGER, |
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 | 1493 |
1508 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1494 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
1509 v->VisitPointer(BitCast<Object**>(&function_)); | 1495 v->VisitPointer(BitCast<Object**>(&function_)); |
1510 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1496 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
1511 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1497 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
1512 } | 1498 } |
1513 | 1499 |
1514 #endif // ENABLE_DEBUGGER_SUPPORT | 1500 #endif // ENABLE_DEBUGGER_SUPPORT |
1515 | 1501 |
1516 } } // namespace v8::internal | 1502 } } // namespace v8::internal |
OLD | NEW |