| 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 9767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9778 Handle<JSFunction> constructor = expr->target(); | 9778 Handle<JSFunction> constructor = expr->target(); |
| 9779 HValue* check = AddInstruction( | 9779 HValue* check = AddInstruction( |
| 9780 new(zone()) HCheckFunction(function, constructor)); | 9780 new(zone()) HCheckFunction(function, constructor)); |
| 9781 | 9781 |
| 9782 // Force completion of inobject slack tracking before generating | 9782 // Force completion of inobject slack tracking before generating |
| 9783 // allocation code to finalize instance size. | 9783 // allocation code to finalize instance size. |
| 9784 if (constructor->shared()->IsInobjectSlackTrackingInProgress()) { | 9784 if (constructor->shared()->IsInobjectSlackTrackingInProgress()) { |
| 9785 constructor->shared()->CompleteInobjectSlackTracking(); | 9785 constructor->shared()->CompleteInobjectSlackTracking(); |
| 9786 } | 9786 } |
| 9787 | 9787 |
| 9788 HAllocateObject::Flags flags = HAllocateObject::DefaultFlags(); |
| 9789 if (FLAG_pretenure_hallocateobject && |
| 9790 isolate()->heap()->ShouldGloballyPretenure()) { |
| 9791 flags = static_cast<HAllocateObject::Flags>( |
| 9792 flags | HAllocateObject::CAN_ALLOCATE_IN_OLD_POINTER_SPACE); |
| 9793 } |
| 9794 |
| 9788 // Replace the constructor function with a newly allocated receiver. | 9795 // Replace the constructor function with a newly allocated receiver. |
| 9789 HInstruction* receiver = new(zone()) HAllocateObject(context, constructor); | 9796 HInstruction* receiver = |
| 9797 new(zone()) HAllocateObject(context, constructor, flags); |
| 9790 // Index of the receiver from the top of the expression stack. | 9798 // Index of the receiver from the top of the expression stack. |
| 9791 const int receiver_index = argument_count - 1; | 9799 const int receiver_index = argument_count - 1; |
| 9792 AddInstruction(receiver); | 9800 AddInstruction(receiver); |
| 9793 ASSERT(environment()->ExpressionStackAt(receiver_index) == function); | 9801 ASSERT(environment()->ExpressionStackAt(receiver_index) == function); |
| 9794 environment()->SetExpressionStackAt(receiver_index, receiver); | 9802 environment()->SetExpressionStackAt(receiver_index, receiver); |
| 9795 | 9803 |
| 9796 if (TryInlineConstruct(expr, receiver)) return; | 9804 if (TryInlineConstruct(expr, receiver)) return; |
| 9797 | 9805 |
| 9798 // TODO(mstarzinger): For now we remove the previous HAllocateObject and | 9806 // TODO(mstarzinger): For now we remove the previous HAllocateObject and |
| 9799 // add HPushArgument for the arguments in case inlining failed. What we | 9807 // add HPushArgument for the arguments in case inlining failed. What we |
| (...skipping 2673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12473 } | 12481 } |
| 12474 } | 12482 } |
| 12475 | 12483 |
| 12476 #ifdef DEBUG | 12484 #ifdef DEBUG |
| 12477 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12485 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 12478 if (allocator_ != NULL) allocator_->Verify(); | 12486 if (allocator_ != NULL) allocator_->Verify(); |
| 12479 #endif | 12487 #endif |
| 12480 } | 12488 } |
| 12481 | 12489 |
| 12482 } } // namespace v8::internal | 12490 } } // namespace v8::internal |
| OLD | NEW |