| 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 4478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4489 // Our implementation of arguments (based on this stack frame or an | 4489 // Our implementation of arguments (based on this stack frame or an |
| 4490 // adapter below it) does not work for inlined functions. | 4490 // adapter below it) does not work for inlined functions. |
| 4491 if (function_state()->outer() != NULL) { | 4491 if (function_state()->outer() != NULL) { |
| 4492 Bailout("Function.prototype.apply optimization in inlined function"); | 4492 Bailout("Function.prototype.apply optimization in inlined function"); |
| 4493 return true; | 4493 return true; |
| 4494 } | 4494 } |
| 4495 | 4495 |
| 4496 // Found pattern f.apply(receiver, arguments). | 4496 // Found pattern f.apply(receiver, arguments). |
| 4497 VisitForValue(prop->obj()); | 4497 VisitForValue(prop->obj()); |
| 4498 if (HasStackOverflow() || current_block() == NULL) return true; | 4498 if (HasStackOverflow() || current_block() == NULL) return true; |
| 4499 HValue* function = Pop(); | 4499 HValue* function = Top(); |
| 4500 AddCheckConstantFunction(expr, function, function_map, true); |
| 4501 Drop(1); |
| 4502 |
| 4500 VisitForValue(args->at(0)); | 4503 VisitForValue(args->at(0)); |
| 4501 if (HasStackOverflow() || current_block() == NULL) return true; | 4504 if (HasStackOverflow() || current_block() == NULL) return true; |
| 4502 HValue* receiver = Pop(); | 4505 HValue* receiver = Pop(); |
| 4503 HInstruction* elements = AddInstruction(new(zone()) HArgumentsElements); | 4506 HInstruction* elements = AddInstruction(new(zone()) HArgumentsElements); |
| 4504 HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements)); | 4507 HInstruction* length = AddInstruction(new(zone()) HArgumentsLength(elements)); |
| 4505 AddCheckConstantFunction(expr, function, function_map, true); | |
| 4506 HInstruction* result = | 4508 HInstruction* result = |
| 4507 new(zone()) HApplyArguments(function, receiver, length, elements); | 4509 new(zone()) HApplyArguments(function, receiver, length, elements); |
| 4508 result->set_position(expr->position()); | 4510 result->set_position(expr->position()); |
| 4509 ast_context()->ReturnInstruction(result, expr->id()); | 4511 ast_context()->ReturnInstruction(result, expr->id()); |
| 4510 return true; | 4512 return true; |
| 4511 } | 4513 } |
| 4512 | 4514 |
| 4513 | 4515 |
| 4514 void HGraphBuilder::VisitCall(Call* expr) { | 4516 void HGraphBuilder::VisitCall(Call* expr) { |
| 4515 ASSERT(!HasStackOverflow()); | 4517 ASSERT(!HasStackOverflow()); |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6333 } | 6335 } |
| 6334 } | 6336 } |
| 6335 | 6337 |
| 6336 #ifdef DEBUG | 6338 #ifdef DEBUG |
| 6337 if (graph_ != NULL) graph_->Verify(); | 6339 if (graph_ != NULL) graph_->Verify(); |
| 6338 if (allocator_ != NULL) allocator_->Verify(); | 6340 if (allocator_ != NULL) allocator_->Verify(); |
| 6339 #endif | 6341 #endif |
| 6340 } | 6342 } |
| 6341 | 6343 |
| 6342 } } // namespace v8::internal | 6344 } } // namespace v8::internal |
| OLD | NEW |