OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 Code* Deoptimizer::FindOptimizedCode(JSFunction* function, | 578 Code* Deoptimizer::FindOptimizedCode(JSFunction* function, |
579 Code* optimized_code) { | 579 Code* optimized_code) { |
580 switch (bailout_type_) { | 580 switch (bailout_type_) { |
581 case Deoptimizer::SOFT: | 581 case Deoptimizer::SOFT: |
582 case Deoptimizer::EAGER: | 582 case Deoptimizer::EAGER: |
583 case Deoptimizer::LAZY: { | 583 case Deoptimizer::LAZY: { |
584 Code* compiled_code = | 584 Code* compiled_code = |
585 isolate_->deoptimizer_data()->FindDeoptimizingCode(from_); | 585 isolate_->deoptimizer_data()->FindDeoptimizingCode(from_); |
586 return (compiled_code == NULL) | 586 return (compiled_code == NULL) |
587 ? static_cast<Code*>(isolate_->heap()->FindCodeObject(from_)) | 587 ? static_cast<Code*>(isolate_->FindCodeObject(from_)) |
588 : compiled_code; | 588 : compiled_code; |
589 } | 589 } |
590 case Deoptimizer::OSR: { | 590 case Deoptimizer::OSR: { |
591 // The function has already been optimized and we're transitioning | 591 // The function has already been optimized and we're transitioning |
592 // from the unoptimized shared version to the optimized one in the | 592 // from the unoptimized shared version to the optimized one in the |
593 // function. The return address (from_) points to unoptimized code. | 593 // function. The return address (from_) points to unoptimized code. |
594 Code* compiled_code = function->code(); | 594 Code* compiled_code = function->code(); |
595 ASSERT(compiled_code->kind() == Code::OPTIMIZED_FUNCTION); | 595 ASSERT(compiled_code->kind() == Code::OPTIMIZED_FUNCTION); |
596 ASSERT(!compiled_code->contains(from_)); | 596 ASSERT(!compiled_code->contains(from_)); |
597 return compiled_code; | 597 return compiled_code; |
(...skipping 2463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 int frame_index, | 3061 int frame_index, |
3062 bool has_arguments_adaptor, | 3062 bool has_arguments_adaptor, |
3063 bool has_construct_stub) { | 3063 bool has_construct_stub) { |
3064 FrameDescription* output_frame = deoptimizer->output_[frame_index]; | 3064 FrameDescription* output_frame = deoptimizer->output_[frame_index]; |
3065 function_ = output_frame->GetFunction(); | 3065 function_ = output_frame->GetFunction(); |
3066 has_construct_stub_ = has_construct_stub; | 3066 has_construct_stub_ = has_construct_stub; |
3067 expression_count_ = output_frame->GetExpressionCount(); | 3067 expression_count_ = output_frame->GetExpressionCount(); |
3068 expression_stack_ = new Object*[expression_count_]; | 3068 expression_stack_ = new Object*[expression_count_]; |
3069 // Get the source position using the unoptimized code. | 3069 // Get the source position using the unoptimized code. |
3070 Address pc = reinterpret_cast<Address>(output_frame->GetPc()); | 3070 Address pc = reinterpret_cast<Address>(output_frame->GetPc()); |
3071 Code* code = Code::cast(deoptimizer->isolate()->heap()->FindCodeObject(pc)); | 3071 Code* code = Code::cast(deoptimizer->isolate()->FindCodeObject(pc)); |
3072 source_position_ = code->SourcePosition(pc); | 3072 source_position_ = code->SourcePosition(pc); |
3073 | 3073 |
3074 for (int i = 0; i < expression_count_; i++) { | 3074 for (int i = 0; i < expression_count_; i++) { |
3075 SetExpression(i, output_frame->GetExpression(i)); | 3075 SetExpression(i, output_frame->GetExpression(i)); |
3076 } | 3076 } |
3077 | 3077 |
3078 if (has_arguments_adaptor) { | 3078 if (has_arguments_adaptor) { |
3079 output_frame = deoptimizer->output_[frame_index - 1]; | 3079 output_frame = deoptimizer->output_[frame_index - 1]; |
3080 ASSERT(output_frame->GetFrameType() == StackFrame::ARGUMENTS_ADAPTOR); | 3080 ASSERT(output_frame->GetFrameType() == StackFrame::ARGUMENTS_ADAPTOR); |
3081 } | 3081 } |
(...skipping 14 matching lines...) Expand all Loading... |
3096 | 3096 |
3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
3098 v->VisitPointer(BitCast<Object**>(&function_)); | 3098 v->VisitPointer(BitCast<Object**>(&function_)); |
3099 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 3099 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
3101 } | 3101 } |
3102 | 3102 |
3103 #endif // ENABLE_DEBUGGER_SUPPORT | 3103 #endif // ENABLE_DEBUGGER_SUPPORT |
3104 | 3104 |
3105 } } // namespace v8::internal | 3105 } } // namespace v8::internal |
OLD | NEW |