OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4793 // Our implementation of arguments (based on this stack frame or an | 4793 // Our implementation of arguments (based on this stack frame or an |
4794 // adapter below it) does not work for inlined functions. | 4794 // adapter below it) does not work for inlined functions. |
4795 if (function_state()->outer() != NULL) { | 4795 if (function_state()->outer() != NULL) { |
4796 Bailout("Function.prototype.apply optimization in inlined function"); | 4796 Bailout("Function.prototype.apply optimization in inlined function"); |
4797 return true; | 4797 return true; |
4798 } | 4798 } |
4799 | 4799 |
4800 // Found pattern f.apply(receiver, arguments). | 4800 // Found pattern f.apply(receiver, arguments). |
4801 VisitForValue(prop->obj()); | 4801 VisitForValue(prop->obj()); |
4802 if (HasStackOverflow() || current_block() == NULL) return true; | 4802 if (HasStackOverflow() || current_block() == NULL) return true; |
4803 HValue* function = Pop(); | 4803 HValue* function = Top(); |
| 4804 AddCheckConstantFunction(expr, function, function_map, true); |
| 4805 Drop(1); |
| 4806 |
4804 VisitForValue(args->at(0)); | 4807 VisitForValue(args->at(0)); |
4805 if (HasStackOverflow() || current_block() == NULL) return true; | 4808 if (HasStackOverflow() || current_block() == NULL) return true; |
4806 HValue* receiver = Pop(); | 4809 HValue* receiver = Pop(); |
4807 HInstruction* elements = AddInstruction(new(zone()) HArgumentsElements); | 4810 HInstruction* elements = AddInstruction(new(zone()) HArgumentsElements); |
4808 HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements)); | 4811 HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements)); |
4809 AddCheckConstantFunction(expr, function, function_map, true); | |
4810 HInstruction* result = | 4812 HInstruction* result = |
4811 new(zone()) HApplyArguments(function, receiver, length, elements); | 4813 new(zone()) HApplyArguments(function, receiver, length, elements); |
4812 result->set_position(expr->position()); | 4814 result->set_position(expr->position()); |
4813 ast_context()->ReturnInstruction(result, expr->id()); | 4815 ast_context()->ReturnInstruction(result, expr->id()); |
4814 return true; | 4816 return true; |
4815 } | 4817 } |
4816 | 4818 |
4817 | 4819 |
4818 void HGraphBuilder::VisitCall(Call* expr) { | 4820 void HGraphBuilder::VisitCall(Call* expr) { |
4819 ASSERT(!HasStackOverflow()); | 4821 ASSERT(!HasStackOverflow()); |
(...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6747 } | 6749 } |
6748 } | 6750 } |
6749 | 6751 |
6750 #ifdef DEBUG | 6752 #ifdef DEBUG |
6751 if (graph_ != NULL) graph_->Verify(); | 6753 if (graph_ != NULL) graph_->Verify(); |
6752 if (allocator_ != NULL) allocator_->Verify(); | 6754 if (allocator_ != NULL) allocator_->Verify(); |
6753 #endif | 6755 #endif |
6754 } | 6756 } |
6755 | 6757 |
6756 } } // namespace v8::internal | 6758 } } // namespace v8::internal |
OLD | NEW |