| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // Create the GC safe output frame information and register it for GC | 154 // Create the GC safe output frame information and register it for GC |
| 155 // handling. | 155 // handling. |
| 156 ASSERT_LT(frame_index, deoptimizer->output_count()); | 156 ASSERT_LT(frame_index, deoptimizer->output_count()); |
| 157 DeoptimizedFrameInfo* info = | 157 DeoptimizedFrameInfo* info = |
| 158 new DeoptimizedFrameInfo(deoptimizer, frame_index); | 158 new DeoptimizedFrameInfo(deoptimizer, frame_index); |
| 159 isolate->deoptimizer_data()->deoptimized_frame_info_ = info; | 159 isolate->deoptimizer_data()->deoptimized_frame_info_ = info; |
| 160 | 160 |
| 161 // Get the "simulated" top and size for the requested frame. | 161 // Get the "simulated" top and size for the requested frame. |
| 162 Address top = | 162 Address top = |
| 163 reinterpret_cast<Address>(deoptimizer->output_[frame_index]->GetTop()); | 163 reinterpret_cast<Address>(deoptimizer->output_[frame_index]->GetTop()); |
| 164 unsigned size = deoptimizer->output_[frame_index]->GetFrameSize(); | 164 uint32_t size = deoptimizer->output_[frame_index]->GetFrameSize(); |
| 165 | 165 |
| 166 // Done with the GC-unsafe frame descriptions. This re-enables allocation. | 166 // Done with the GC-unsafe frame descriptions. This re-enables allocation. |
| 167 deoptimizer->DeleteFrameDescriptions(); | 167 deoptimizer->DeleteFrameDescriptions(); |
| 168 | 168 |
| 169 // Allocate a heap number for the doubles belonging to this frame. | 169 // Allocate a heap number for the doubles belonging to this frame. |
| 170 deoptimizer->MaterializeHeapNumbersForDebuggerInspectableFrame( | 170 deoptimizer->MaterializeHeapNumbersForDebuggerInspectableFrame( |
| 171 top, size, info); | 171 top, size, info); |
| 172 | 172 |
| 173 // Finished using the deoptimizer instance. | 173 // Finished using the deoptimizer instance. |
| 174 delete deoptimizer; | 174 delete deoptimizer; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 d.slot_address()); | 539 d.slot_address()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 Memory::Object_at(d.slot_address()) = *num; | 542 Memory::Object_at(d.slot_address()) = *num; |
| 543 } | 543 } |
| 544 } | 544 } |
| 545 | 545 |
| 546 | 546 |
| 547 #ifdef ENABLE_DEBUGGER_SUPPORT | 547 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 548 void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame( | 548 void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame( |
| 549 Address top, intptr_t size, DeoptimizedFrameInfo* info) { | 549 Address top, uint32_t size, DeoptimizedFrameInfo* info) { |
| 550 ASSERT_EQ(DEBUGGER, bailout_type_); | 550 ASSERT_EQ(DEBUGGER, bailout_type_); |
| 551 for (int i = 0; i < deferred_heap_numbers_.length(); i++) { | 551 for (int i = 0; i < deferred_heap_numbers_.length(); i++) { |
| 552 HeapNumberMaterializationDescriptor d = deferred_heap_numbers_[i]; | 552 HeapNumberMaterializationDescriptor d = deferred_heap_numbers_[i]; |
| 553 | 553 |
| 554 // Check of the heap number to materialize actually belong to the frame | 554 // Check of the heap number to materialize actually belong to the frame |
| 555 // being extracted. | 555 // being extracted. |
| 556 Address slot = d.slot_address(); | 556 Address slot = d.slot_address(); |
| 557 if (top <= slot && slot < top + size) { | 557 if (top <= slot && slot < top + size) { |
| 558 Handle<Object> num = isolate_->factory()->NewNumber(d.value()); | 558 Handle<Object> num = isolate_->factory()->NewNumber(d.value()); |
| 559 // Calculate the index with the botton of the expression stack | 559 // Calculate the index with the botton of the expression stack |
| 560 // at index 0, and the fixed part (including incoming arguments) | 560 // at index 0, and the fixed part (including incoming arguments) |
| 561 // at negative indexes. | 561 // at negative indexes. |
| 562 int index = static_cast<int>( | 562 int index = static_cast<int>( |
| 563 info->expression_count_ - (slot - top) / kPointerSize - 1); | 563 info->expression_count_ - (slot - top) / kPointerSize - 1); |
| 564 if (FLAG_trace_deopt) { | 564 if (FLAG_trace_deopt) { |
| 565 PrintF("Materializing a new heap number %p [%e] in slot %p" | 565 PrintF("Materializing a new heap number %p [%e] in slot %p" |
| 566 "for stack index %d\n", | 566 "for stack index %d\n", |
| 567 reinterpret_cast<void*>(*num), | 567 reinterpret_cast<void*>(*num), |
| 568 d.value(), | 568 d.value(), |
| 569 d.slot_address(), | 569 d.slot_address(), |
| 570 index); | 570 index); |
| 571 } | 571 } |
| 572 if (index >=0) { | 572 if (index >=0) { |
| 573 info->SetExpression(index, *num); | 573 info->SetExpression(index, *num); |
| 574 } else { | 574 } else { |
| 575 // Calculate parameter index subtracting one for the receiver. | 575 // Calculate parameter index subtracting one for the receiver. |
| 576 int parameter_index = | 576 int parameter_index = |
| 577 index + size / kPointerSize - info->expression_count_ - 1; | 577 index + |
| 578 static_cast<int>(size) / kPointerSize - |
| 579 info->expression_count_ - 1; |
| 578 info->SetParameter(parameter_index, *num); | 580 info->SetParameter(parameter_index, *num); |
| 579 } | 581 } |
| 580 } | 582 } |
| 581 } | 583 } |
| 582 } | 584 } |
| 583 #endif | 585 #endif |
| 584 | 586 |
| 585 | 587 |
| 586 void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, | 588 void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, |
| 587 int frame_index, | 589 int frame_index, |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 } | 1461 } |
| 1460 | 1462 |
| 1461 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1463 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 1462 v->VisitPointer(reinterpret_cast<Object**>(&function_)); | 1464 v->VisitPointer(reinterpret_cast<Object**>(&function_)); |
| 1463 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1465 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 1464 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1466 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 1465 } | 1467 } |
| 1466 | 1468 |
| 1467 | 1469 |
| 1468 } } // namespace v8::internal | 1470 } } // namespace v8::internal |
| OLD | NEW |