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 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2760 void HGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { | 2760 void HGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) { |
2761 BAILOUT("TryFinallyStatement"); | 2761 BAILOUT("TryFinallyStatement"); |
2762 } | 2762 } |
2763 | 2763 |
2764 | 2764 |
2765 void HGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { | 2765 void HGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) { |
2766 BAILOUT("DebuggerStatement"); | 2766 BAILOUT("DebuggerStatement"); |
2767 } | 2767 } |
2768 | 2768 |
2769 | 2769 |
| 2770 static Handle<SharedFunctionInfo> SearchSharedFunctionInfo( |
| 2771 Code* unoptimized_code, FunctionLiteral* expr) { |
| 2772 int start_position = expr->start_position(); |
| 2773 RelocIterator it(unoptimized_code); |
| 2774 for (;!it.done(); it.next()) { |
| 2775 RelocInfo* rinfo = it.rinfo(); |
| 2776 if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue; |
| 2777 Object* obj = rinfo->target_object(); |
| 2778 if (obj->IsSharedFunctionInfo()) { |
| 2779 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); |
| 2780 if (shared->start_position() == start_position) { |
| 2781 return Handle<SharedFunctionInfo>(shared); |
| 2782 } |
| 2783 } |
| 2784 } |
| 2785 |
| 2786 return Handle<SharedFunctionInfo>(); |
| 2787 } |
| 2788 |
| 2789 |
2770 void HGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 2790 void HGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
2771 Handle<SharedFunctionInfo> shared_info = | 2791 Handle<SharedFunctionInfo> shared_info = |
2772 Compiler::BuildFunctionInfo(expr, info()->script()); | 2792 SearchSharedFunctionInfo(info()->shared_info()->code(), |
| 2793 expr); |
| 2794 if (shared_info.is_null()) { |
| 2795 shared_info = Compiler::BuildFunctionInfo(expr, info()->script()); |
| 2796 } |
2773 CHECK_BAILOUT; | 2797 CHECK_BAILOUT; |
2774 HFunctionLiteral* instr = | 2798 HFunctionLiteral* instr = |
2775 new HFunctionLiteral(shared_info, expr->pretenure()); | 2799 new HFunctionLiteral(shared_info, expr->pretenure()); |
2776 ast_context()->ReturnInstruction(instr, expr->id()); | 2800 ast_context()->ReturnInstruction(instr, expr->id()); |
2777 } | 2801 } |
2778 | 2802 |
2779 | 2803 |
2780 void HGraphBuilder::VisitSharedFunctionInfoLiteral( | 2804 void HGraphBuilder::VisitSharedFunctionInfoLiteral( |
2781 SharedFunctionInfoLiteral* expr) { | 2805 SharedFunctionInfoLiteral* expr) { |
2782 BAILOUT("SharedFunctionInfoLiteral"); | 2806 BAILOUT("SharedFunctionInfoLiteral"); |
(...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5891 } | 5915 } |
5892 } | 5916 } |
5893 | 5917 |
5894 #ifdef DEBUG | 5918 #ifdef DEBUG |
5895 if (graph_ != NULL) graph_->Verify(); | 5919 if (graph_ != NULL) graph_->Verify(); |
5896 if (allocator_ != NULL) allocator_->Verify(); | 5920 if (allocator_ != NULL) allocator_->Verify(); |
5897 #endif | 5921 #endif |
5898 } | 5922 } |
5899 | 5923 |
5900 } } // namespace v8::internal | 5924 } } // namespace v8::internal |
OLD | NEW |