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 5522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5533 // Fast swapping of elements. Takes three expressions, the object and two | 5533 // Fast swapping of elements. Takes three expressions, the object and two |
5534 // indices. This should only be used if the indices are known to be | 5534 // indices. This should only be used if the indices are known to be |
5535 // non-negative and within bounds of the elements array at the call site. | 5535 // non-negative and within bounds of the elements array at the call site. |
5536 void HGraphBuilder::GenerateSwapElements(CallRuntime* call) { | 5536 void HGraphBuilder::GenerateSwapElements(CallRuntime* call) { |
5537 return Bailout("inlined runtime function: SwapElements"); | 5537 return Bailout("inlined runtime function: SwapElements"); |
5538 } | 5538 } |
5539 | 5539 |
5540 | 5540 |
5541 // Fast call for custom callbacks. | 5541 // Fast call for custom callbacks. |
5542 void HGraphBuilder::GenerateCallFunction(CallRuntime* call) { | 5542 void HGraphBuilder::GenerateCallFunction(CallRuntime* call) { |
5543 return Bailout("inlined runtime function: CallFunction"); | 5543 // 1 ~ The function to call is not itself an argument to the call. |
| 5544 int arg_count = call->arguments()->length() - 1; |
| 5545 ASSERT(arg_count >= 1); // There's always at least a receiver. |
| 5546 |
| 5547 for (int i = 0; i < arg_count; ++i) { |
| 5548 CHECK_ALIVE(VisitArgument(call->arguments()->at(i))); |
| 5549 } |
| 5550 CHECK_ALIVE(VisitForValue(call->arguments()->last())); |
| 5551 HValue* function = Pop(); |
| 5552 HContext* context = new HContext; |
| 5553 AddInstruction(context); |
| 5554 HInvokeFunction* result = |
| 5555 new(zone()) HInvokeFunction(context, function, arg_count); |
| 5556 Drop(arg_count); |
| 5557 ast_context()->ReturnInstruction(result, call->id()); |
5544 } | 5558 } |
5545 | 5559 |
5546 | 5560 |
5547 // Fast call to math functions. | 5561 // Fast call to math functions. |
5548 void HGraphBuilder::GenerateMathPow(CallRuntime* call) { | 5562 void HGraphBuilder::GenerateMathPow(CallRuntime* call) { |
5549 ASSERT_EQ(2, call->arguments()->length()); | 5563 ASSERT_EQ(2, call->arguments()->length()); |
5550 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 5564 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
5551 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 5565 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
5552 HValue* right = Pop(); | 5566 HValue* right = Pop(); |
5553 HValue* left = Pop(); | 5567 HValue* left = Pop(); |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6136 } | 6150 } |
6137 } | 6151 } |
6138 | 6152 |
6139 #ifdef DEBUG | 6153 #ifdef DEBUG |
6140 if (graph_ != NULL) graph_->Verify(); | 6154 if (graph_ != NULL) graph_->Verify(); |
6141 if (allocator_ != NULL) allocator_->Verify(); | 6155 if (allocator_ != NULL) allocator_->Verify(); |
6142 #endif | 6156 #endif |
6143 } | 6157 } |
6144 | 6158 |
6145 } } // namespace v8::internal | 6159 } } // namespace v8::internal |
OLD | NEW |