| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/disasm.h" | 10 #include "src/disasm.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 | 443 |
| 444 static int FindPatchAddressForReturnAddress(Code* code, int pc) { | 444 static int FindPatchAddressForReturnAddress(Code* code, int pc) { |
| 445 DeoptimizationInputData* input_data = | 445 DeoptimizationInputData* input_data = |
| 446 DeoptimizationInputData::cast(code->deoptimization_data()); | 446 DeoptimizationInputData::cast(code->deoptimization_data()); |
| 447 int patch_count = input_data->ReturnAddressPatchCount(); | 447 int patch_count = input_data->ReturnAddressPatchCount(); |
| 448 for (int i = 0; i < patch_count; i++) { | 448 for (int i = 0; i < patch_count; i++) { |
| 449 int return_pc = input_data->ReturnAddressPc(i)->value(); | 449 int return_pc = input_data->ReturnAddressPc(i)->value(); |
| 450 if (pc == return_pc) { | 450 int patch_pc = input_data->PatchedAddressPc(i)->value(); |
| 451 return input_data->PatchedAddressPc(i)->value(); | 451 // If the supplied pc matches the return pc or if the address |
| 452 // has been already patched, return the patch pc. |
| 453 if (pc == return_pc || pc == patch_pc) { |
| 454 return patch_pc; |
| 452 } | 455 } |
| 453 } | 456 } |
| 454 return -1; | 457 return -1; |
| 455 } | 458 } |
| 456 | 459 |
| 457 | 460 |
| 458 // For all marked Turbofanned code on stack, change the return address to go | 461 // For all marked Turbofanned code on stack, change the return address to go |
| 459 // to the deoptimization block. | 462 // to the deoptimization block. |
| 460 void Deoptimizer::PatchStackForMarkedCode(Isolate* isolate) { | 463 void Deoptimizer::PatchStackForMarkedCode(Isolate* isolate) { |
| 461 // TODO(jarin) We should tolerate missing patch entry for the topmost frame. | 464 // TODO(jarin) We should tolerate missing patch entry for the topmost frame. |
| (...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3673 } | 3676 } |
| 3674 | 3677 |
| 3675 | 3678 |
| 3676 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3679 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
| 3677 v->VisitPointer(BitCast<Object**>(&function_)); | 3680 v->VisitPointer(BitCast<Object**>(&function_)); |
| 3678 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3681 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
| 3679 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3682 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
| 3680 } | 3683 } |
| 3681 | 3684 |
| 3682 } } // namespace v8::internal | 3685 } } // namespace v8::internal |
| OLD | NEW |