Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: src/hydrogen.cc

Issue 6913021: Tiny refactoring - change compilation phase parameter for CopyForInlining from a boolean to an enum. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reformat some line splitting. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4088 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 // Save the pending call context and type feedback oracle. Set up new ones 4099 // Save the pending call context and type feedback oracle. Set up new ones
4100 // for the inlined function. 4100 // for the inlined function.
4101 ASSERT(target_shared->has_deoptimization_support()); 4101 ASSERT(target_shared->has_deoptimization_support());
4102 TypeFeedbackOracle target_oracle( 4102 TypeFeedbackOracle target_oracle(
4103 Handle<Code>(target_shared->code()), 4103 Handle<Code>(target_shared->code()),
4104 Handle<Context>(target->context()->global_context())); 4104 Handle<Context>(target->context()->global_context()));
4105 FunctionState target_state(this, &target_info, &target_oracle); 4105 FunctionState target_state(this, &target_info, &target_oracle);
4106 4106
4107 HConstant* undefined = graph()->GetConstantUndefined(); 4107 HConstant* undefined = graph()->GetConstantUndefined();
4108 HEnvironment* inner_env = 4108 HEnvironment* inner_env =
4109 environment()->CopyForInlining(target, function, true, undefined); 4109 environment()->CopyForInlining(target,
4110 function,
4111 HEnvironment::HYDROGEN,
4112 undefined);
4110 HBasicBlock* body_entry = CreateBasicBlock(inner_env); 4113 HBasicBlock* body_entry = CreateBasicBlock(inner_env);
4111 current_block()->Goto(body_entry); 4114 current_block()->Goto(body_entry);
4112 4115
4113 body_entry->SetJoinId(expr->ReturnId()); 4116 body_entry->SetJoinId(expr->ReturnId());
4114 set_current_block(body_entry); 4117 set_current_block(body_entry);
4115 AddInstruction(new(zone()) HEnterInlined(target, function)); 4118 AddInstruction(new(zone()) HEnterInlined(target, function));
4116 VisitStatements(function->body()); 4119 VisitStatements(function->body());
4117 if (HasStackOverflow()) { 4120 if (HasStackOverflow()) {
4118 // Bail out if the inline function did, as we cannot residualize a call 4121 // Bail out if the inline function did, as we cannot residualize a call
4119 // instead. 4122 // instead.
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
5728 new_env->values_[i] = phi; 5731 new_env->values_[i] = phi;
5729 loop_header->AddPhi(phi); 5732 loop_header->AddPhi(phi);
5730 } 5733 }
5731 new_env->ClearHistory(); 5734 new_env->ClearHistory();
5732 return new_env; 5735 return new_env;
5733 } 5736 }
5734 5737
5735 5738
5736 HEnvironment* HEnvironment::CopyForInlining(Handle<JSFunction> target, 5739 HEnvironment* HEnvironment::CopyForInlining(Handle<JSFunction> target,
5737 FunctionLiteral* function, 5740 FunctionLiteral* function,
5738 bool is_speculative, 5741 CompilationPhase compilation_phase,
5739 HConstant* undefined) const { 5742 HConstant* undefined) const {
5740 // Outer environment is a copy of this one without the arguments. 5743 // Outer environment is a copy of this one without the arguments.
5741 int arity = function->scope()->num_parameters(); 5744 int arity = function->scope()->num_parameters();
5742 HEnvironment* outer = Copy(); 5745 HEnvironment* outer = Copy();
5743 outer->Drop(arity + 1); // Including receiver. 5746 outer->Drop(arity + 1); // Including receiver.
5744 outer->ClearHistory(); 5747 outer->ClearHistory();
5745 Zone* zone = closure()->GetIsolate()->zone(); 5748 Zone* zone = closure()->GetIsolate()->zone();
5746 HEnvironment* inner = 5749 HEnvironment* inner =
5747 new(zone) HEnvironment(outer, function->scope(), target); 5750 new(zone) HEnvironment(outer, function->scope(), target);
5748 // Get the argument values from the original environment. 5751 // Get the argument values from the original environment.
5749 if (is_speculative) { 5752 if (compilation_phase == HYDROGEN) {
5750 for (int i = 0; i <= arity; ++i) { // Include receiver. 5753 for (int i = 0; i <= arity; ++i) { // Include receiver.
5751 HValue* push = ExpressionStackAt(arity - i); 5754 HValue* push = ExpressionStackAt(arity - i);
5752 inner->SetValueAt(i, push); 5755 inner->SetValueAt(i, push);
5753 } 5756 }
5754 } else { 5757 } else {
5758 ASSERT(compilation_phase == LITHIUM);
5755 for (int i = 0; i <= arity; ++i) { // Include receiver. 5759 for (int i = 0; i <= arity; ++i) { // Include receiver.
5756 inner->SetValueAt(i, ExpressionStackAt(arity - i)); 5760 HValue* push = ExpressionStackAt(arity - i);
5761 inner->SetValueAt(i, push);
5757 } 5762 }
5758 } 5763 }
5759 5764
5760 // Initialize the stack-allocated locals to undefined. 5765 // Initialize the stack-allocated locals to undefined.
5761 int local_base = arity + 1; 5766 int local_base = arity + 1;
5762 int local_count = function->scope()->num_stack_slots(); 5767 int local_count = function->scope()->num_stack_slots();
5763 for (int i = 0; i < local_count; ++i) { 5768 for (int i = 0; i < local_count; ++i) {
5764 inner->SetValueAt(local_base + i, undefined); 5769 inner->SetValueAt(local_base + i, undefined);
5765 } 5770 }
5766 5771
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
6092 } 6097 }
6093 } 6098 }
6094 6099
6095 #ifdef DEBUG 6100 #ifdef DEBUG
6096 if (graph_ != NULL) graph_->Verify(); 6101 if (graph_ != NULL) graph_->Verify();
6097 if (allocator_ != NULL) allocator_->Verify(); 6102 if (allocator_ != NULL) allocator_->Verify();
6098 #endif 6103 #endif
6099 } 6104 }
6100 6105
6101 } } // namespace v8::internal 6106 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698