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 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3821 set_current_block(join); | 3821 set_current_block(join); |
3822 if (join->HasPredecessor()) { | 3822 if (join->HasPredecessor()) { |
3823 join->SetJoinId(expr->id()); | 3823 join->SetJoinId(expr->id()); |
3824 if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop()); | 3824 if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop()); |
3825 } | 3825 } |
3826 } | 3826 } |
3827 | 3827 |
3828 | 3828 |
3829 void HGraphBuilder::TraceInline(Handle<JSFunction> target, const char* reason) { | 3829 void HGraphBuilder::TraceInline(Handle<JSFunction> target, const char* reason) { |
3830 if (FLAG_trace_inlining) { | 3830 if (FLAG_trace_inlining) { |
3831 SmartPointer<char> callee = target->shared()->DebugName()->ToCString(); | |
3832 SmartPointer<char> caller = | |
3833 info()->function()->debug_name()->ToCString(); | |
3834 if (reason == NULL) { | 3831 if (reason == NULL) { |
| 3832 // We are currently in the context of inlined function thus we have |
| 3833 // to go to an outer FunctionState to get caller. |
| 3834 SmartPointer<char> callee = target->shared()->DebugName()->ToCString(); |
| 3835 SmartPointer<char> caller = |
| 3836 function_state()->outer()->compilation_info()->function()-> |
| 3837 debug_name()->ToCString(); |
3835 PrintF("Inlined %s called from %s.\n", *callee, *caller); | 3838 PrintF("Inlined %s called from %s.\n", *callee, *caller); |
3836 } else { | 3839 } else { |
| 3840 SmartPointer<char> callee = target->shared()->DebugName()->ToCString(); |
| 3841 SmartPointer<char> caller = |
| 3842 info()->function()->debug_name()->ToCString(); |
3837 PrintF("Did not inline %s called from %s (%s).\n", | 3843 PrintF("Did not inline %s called from %s (%s).\n", |
3838 *callee, *caller, reason); | 3844 *callee, *caller, reason); |
3839 } | 3845 } |
3840 } | 3846 } |
3841 } | 3847 } |
3842 | 3848 |
3843 | 3849 |
3844 bool HGraphBuilder::TryInline(Call* expr) { | 3850 bool HGraphBuilder::TryInline(Call* expr) { |
3845 if (!FLAG_use_inlining) return false; | 3851 if (!FLAG_use_inlining) return false; |
3846 | 3852 |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5086 | 5092 |
5087 void HGraphBuilder::GenerateIsStringWrapperSafeForDefaultValueOf( | 5093 void HGraphBuilder::GenerateIsStringWrapperSafeForDefaultValueOf( |
5088 CallRuntime* call) { | 5094 CallRuntime* call) { |
5089 BAILOUT("inlined runtime function: IsStringWrapperSafeForDefaultValueOf"); | 5095 BAILOUT("inlined runtime function: IsStringWrapperSafeForDefaultValueOf"); |
5090 } | 5096 } |
5091 | 5097 |
5092 | 5098 |
5093 // Support for construct call checks. | 5099 // Support for construct call checks. |
5094 void HGraphBuilder::GenerateIsConstructCall(CallRuntime* call) { | 5100 void HGraphBuilder::GenerateIsConstructCall(CallRuntime* call) { |
5095 ASSERT(call->arguments()->length() == 0); | 5101 ASSERT(call->arguments()->length() == 0); |
5096 ast_context()->ReturnInstruction(new HIsConstructCall, call->id()); | 5102 if (function_state()->outer() != NULL) { |
| 5103 // We are generating graph for inlined function. Currently |
| 5104 // constructor inlining is not supported and we can just return |
| 5105 // false from %_IsConstructCall(). |
| 5106 ast_context()->ReturnValue(graph()->GetConstantFalse()); |
| 5107 } else { |
| 5108 ast_context()->ReturnInstruction(new HIsConstructCall, call->id()); |
| 5109 } |
5097 } | 5110 } |
5098 | 5111 |
5099 | 5112 |
5100 // Support for arguments.length and arguments[?]. | 5113 // Support for arguments.length and arguments[?]. |
5101 void HGraphBuilder::GenerateArgumentsLength(CallRuntime* call) { | 5114 void HGraphBuilder::GenerateArgumentsLength(CallRuntime* call) { |
5102 ASSERT(call->arguments()->length() == 0); | 5115 ASSERT(call->arguments()->length() == 0); |
5103 HInstruction* elements = AddInstruction(new HArgumentsElements); | 5116 HInstruction* elements = AddInstruction(new HArgumentsElements); |
5104 HArgumentsLength* result = new HArgumentsLength(elements); | 5117 HArgumentsLength* result = new HArgumentsLength(elements); |
5105 ast_context()->ReturnInstruction(result, call->id()); | 5118 ast_context()->ReturnInstruction(result, call->id()); |
5106 } | 5119 } |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5891 } | 5904 } |
5892 } | 5905 } |
5893 | 5906 |
5894 #ifdef DEBUG | 5907 #ifdef DEBUG |
5895 if (graph_ != NULL) graph_->Verify(); | 5908 if (graph_ != NULL) graph_->Verify(); |
5896 if (allocator_ != NULL) allocator_->Verify(); | 5909 if (allocator_ != NULL) allocator_->Verify(); |
5897 #endif | 5910 #endif |
5898 } | 5911 } |
5899 | 5912 |
5900 } } // namespace v8::internal | 5913 } } // namespace v8::internal |
OLD | NEW |