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 5512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5523 // Fast swapping of elements. Takes three expressions, the object and two | 5523 // Fast swapping of elements. Takes three expressions, the object and two |
5524 // indices. This should only be used if the indices are known to be | 5524 // indices. This should only be used if the indices are known to be |
5525 // non-negative and within bounds of the elements array at the call site. | 5525 // non-negative and within bounds of the elements array at the call site. |
5526 void HGraphBuilder::GenerateSwapElements(CallRuntime* call) { | 5526 void HGraphBuilder::GenerateSwapElements(CallRuntime* call) { |
5527 return Bailout("inlined runtime function: SwapElements"); | 5527 return Bailout("inlined runtime function: SwapElements"); |
5528 } | 5528 } |
5529 | 5529 |
5530 | 5530 |
5531 // Fast call for custom callbacks. | 5531 // Fast call for custom callbacks. |
5532 void HGraphBuilder::GenerateCallFunction(CallRuntime* call) { | 5532 void HGraphBuilder::GenerateCallFunction(CallRuntime* call) { |
5533 return Bailout("inlined runtime function: CallFunction"); | 5533 // 1 ~ The function to call is not itself an argument to the call. |
5534 int arg_count = call->arguments()->length() - 1; | |
5535 ASSERT(arg_count >= 1); // There's always at least a receiver. | |
fschneider
2011/04/13 16:59:30
Can this also be >= 2 (receiver + function)?
| |
5536 | |
5537 for (int i = 0; i < arg_count; ++i) { | |
5538 CHECK_ALIVE(VisitArgument(call->arguments()->at(i))); | |
5539 } | |
5540 CHECK_ALIVE(VisitForValue(call->arguments()->last())); | |
5541 HValue* function = Pop(); | |
5542 HContext* context = new HContext; | |
5543 AddInstruction(context); | |
5544 HInvokeFunction* result = | |
5545 new(zone()) HInvokeFunction(context, function, arg_count); | |
5546 Drop(arg_count); | |
5547 ast_context()->ReturnInstruction(result, call->id()); | |
5534 } | 5548 } |
5535 | 5549 |
5536 | 5550 |
5537 // Fast call to math functions. | 5551 // Fast call to math functions. |
5538 void HGraphBuilder::GenerateMathPow(CallRuntime* call) { | 5552 void HGraphBuilder::GenerateMathPow(CallRuntime* call) { |
5539 ASSERT_EQ(2, call->arguments()->length()); | 5553 ASSERT_EQ(2, call->arguments()->length()); |
5540 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 5554 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
5541 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 5555 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
5542 HValue* right = Pop(); | 5556 HValue* right = Pop(); |
5543 HValue* left = Pop(); | 5557 HValue* left = Pop(); |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6126 } | 6140 } |
6127 } | 6141 } |
6128 | 6142 |
6129 #ifdef DEBUG | 6143 #ifdef DEBUG |
6130 if (graph_ != NULL) graph_->Verify(); | 6144 if (graph_ != NULL) graph_->Verify(); |
6131 if (allocator_ != NULL) allocator_->Verify(); | 6145 if (allocator_ != NULL) allocator_->Verify(); |
6132 #endif | 6146 #endif |
6133 } | 6147 } |
6134 | 6148 |
6135 } } // namespace v8::internal | 6149 } } // namespace v8::internal |
OLD | NEW |