| 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(), Representation::Tagged()); | 147 isolate()->factory()->undefined_value()); |
| 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) | 199 stack_pop_count = AddInstruction(new(zone) HConstant(count)); |
| 200 HConstant(count, Representation::Integer32())); | |
| 201 } | 200 } |
| 202 } | 201 } |
| 203 | 202 |
| 204 if (current_block() != NULL) { | 203 if (current_block() != NULL) { |
| 205 HReturn* hreturn_instruction = new(zone) HReturn(return_value, | 204 HReturn* hreturn_instruction = new(zone) HReturn(return_value, |
| 206 context_, | 205 context_, |
| 207 stack_pop_count); | 206 stack_pop_count); |
| 208 current_block()->Finish(hreturn_instruction); | 207 current_block()->Finish(hreturn_instruction); |
| 209 set_current_block(NULL); | 208 set_current_block(NULL); |
| 210 } | 209 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 FAST_ELEMENTS)); | 383 FAST_ELEMENTS)); |
| 385 | 384 |
| 386 IfBuilder checker(this); | 385 IfBuilder checker(this); |
| 387 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined); | 386 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined); |
| 388 checker.And(); | 387 checker.And(); |
| 389 | 388 |
| 390 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 389 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
| 391 HValue* boilerplate_size = | 390 HValue* boilerplate_size = |
| 392 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 391 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
| 393 HValue* size_in_words = | 392 HValue* size_in_words = |
| 394 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, | 393 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2)); |
| 395 Representation::Integer32())); | |
| 396 checker.IfCompare(boilerplate_size, size_in_words, Token::EQ); | 394 checker.IfCompare(boilerplate_size, size_in_words, Token::EQ); |
| 397 checker.Then(); | 395 checker.Then(); |
| 398 | 396 |
| 399 HValue* size_in_bytes = | 397 HValue* size_in_bytes = AddInstruction(new(zone) HConstant(size)); |
| 400 AddInstruction(new(zone) HConstant(size, Representation::Integer32())); | |
| 401 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; | 398 HAllocate::Flags flags = HAllocate::CAN_ALLOCATE_IN_NEW_SPACE; |
| 402 if (isolate()->heap()->ShouldGloballyPretenure()) { | 399 if (isolate()->heap()->ShouldGloballyPretenure()) { |
| 403 flags = static_cast<HAllocate::Flags>( | 400 flags = static_cast<HAllocate::Flags>( |
| 404 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); | 401 flags | HAllocate::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); |
| 405 } | 402 } |
| 406 | 403 |
| 407 HInstruction* object = AddInstruction(new(zone) | 404 HInstruction* object = AddInstruction(new(zone) |
| 408 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); | 405 HAllocate(context(), size_in_bytes, HType::JSObject(), flags)); |
| 409 | 406 |
| 410 for (int i = 0; i < size; i += kPointerSize) { | 407 for (int i = 0; i < size; i += kPointerSize) { |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 return graph()->GetConstant0(); | 768 return graph()->GetConstant0(); |
| 772 } | 769 } |
| 773 | 770 |
| 774 | 771 |
| 775 Handle<Code> ToBooleanStub::GenerateCode() { | 772 Handle<Code> ToBooleanStub::GenerateCode() { |
| 776 return DoGenerateCode(this); | 773 return DoGenerateCode(this); |
| 777 } | 774 } |
| 778 | 775 |
| 779 | 776 |
| 780 } } // namespace v8::internal | 777 } } // namespace v8::internal |
| OLD | NEW |