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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 Zone* zone = this->zone(); | 138 Zone* zone = this->zone(); |
139 int param_count = descriptor_->register_param_count_; | 139 int param_count = descriptor_->register_param_count_; |
140 HEnvironment* start_environment = graph()->start_environment(); | 140 HEnvironment* start_environment = graph()->start_environment(); |
141 HBasicBlock* next_block = CreateBasicBlock(start_environment); | 141 HBasicBlock* next_block = CreateBasicBlock(start_environment); |
142 current_block()->Goto(next_block); | 142 current_block()->Goto(next_block); |
143 next_block->SetJoinId(BailoutId::StubEntry()); | 143 next_block->SetJoinId(BailoutId::StubEntry()); |
144 set_current_block(next_block); | 144 set_current_block(next_block); |
145 | 145 |
146 HConstant* undefined_constant = new(zone) HConstant( | 146 HConstant* undefined_constant = new(zone) HConstant( |
147 isolate()->factory()->undefined_value()); | 147 isolate()->factory()->undefined_value(), Representation::Tagged()); |
148 AddInstruction(undefined_constant); | 148 AddInstruction(undefined_constant); |
149 graph()->set_undefined_constant(undefined_constant); | 149 graph()->set_undefined_constant(undefined_constant); |
150 | 150 |
151 for (int i = 0; i < param_count; ++i) { | 151 for (int i = 0; i < param_count; ++i) { |
152 HParameter* param = | 152 HParameter* param = |
153 new(zone) HParameter(i, HParameter::REGISTER_PARAMETER); | 153 new(zone) HParameter(i, HParameter::REGISTER_PARAMETER); |
154 AddInstruction(param); | 154 AddInstruction(param); |
155 start_environment->Bind(i, param); | 155 start_environment->Bind(i, param); |
156 parameters_[i] = param; | 156 parameters_[i] = param; |
157 } | 157 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { | 189 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { |
190 if (!stack_parameter_count->IsConstant() && | 190 if (!stack_parameter_count->IsConstant() && |
191 descriptor_->hint_stack_parameter_count_ < 0) { | 191 descriptor_->hint_stack_parameter_count_ < 0) { |
192 HInstruction* amount = graph()->GetConstant1(); | 192 HInstruction* amount = graph()->GetConstant1(); |
193 stack_pop_count = AddInstruction( | 193 stack_pop_count = AddInstruction( |
194 HAdd::New(zone, context_, stack_parameter_count, amount)); | 194 HAdd::New(zone, context_, stack_parameter_count, amount)); |
195 stack_pop_count->ChangeRepresentation(Representation::Integer32()); | 195 stack_pop_count->ChangeRepresentation(Representation::Integer32()); |
196 stack_pop_count->ClearFlag(HValue::kCanOverflow); | 196 stack_pop_count->ClearFlag(HValue::kCanOverflow); |
197 } else { | 197 } else { |
198 int count = descriptor_->hint_stack_parameter_count_; | 198 int count = descriptor_->hint_stack_parameter_count_; |
199 stack_pop_count = AddInstruction(new(zone) HConstant(count)); | 199 stack_pop_count = AddInstruction(new(zone) |
| 200 HConstant(count, Representation::Integer32())); |
200 } | 201 } |
201 } | 202 } |
202 | 203 |
203 if (current_block() != NULL) { | 204 if (current_block() != NULL) { |
204 HReturn* hreturn_instruction = new(zone) HReturn(return_value, | 205 HReturn* hreturn_instruction = new(zone) HReturn(return_value, |
205 context_, | 206 context_, |
206 stack_pop_count); | 207 stack_pop_count); |
207 current_block()->Finish(hreturn_instruction); | 208 current_block()->Finish(hreturn_instruction); |
208 set_current_block(NULL); | 209 set_current_block(NULL); |
209 } | 210 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 FAST_ELEMENTS)); | 384 FAST_ELEMENTS)); |
384 | 385 |
385 IfBuilder checker(this); | 386 IfBuilder checker(this); |
386 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined); | 387 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined); |
387 checker.And(); | 388 checker.And(); |
388 | 389 |
389 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 390 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
390 HValue* boilerplate_size = | 391 HValue* boilerplate_size = |
391 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 392 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
392 HValue* size_in_words = | 393 HValue* size_in_words = |
393 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2)); | 394 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, |
| 395 Representation::Integer32())); |
394 checker.IfCompare(boilerplate_size, size_in_words, Token::EQ); | 396 checker.IfCompare(boilerplate_size, size_in_words, Token::EQ); |
395 checker.Then(); | 397 checker.Then(); |
396 | 398 |
397 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(size)); | 399 HValue* size_in_bytes = |
| 400 AddInstruction(new(zone) HConstant(size, Representation::Integer32())); |
398 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; | 401 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; |
399 if (isolate()->heap()->ShouldGloballyPretenure()) { | 402 if (isolate()->heap()->ShouldGloballyPretenure()) { |
400 flags = static_cast<HAllocate::Flags>( | 403 flags = static_cast<HAllocate::Flags>( |
401 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 404 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); |
402 } | 405 } |
403 | 406 |
404 HInstruction* object = AddInstruction(new(zone) | 407 HInstruction* object = AddInstruction(new(zone) |
405 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); | 408 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); |
406 | 409 |
407 for (int i = 0; i < size; i += kPointerSize) { | 410 for (int i = 0; i < size; i += kPointerSize) { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 return graph()->GetConstant0(); | 771 return graph()->GetConstant0(); |
769 } | 772 } |
770 | 773 |
771 | 774 |
772 Handle<Code> ToBooleanStub::GenerateCode() { | 775 Handle<Code> ToBooleanStub::GenerateCode() { |
773 return DoGenerateCode(this); | 776 return DoGenerateCode(this); |
774 } | 777 } |
775 | 778 |
776 | 779 |
777 } } // namespace v8::internal | 780 } } // namespace v8::internal |
OLD | NEW |