| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 JavaScriptFrame* frame, | 105 JavaScriptFrame* frame, |
| 106 int frame_index, | 106 int frame_index, |
| 107 Isolate* isolate) { | 107 Isolate* isolate) { |
| 108 ASSERT(isolate == Isolate::Current()); | 108 ASSERT(isolate == Isolate::Current()); |
| 109 ASSERT(frame->is_optimized()); | 109 ASSERT(frame->is_optimized()); |
| 110 ASSERT(isolate->deoptimizer_data()->deoptimized_frame_info_ == NULL); | 110 ASSERT(isolate->deoptimizer_data()->deoptimized_frame_info_ == NULL); |
| 111 | 111 |
| 112 // Get the function and code from the frame. | 112 // Get the function and code from the frame. |
| 113 JSFunction* function = JSFunction::cast(frame->function()); | 113 JSFunction* function = JSFunction::cast(frame->function()); |
| 114 Code* code = frame->LookupCode(); | 114 Code* code = frame->LookupCode(); |
| 115 Address code_start_address = code->instruction_start(); | |
| 116 | 115 |
| 117 // Locate the deoptimization point in the code. As we are at a call the | 116 // Locate the deoptimization point in the code. As we are at a call the |
| 118 // return address must be at a place in the code with deoptimization support. | 117 // return address must be at a place in the code with deoptimization support. |
| 119 int deoptimization_index = Safepoint::kNoDeoptimizationIndex; | 118 SafepointEntry safepoint_entry = code->GetSafepointEntry(frame->pc()); |
| 120 // Scope this as the safe point constructor will disallow allocation. | 119 int deoptimization_index = safepoint_entry.deoptimization_index(); |
| 121 { | |
| 122 SafepointTable table(code); | |
| 123 for (unsigned i = 0; i < table.length(); ++i) { | |
| 124 Address address = code_start_address + table.GetPcOffset(i); | |
| 125 if (address == frame->pc()) { | |
| 126 SafepointEntry safepoint_entry = table.GetEntry(i); | |
| 127 ASSERT(safepoint_entry.deoptimization_index() != | |
| 128 Safepoint::kNoDeoptimizationIndex); | |
| 129 deoptimization_index = safepoint_entry.deoptimization_index(); | |
| 130 break; | |
| 131 } | |
| 132 } | |
| 133 } | |
| 134 ASSERT(deoptimization_index != Safepoint::kNoDeoptimizationIndex); | 120 ASSERT(deoptimization_index != Safepoint::kNoDeoptimizationIndex); |
| 135 | 121 |
| 136 // Always use the actual stack slots when calculating the fp to sp | 122 // Always use the actual stack slots when calculating the fp to sp |
| 137 // delta adding two for the function and context. | 123 // delta adding two for the function and context. |
| 138 unsigned stack_slots = code->stack_slots(); | 124 unsigned stack_slots = code->stack_slots(); |
| 139 unsigned fp_to_sp_delta = ((stack_slots + 2) * kPointerSize); | 125 unsigned fp_to_sp_delta = ((stack_slots + 2) * kPointerSize); |
| 140 | 126 |
| 141 Deoptimizer* deoptimizer = new Deoptimizer(isolate, | 127 Deoptimizer* deoptimizer = new Deoptimizer(isolate, |
| 142 function, | 128 function, |
| 143 Deoptimizer::DEBUGGER, | 129 Deoptimizer::DEBUGGER, |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 | 1450 |
| 1465 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1451 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 1466 v->VisitPointer(BitCast<Object**>(&function_)); | 1452 v->VisitPointer(BitCast<Object**>(&function_)); |
| 1467 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1453 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 1468 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1454 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 1469 } | 1455 } |
| 1470 | 1456 |
| 1471 #endif // ENABLE_DEBUGGER_SUPPORT | 1457 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1472 | 1458 |
| 1473 } } // namespace v8::internal | 1459 } } // namespace v8::internal |
| OLD | NEW |