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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 parameters_[i] = param; | 141 parameters_[i] = param; |
142 } | 142 } |
143 | 143 |
144 HInstruction* stack_parameter_count; | 144 HInstruction* stack_parameter_count; |
145 if (descriptor_->stack_parameter_count_ != NULL) { | 145 if (descriptor_->stack_parameter_count_ != NULL) { |
146 ASSERT(descriptor_->environment_length() == (param_count + 1)); | 146 ASSERT(descriptor_->environment_length() == (param_count + 1)); |
147 stack_parameter_count = new(zone) HParameter(param_count, | 147 stack_parameter_count = new(zone) HParameter(param_count, |
148 HParameter::REGISTER_PARAMETER, | 148 HParameter::REGISTER_PARAMETER, |
149 Representation::Integer32()); | 149 Representation::Integer32()); |
150 stack_parameter_count->set_type(HType::Smi()); | 150 stack_parameter_count->set_type(HType::Smi()); |
151 // it's essential to bind this value to the environment in case of deopt | 151 // It's essential to bind this value to the environment in case of deopt. |
152 AddInstruction(stack_parameter_count); | 152 AddInstruction(stack_parameter_count); |
153 start_environment->Bind(param_count, stack_parameter_count); | 153 start_environment->Bind(param_count, stack_parameter_count); |
154 arguments_length_ = stack_parameter_count; | 154 arguments_length_ = stack_parameter_count; |
155 } else { | 155 } else { |
156 ASSERT(descriptor_->environment_length() == param_count); | 156 ASSERT(descriptor_->environment_length() == param_count); |
157 stack_parameter_count = graph()->GetConstantMinus1(); | 157 stack_parameter_count = graph()->GetConstantMinus1(); |
158 arguments_length_ = graph()->GetConstant0(); | 158 arguments_length_ = graph()->GetConstant0(); |
159 } | 159 } |
160 | 160 |
161 context_ = new(zone) HContext(); | 161 context_ = new(zone) HContext(); |
162 AddInstruction(context_); | 162 AddInstruction(context_); |
163 start_environment->BindContext(context_); | 163 start_environment->BindContext(context_); |
164 | 164 |
165 AddSimulate(BailoutId::StubEntry()); | 165 AddSimulate(BailoutId::StubEntry()); |
166 | 166 |
167 NoObservableSideEffectsScope no_effects(this); | 167 NoObservableSideEffectsScope no_effects(this); |
168 | 168 |
169 HValue* return_value = BuildCodeStub(); | 169 HValue* return_value = BuildCodeStub(); |
170 | 170 |
171 // We might have extra expressions to pop from the stack in addition to the | 171 // We might have extra expressions to pop from the stack in addition to the |
172 // arguments above | 172 // arguments above. |
173 HInstruction* stack_pop_count = stack_parameter_count; | 173 HInstruction* stack_pop_count = stack_parameter_count; |
174 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { | 174 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { |
175 if (!stack_parameter_count->IsConstant() && | 175 if (!stack_parameter_count->IsConstant() && |
176 descriptor_->hint_stack_parameter_count_ < 0) { | 176 descriptor_->hint_stack_parameter_count_ < 0) { |
177 HInstruction* amount = graph()->GetConstant1(); | 177 HInstruction* amount = graph()->GetConstant1(); |
178 stack_pop_count = AddInstruction( | 178 stack_pop_count = AddInstruction( |
179 HAdd::New(zone, context_, stack_parameter_count, amount)); | 179 HAdd::New(zone, context_, stack_parameter_count, amount)); |
180 stack_pop_count->ChangeRepresentation(Representation::Integer32()); | 180 stack_pop_count->ChangeRepresentation(Representation::Integer32()); |
181 stack_pop_count->ClearFlag(HValue::kCanOverflow); | 181 stack_pop_count->ClearFlag(HValue::kCanOverflow); |
182 } else { | 182 } else { |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 ? graph()->GetConstantSmi1() | 694 ? graph()->GetConstantSmi1() |
695 : graph()->GetConstantUndefined(); | 695 : graph()->GetConstantUndefined(); |
696 } | 696 } |
697 | 697 |
698 | 698 |
699 Handle<Code> CompareNilICStub::GenerateCode() { | 699 Handle<Code> CompareNilICStub::GenerateCode() { |
700 return DoGenerateCode(this); | 700 return DoGenerateCode(this); |
701 } | 701 } |
702 | 702 |
703 } } // namespace v8::internal | 703 } } // namespace v8::internal |
OLD | NEW |