OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 end_ = end; | 160 end_ = end; |
161 for (HSuccessorIterator it(end); !it.Done(); it.Advance()) { | 161 for (HSuccessorIterator it(end); !it.Done(); it.Advance()) { |
162 it.Current()->RegisterPredecessor(this); | 162 it.Current()->RegisterPredecessor(this); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 void HBasicBlock::Goto(HBasicBlock* block, bool drop_extra) { | 167 void HBasicBlock::Goto(HBasicBlock* block, bool drop_extra) { |
168 if (block->IsInlineReturnTarget()) { | 168 if (block->IsInlineReturnTarget()) { |
169 AddInstruction(new(zone()) HLeaveInlined); | 169 AddInstruction(new(zone()) HLeaveInlined); |
170 last_environment_ = last_environment()->outer(); | 170 last_environment_ = last_environment()->DiscardInlined(drop_extra); |
171 if (drop_extra) last_environment_->Drop(1); | |
172 } | 171 } |
173 AddSimulate(AstNode::kNoNumber); | 172 AddSimulate(AstNode::kNoNumber); |
174 HGoto* instr = new(zone()) HGoto(block); | 173 HGoto* instr = new(zone()) HGoto(block); |
175 Finish(instr); | 174 Finish(instr); |
176 } | 175 } |
177 | 176 |
178 | 177 |
179 void HBasicBlock::AddLeaveInlined(HValue* return_value, | 178 void HBasicBlock::AddLeaveInlined(HValue* return_value, |
180 HBasicBlock* target, | 179 HBasicBlock* target, |
181 bool drop_extra) { | 180 bool drop_extra) { |
182 ASSERT(target->IsInlineReturnTarget()); | 181 ASSERT(target->IsInlineReturnTarget()); |
183 ASSERT(return_value != NULL); | 182 ASSERT(return_value != NULL); |
184 AddInstruction(new(zone()) HLeaveInlined); | 183 AddInstruction(new(zone()) HLeaveInlined); |
185 last_environment_ = last_environment()->outer(); | 184 last_environment_ = last_environment()->DiscardInlined(drop_extra); |
186 if (drop_extra) last_environment_->Drop(1); | |
187 last_environment()->Push(return_value); | 185 last_environment()->Push(return_value); |
188 AddSimulate(AstNode::kNoNumber); | 186 AddSimulate(AstNode::kNoNumber); |
189 HGoto* instr = new(zone()) HGoto(target); | 187 HGoto* instr = new(zone()) HGoto(target); |
190 Finish(instr); | 188 Finish(instr); |
191 } | 189 } |
192 | 190 |
193 | 191 |
194 void HBasicBlock::SetInitialEnvironment(HEnvironment* env) { | 192 void HBasicBlock::SetInitialEnvironment(HEnvironment* env) { |
195 ASSERT(!HasEnvironment()); | 193 ASSERT(!HasEnvironment()); |
196 ASSERT(first() == NULL); | 194 ASSERT(first() == NULL); |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 | 2067 |
2070 // Implementation of utility classes to represent an expression's context in | 2068 // Implementation of utility classes to represent an expression's context in |
2071 // the AST. | 2069 // the AST. |
2072 AstContext::AstContext(HGraphBuilder* owner, Expression::Context kind) | 2070 AstContext::AstContext(HGraphBuilder* owner, Expression::Context kind) |
2073 : owner_(owner), | 2071 : owner_(owner), |
2074 kind_(kind), | 2072 kind_(kind), |
2075 outer_(owner->ast_context()), | 2073 outer_(owner->ast_context()), |
2076 for_typeof_(false) { | 2074 for_typeof_(false) { |
2077 owner->set_ast_context(this); // Push. | 2075 owner->set_ast_context(this); // Push. |
2078 #ifdef DEBUG | 2076 #ifdef DEBUG |
| 2077 ASSERT(!owner->environment()->is_arguments_adaptor()); |
2079 original_length_ = owner->environment()->length(); | 2078 original_length_ = owner->environment()->length(); |
2080 #endif | 2079 #endif |
2081 } | 2080 } |
2082 | 2081 |
2083 | 2082 |
2084 AstContext::~AstContext() { | 2083 AstContext::~AstContext() { |
2085 owner_->set_ast_context(outer_); // Pop. | 2084 owner_->set_ast_context(outer_); // Pop. |
2086 } | 2085 } |
2087 | 2086 |
2088 | 2087 |
2089 EffectContext::~EffectContext() { | 2088 EffectContext::~EffectContext() { |
2090 ASSERT(owner()->HasStackOverflow() || | 2089 ASSERT(owner()->HasStackOverflow() || |
2091 owner()->current_block() == NULL || | 2090 owner()->current_block() == NULL || |
2092 owner()->environment()->length() == original_length_); | 2091 (owner()->environment()->length() == original_length_ && |
| 2092 !owner()->environment()->is_arguments_adaptor())); |
2093 } | 2093 } |
2094 | 2094 |
2095 | 2095 |
2096 ValueContext::~ValueContext() { | 2096 ValueContext::~ValueContext() { |
2097 ASSERT(owner()->HasStackOverflow() || | 2097 ASSERT(owner()->HasStackOverflow() || |
2098 owner()->current_block() == NULL || | 2098 owner()->current_block() == NULL || |
2099 owner()->environment()->length() == original_length_ + 1); | 2099 (owner()->environment()->length() == original_length_ + 1 && |
| 2100 !owner()->environment()->is_arguments_adaptor())); |
2100 } | 2101 } |
2101 | 2102 |
2102 | 2103 |
2103 void EffectContext::ReturnValue(HValue* value) { | 2104 void EffectContext::ReturnValue(HValue* value) { |
2104 // The value is simply ignored. | 2105 // The value is simply ignored. |
2105 } | 2106 } |
2106 | 2107 |
2107 | 2108 |
2108 void ValueContext::ReturnValue(HValue* value) { | 2109 void ValueContext::ReturnValue(HValue* value) { |
2109 // The value is tracked in the bailout environment, and communicated | 2110 // The value is tracked in the bailout environment, and communicated |
(...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4821 | 4822 |
4822 | 4823 |
4823 // Don't inline deeper than kMaxInliningLevels calls. | 4824 // Don't inline deeper than kMaxInliningLevels calls. |
4824 HEnvironment* env = environment(); | 4825 HEnvironment* env = environment(); |
4825 int current_level = 1; | 4826 int current_level = 1; |
4826 while (env->outer() != NULL) { | 4827 while (env->outer() != NULL) { |
4827 if (current_level == Compiler::kMaxInliningLevels) { | 4828 if (current_level == Compiler::kMaxInliningLevels) { |
4828 TraceInline(target, caller, "inline depth limit reached"); | 4829 TraceInline(target, caller, "inline depth limit reached"); |
4829 return false; | 4830 return false; |
4830 } | 4831 } |
4831 current_level++; | 4832 if (!env->outer()->is_arguments_adaptor()) { |
| 4833 current_level++; |
| 4834 } |
4832 env = env->outer(); | 4835 env = env->outer(); |
4833 } | 4836 } |
4834 | 4837 |
4835 // Don't inline recursive functions. | 4838 // Don't inline recursive functions. |
4836 for (FunctionState* state = function_state(); | 4839 for (FunctionState* state = function_state(); |
4837 state != NULL; | 4840 state != NULL; |
4838 state = state->outer()) { | 4841 state = state->outer()) { |
4839 if (state->compilation_info()->closure()->shared() == *target_shared) { | 4842 if (state->compilation_info()->closure()->shared() == *target_shared) { |
4840 TraceInline(target, caller, "target is recursive"); | 4843 TraceInline(target, caller, "target is recursive"); |
4841 return false; | 4844 return false; |
(...skipping 27 matching lines...) Expand all Loading... |
4869 } | 4872 } |
4870 FunctionLiteral* function = target_info.function(); | 4873 FunctionLiteral* function = target_info.function(); |
4871 | 4874 |
4872 // Count the number of AST nodes added by inlining this call. | 4875 // Count the number of AST nodes added by inlining this call. |
4873 int nodes_added = AstNode::Count() - count_before; | 4876 int nodes_added = AstNode::Count() - count_before; |
4874 if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) { | 4877 if (FLAG_limit_inlining && nodes_added > kMaxInlinedSize) { |
4875 TraceInline(target, caller, "target AST is too large"); | 4878 TraceInline(target, caller, "target AST is too large"); |
4876 return false; | 4879 return false; |
4877 } | 4880 } |
4878 | 4881 |
4879 // Don't inline functions that uses the arguments object or that | 4882 // Don't inline functions that uses the arguments object. |
4880 // have a mismatching number of parameters. | 4883 if (function->scope()->arguments() != NULL) { |
4881 int arity = expr->arguments()->length(); | |
4882 if (function->scope()->arguments() != NULL || | |
4883 arity != target_shared->formal_parameter_count()) { | |
4884 TraceInline(target, caller, "target requires special argument handling"); | 4884 TraceInline(target, caller, "target requires special argument handling"); |
4885 return false; | 4885 return false; |
4886 } | 4886 } |
4887 | 4887 |
4888 // All declarations must be inlineable. | 4888 // All declarations must be inlineable. |
4889 ZoneList<Declaration*>* decls = target_info.scope()->declarations(); | 4889 ZoneList<Declaration*>* decls = target_info.scope()->declarations(); |
4890 int decl_count = decls->length(); | 4890 int decl_count = decls->length(); |
4891 for (int i = 0; i < decl_count; ++i) { | 4891 for (int i = 0; i < decl_count; ++i) { |
4892 if (!decls->at(i)->IsInlineable()) { | 4892 if (!decls->at(i)->IsInlineable()) { |
4893 TraceInline(target, caller, "target has non-trivial declaration"); | 4893 TraceInline(target, caller, "target has non-trivial declaration"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4937 Handle<Context>(target->context()->global_context()), | 4937 Handle<Context>(target->context()->global_context()), |
4938 isolate()); | 4938 isolate()); |
4939 // The function state is new-allocated because we need to delete it | 4939 // The function state is new-allocated because we need to delete it |
4940 // in two different places. | 4940 // in two different places. |
4941 FunctionState* target_state = | 4941 FunctionState* target_state = |
4942 new FunctionState(this, &target_info, &target_oracle, drop_extra); | 4942 new FunctionState(this, &target_info, &target_oracle, drop_extra); |
4943 | 4943 |
4944 HConstant* undefined = graph()->GetConstantUndefined(); | 4944 HConstant* undefined = graph()->GetConstantUndefined(); |
4945 HEnvironment* inner_env = | 4945 HEnvironment* inner_env = |
4946 environment()->CopyForInlining(target, | 4946 environment()->CopyForInlining(target, |
| 4947 expr->arguments()->length(), |
4947 function, | 4948 function, |
4948 undefined, | 4949 undefined, |
4949 call_kind); | 4950 call_kind); |
4950 #ifdef V8_TARGET_ARCH_IA32 | 4951 #ifdef V8_TARGET_ARCH_IA32 |
4951 // IA32 only, overwrite the caller's context in the deoptimization | 4952 // IA32 only, overwrite the caller's context in the deoptimization |
4952 // environment with the correct one. | 4953 // environment with the correct one. |
4953 // | 4954 // |
4954 // TODO(kmillikin): implement the same inlining on other platforms so we | 4955 // TODO(kmillikin): implement the same inlining on other platforms so we |
4955 // can remove the unsightly ifdefs in this function. | 4956 // can remove the unsightly ifdefs in this function. |
4956 HConstant* context = new HConstant(Handle<Context>(target->context()), | 4957 HConstant* context = new HConstant(Handle<Context>(target->context()), |
4957 Representation::Tagged()); | 4958 Representation::Tagged()); |
4958 AddInstruction(context); | 4959 AddInstruction(context); |
4959 inner_env->BindContext(context); | 4960 inner_env->BindContext(context); |
4960 #endif | 4961 #endif |
4961 HBasicBlock* body_entry = CreateBasicBlock(inner_env); | 4962 HBasicBlock* body_entry = CreateBasicBlock(inner_env); |
4962 current_block()->Goto(body_entry); | 4963 current_block()->Goto(body_entry); |
4963 body_entry->SetJoinId(expr->ReturnId()); | 4964 body_entry->SetJoinId(expr->ReturnId()); |
4964 set_current_block(body_entry); | 4965 set_current_block(body_entry); |
4965 AddInstruction(new(zone()) HEnterInlined(target, | 4966 AddInstruction(new(zone()) HEnterInlined(target, |
| 4967 expr->arguments()->length(), |
4966 function, | 4968 function, |
4967 call_kind)); | 4969 call_kind)); |
4968 VisitDeclarations(target_info.scope()->declarations()); | 4970 VisitDeclarations(target_info.scope()->declarations()); |
4969 VisitStatements(function->body()); | 4971 VisitStatements(function->body()); |
4970 if (HasStackOverflow()) { | 4972 if (HasStackOverflow()) { |
4971 // Bail out if the inline function did, as we cannot residualize a call | 4973 // Bail out if the inline function did, as we cannot residualize a call |
4972 // instead. | 4974 // instead. |
4973 TraceInline(target, caller, "inline graph construction failed"); | 4975 TraceInline(target, caller, "inline graph construction failed"); |
4974 target_shared->DisableOptimization(*target); | 4976 target_shared->DisableOptimization(*target); |
4975 inline_bailout_ = true; | 4977 inline_bailout_ = true; |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6895 Handle<JSFunction> closure) | 6897 Handle<JSFunction> closure) |
6896 : closure_(closure), | 6898 : closure_(closure), |
6897 values_(0), | 6899 values_(0), |
6898 assigned_variables_(4), | 6900 assigned_variables_(4), |
6899 parameter_count_(0), | 6901 parameter_count_(0), |
6900 specials_count_(1), | 6902 specials_count_(1), |
6901 local_count_(0), | 6903 local_count_(0), |
6902 outer_(outer), | 6904 outer_(outer), |
6903 pop_count_(0), | 6905 pop_count_(0), |
6904 push_count_(0), | 6906 push_count_(0), |
6905 ast_id_(AstNode::kNoNumber) { | 6907 ast_id_(AstNode::kNoNumber), |
| 6908 arguments_adaptor_(false) { |
6906 Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0); | 6909 Initialize(scope->num_parameters() + 1, scope->num_stack_slots(), 0); |
6907 } | 6910 } |
6908 | 6911 |
6909 | 6912 |
6910 HEnvironment::HEnvironment(const HEnvironment* other) | 6913 HEnvironment::HEnvironment(const HEnvironment* other) |
6911 : values_(0), | 6914 : values_(0), |
6912 assigned_variables_(0), | 6915 assigned_variables_(0), |
6913 parameter_count_(0), | 6916 parameter_count_(0), |
6914 specials_count_(1), | 6917 specials_count_(1), |
6915 local_count_(0), | 6918 local_count_(0), |
6916 outer_(NULL), | 6919 outer_(NULL), |
6917 pop_count_(0), | 6920 pop_count_(0), |
6918 push_count_(0), | 6921 push_count_(0), |
6919 ast_id_(other->ast_id()) { | 6922 ast_id_(other->ast_id()), |
| 6923 arguments_adaptor_(false) { |
6920 Initialize(other); | 6924 Initialize(other); |
6921 } | 6925 } |
6922 | 6926 |
6923 | 6927 |
| 6928 HEnvironment::HEnvironment(HEnvironment* outer, |
| 6929 Handle<JSFunction> closure, |
| 6930 int arguments) |
| 6931 : closure_(closure), |
| 6932 values_(arguments), |
| 6933 assigned_variables_(0), |
| 6934 parameter_count_(arguments), |
| 6935 local_count_(0), |
| 6936 outer_(outer), |
| 6937 pop_count_(0), |
| 6938 push_count_(0), |
| 6939 ast_id_(AstNode::kNoNumber), |
| 6940 arguments_adaptor_(true) { |
| 6941 } |
| 6942 |
| 6943 |
6924 void HEnvironment::Initialize(int parameter_count, | 6944 void HEnvironment::Initialize(int parameter_count, |
6925 int local_count, | 6945 int local_count, |
6926 int stack_height) { | 6946 int stack_height) { |
6927 parameter_count_ = parameter_count; | 6947 parameter_count_ = parameter_count; |
6928 local_count_ = local_count; | 6948 local_count_ = local_count; |
6929 | 6949 |
6930 // Avoid reallocating the temporaries' backing store on the first Push. | 6950 // Avoid reallocating the temporaries' backing store on the first Push. |
6931 int total = parameter_count + specials_count_ + local_count + stack_height; | 6951 int total = parameter_count + specials_count_ + local_count + stack_height; |
6932 values_.Initialize(total + 4); | 6952 values_.Initialize(total + 4); |
6933 for (int i = 0; i < total; ++i) values_.Add(NULL); | 6953 for (int i = 0; i < total; ++i) values_.Add(NULL); |
6934 } | 6954 } |
6935 | 6955 |
6936 | 6956 |
6937 void HEnvironment::Initialize(const HEnvironment* other) { | 6957 void HEnvironment::Initialize(const HEnvironment* other) { |
6938 closure_ = other->closure(); | 6958 closure_ = other->closure(); |
6939 values_.AddAll(other->values_); | 6959 values_.AddAll(other->values_); |
6940 assigned_variables_.AddAll(other->assigned_variables_); | 6960 assigned_variables_.AddAll(other->assigned_variables_); |
6941 parameter_count_ = other->parameter_count_; | 6961 parameter_count_ = other->parameter_count_; |
6942 local_count_ = other->local_count_; | 6962 local_count_ = other->local_count_; |
6943 if (other->outer_ != NULL) outer_ = other->outer_->Copy(); // Deep copy. | 6963 if (other->outer_ != NULL) outer_ = other->outer_->Copy(); // Deep copy. |
6944 pop_count_ = other->pop_count_; | 6964 pop_count_ = other->pop_count_; |
6945 push_count_ = other->push_count_; | 6965 push_count_ = other->push_count_; |
6946 ast_id_ = other->ast_id_; | 6966 ast_id_ = other->ast_id_; |
| 6967 arguments_adaptor_ = other->arguments_adaptor_; |
6947 } | 6968 } |
6948 | 6969 |
6949 | 6970 |
6950 void HEnvironment::AddIncomingEdge(HBasicBlock* block, HEnvironment* other) { | 6971 void HEnvironment::AddIncomingEdge(HBasicBlock* block, HEnvironment* other) { |
6951 ASSERT(!block->IsLoopHeader()); | 6972 ASSERT(!block->IsLoopHeader()); |
6952 ASSERT(values_.length() == other->values_.length()); | 6973 ASSERT(values_.length() == other->values_.length()); |
6953 | 6974 |
6954 int length = values_.length(); | 6975 int length = values_.length(); |
6955 for (int i = 0; i < length; ++i) { | 6976 for (int i = 0; i < length; ++i) { |
6956 HValue* value = values_[i]; | 6977 HValue* value = values_[i]; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7040 new_env->values_[i] = phi; | 7061 new_env->values_[i] = phi; |
7041 loop_header->AddPhi(phi); | 7062 loop_header->AddPhi(phi); |
7042 } | 7063 } |
7043 new_env->ClearHistory(); | 7064 new_env->ClearHistory(); |
7044 return new_env; | 7065 return new_env; |
7045 } | 7066 } |
7046 | 7067 |
7047 | 7068 |
7048 HEnvironment* HEnvironment::CopyForInlining( | 7069 HEnvironment* HEnvironment::CopyForInlining( |
7049 Handle<JSFunction> target, | 7070 Handle<JSFunction> target, |
| 7071 int arguments, |
7050 FunctionLiteral* function, | 7072 FunctionLiteral* function, |
7051 HConstant* undefined, | 7073 HConstant* undefined, |
7052 CallKind call_kind) const { | 7074 CallKind call_kind) const { |
| 7075 ASSERT(!is_arguments_adaptor()); |
| 7076 |
| 7077 Zone* zone = closure()->GetIsolate()->zone(); |
| 7078 |
7053 // Outer environment is a copy of this one without the arguments. | 7079 // Outer environment is a copy of this one without the arguments. |
7054 int arity = function->scope()->num_parameters(); | 7080 int arity = function->scope()->num_parameters(); |
| 7081 |
7055 HEnvironment* outer = Copy(); | 7082 HEnvironment* outer = Copy(); |
7056 outer->Drop(arity + 1); // Including receiver. | 7083 outer->Drop(arguments + 1); // Including receiver. |
7057 outer->ClearHistory(); | 7084 outer->ClearHistory(); |
7058 Zone* zone = closure()->GetIsolate()->zone(); | 7085 |
| 7086 if (arity != arguments) { |
| 7087 // Create artificial arguments adaptation environment. |
| 7088 outer = new(zone) HEnvironment(outer, target, arguments + 1); |
| 7089 for (int i = 0; i <= arguments; ++i) { // Include receiver. |
| 7090 outer->Push(ExpressionStackAt(arguments - i)); |
| 7091 } |
| 7092 outer->ClearHistory(); |
| 7093 } |
| 7094 |
7059 HEnvironment* inner = | 7095 HEnvironment* inner = |
7060 new(zone) HEnvironment(outer, function->scope(), target); | 7096 new(zone) HEnvironment(outer, function->scope(), target); |
7061 // Get the argument values from the original environment. | 7097 // Get the argument values from the original environment. |
7062 for (int i = 0; i <= arity; ++i) { // Include receiver. | 7098 for (int i = 0; i <= arity; ++i) { // Include receiver. |
7063 HValue* push = ExpressionStackAt(arity - i); | 7099 HValue* push = (i <= arguments) ? |
| 7100 ExpressionStackAt(arguments - i) : undefined; |
7064 inner->SetValueAt(i, push); | 7101 inner->SetValueAt(i, push); |
7065 } | 7102 } |
7066 // If the function we are inlining is a strict mode function or a | 7103 // If the function we are inlining is a strict mode function or a |
7067 // builtin function, pass undefined as the receiver for function | 7104 // builtin function, pass undefined as the receiver for function |
7068 // calls (instead of the global receiver). | 7105 // calls (instead of the global receiver). |
7069 if ((target->shared()->native() || !function->is_classic_mode()) && | 7106 if ((target->shared()->native() || !function->is_classic_mode()) && |
7070 call_kind == CALL_AS_FUNCTION) { | 7107 call_kind == CALL_AS_FUNCTION) { |
7071 inner->SetValueAt(0, undefined); | 7108 inner->SetValueAt(0, undefined); |
7072 } | 7109 } |
7073 inner->SetValueAt(arity + 1, outer->LookupContext()); | 7110 inner->SetValueAt(arity + 1, LookupContext()); |
7074 for (int i = arity + 2; i < inner->length(); ++i) { | 7111 for (int i = arity + 2; i < inner->length(); ++i) { |
7075 inner->SetValueAt(i, undefined); | 7112 inner->SetValueAt(i, undefined); |
7076 } | 7113 } |
7077 | 7114 |
7078 inner->set_ast_id(AstNode::kFunctionEntryId); | 7115 inner->set_ast_id(AstNode::kFunctionEntryId); |
7079 return inner; | 7116 return inner; |
7080 } | 7117 } |
7081 | 7118 |
7082 | 7119 |
7083 void HEnvironment::PrintTo(StringStream* stream) { | 7120 void HEnvironment::PrintTo(StringStream* stream) { |
7084 for (int i = 0; i < length(); i++) { | 7121 for (int i = 0; i < length(); i++) { |
7085 if (i == 0) stream->Add("parameters\n"); | 7122 if (i == 0) stream->Add("parameters\n"); |
7086 if (i == parameter_count()) stream->Add("specials\n"); | 7123 if (i == parameter_count()) stream->Add("specials\n"); |
7087 if (i == parameter_count() + specials_count()) stream->Add("locals\n"); | 7124 if (i == parameter_count() + specials_count()) stream->Add("locals\n"); |
7088 if (i == parameter_count() + specials_count() + local_count()) { | 7125 if (i == parameter_count() + specials_count() + local_count()) { |
7089 stream->Add("expressions"); | 7126 stream->Add("expressions\n"); |
7090 } | 7127 } |
7091 HValue* val = values_.at(i); | 7128 HValue* val = values_.at(i); |
7092 stream->Add("%d: ", i); | 7129 stream->Add("%d: ", i); |
7093 if (val != NULL) { | 7130 if (val != NULL) { |
7094 val->PrintNameTo(stream); | 7131 val->PrintNameTo(stream); |
7095 } else { | 7132 } else { |
7096 stream->Add("NULL"); | 7133 stream->Add("NULL"); |
7097 } | 7134 } |
7098 stream->Add("\n"); | 7135 stream->Add("\n"); |
7099 } | 7136 } |
| 7137 PrintF("\n"); |
7100 } | 7138 } |
7101 | 7139 |
7102 | 7140 |
7103 void HEnvironment::PrintToStd() { | 7141 void HEnvironment::PrintToStd() { |
7104 HeapStringAllocator string_allocator; | 7142 HeapStringAllocator string_allocator; |
7105 StringStream trace(&string_allocator); | 7143 StringStream trace(&string_allocator); |
7106 PrintTo(&trace); | 7144 PrintTo(&trace); |
7107 PrintF("%s", *trace.ToCString()); | 7145 PrintF("%s", *trace.ToCString()); |
7108 } | 7146 } |
7109 | 7147 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7412 } | 7450 } |
7413 } | 7451 } |
7414 | 7452 |
7415 #ifdef DEBUG | 7453 #ifdef DEBUG |
7416 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7454 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7417 if (allocator_ != NULL) allocator_->Verify(); | 7455 if (allocator_ != NULL) allocator_->Verify(); |
7418 #endif | 7456 #endif |
7419 } | 7457 } |
7420 | 7458 |
7421 } } // namespace v8::internal | 7459 } } // namespace v8::internal |
OLD | NEW |