| 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 4558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4569 ASSERT(current_block()->HasPredecessor()); | 4569 ASSERT(current_block()->HasPredecessor()); |
| 4570 return Bailout(kDebuggerStatement); | 4570 return Bailout(kDebuggerStatement); |
| 4571 } | 4571 } |
| 4572 | 4572 |
| 4573 | 4573 |
| 4574 void HOptimizedGraphBuilder::VisitCaseClause(CaseClause* clause) { | 4574 void HOptimizedGraphBuilder::VisitCaseClause(CaseClause* clause) { |
| 4575 UNREACHABLE(); | 4575 UNREACHABLE(); |
| 4576 } | 4576 } |
| 4577 | 4577 |
| 4578 | 4578 |
| 4579 static Handle<SharedFunctionInfo> SearchSharedFunctionInfo( | |
| 4580 Code* unoptimized_code, FunctionLiteral* expr) { | |
| 4581 int start_position = expr->start_position(); | |
| 4582 for (RelocIterator it(unoptimized_code); !it.done(); it.next()) { | |
| 4583 RelocInfo* rinfo = it.rinfo(); | |
| 4584 if (rinfo->rmode() != RelocInfo::EMBEDDED_OBJECT) continue; | |
| 4585 Object* obj = rinfo->target_object(); | |
| 4586 if (obj->IsSharedFunctionInfo()) { | |
| 4587 SharedFunctionInfo* shared = SharedFunctionInfo::cast(obj); | |
| 4588 if (shared->start_position() == start_position) { | |
| 4589 return Handle<SharedFunctionInfo>(shared); | |
| 4590 } | |
| 4591 } | |
| 4592 } | |
| 4593 | |
| 4594 return Handle<SharedFunctionInfo>(); | |
| 4595 } | |
| 4596 | |
| 4597 | |
| 4598 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { | 4579 void HOptimizedGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) { |
| 4599 ASSERT(!HasStackOverflow()); | 4580 ASSERT(!HasStackOverflow()); |
| 4600 ASSERT(current_block() != NULL); | 4581 ASSERT(current_block() != NULL); |
| 4601 ASSERT(current_block()->HasPredecessor()); | 4582 ASSERT(current_block()->HasPredecessor()); |
| 4602 Handle<SharedFunctionInfo> shared_info = | 4583 Handle<SharedFunctionInfo> shared_info = expr->shared_info(); |
| 4603 SearchSharedFunctionInfo(current_info()->shared_info()->code(), expr); | |
| 4604 if (shared_info.is_null()) { | 4584 if (shared_info.is_null()) { |
| 4605 shared_info = Compiler::BuildFunctionInfo(expr, current_info()->script()); | 4585 shared_info = Compiler::BuildFunctionInfo(expr, current_info()->script()); |
| 4606 } | 4586 } |
| 4607 // We also have a stack overflow if the recursive compilation did. | 4587 // We also have a stack overflow if the recursive compilation did. |
| 4608 if (HasStackOverflow()) return; | 4588 if (HasStackOverflow()) return; |
| 4609 HFunctionLiteral* instr = | 4589 HFunctionLiteral* instr = |
| 4610 New<HFunctionLiteral>(shared_info, expr->pretenure()); | 4590 New<HFunctionLiteral>(shared_info, expr->pretenure()); |
| 4611 return ast_context()->ReturnInstruction(instr, expr->id()); | 4591 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 4612 } | 4592 } |
| 4613 | 4593 |
| (...skipping 6199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10813 if (ShouldProduceTraceOutput()) { | 10793 if (ShouldProduceTraceOutput()) { |
| 10814 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10794 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 10815 } | 10795 } |
| 10816 | 10796 |
| 10817 #ifdef DEBUG | 10797 #ifdef DEBUG |
| 10818 graph_->Verify(false); // No full verify. | 10798 graph_->Verify(false); // No full verify. |
| 10819 #endif | 10799 #endif |
| 10820 } | 10800 } |
| 10821 | 10801 |
| 10822 } } // namespace v8::internal | 10802 } } // namespace v8::internal |
| OLD | NEW |