OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4573 } | 4573 } |
4574 | 4574 |
4575 // Prepare the stack for the call to ResolvePossiblyDirectEval. | 4575 // Prepare the stack for the call to ResolvePossiblyDirectEval. |
4576 frame_->PushElementAt(arg_count + 1); | 4576 frame_->PushElementAt(arg_count + 1); |
4577 if (arg_count > 0) { | 4577 if (arg_count > 0) { |
4578 frame_->PushElementAt(arg_count); | 4578 frame_->PushElementAt(arg_count); |
4579 } else { | 4579 } else { |
4580 frame_->Push(Factory::undefined_value()); | 4580 frame_->Push(Factory::undefined_value()); |
4581 } | 4581 } |
4582 | 4582 |
| 4583 // Push the receiver. |
| 4584 frame_->PushParameterAt(-1); |
| 4585 |
4583 // Resolve the call. | 4586 // Resolve the call. |
4584 Result result = | 4587 Result result = |
4585 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 2); | 4588 frame_->CallRuntime(Runtime::kResolvePossiblyDirectEval, 3); |
4586 | 4589 |
4587 // Touch up the stack with the right values for the function and the | 4590 // The runtime call returns a pair of values in eax (function) and |
4588 // receiver. Use a scratch register to avoid destroying the result. | 4591 // edx (receiver). Touch up the stack with the right values. |
4589 Result scratch = allocator_->Allocate(); | 4592 Result receiver = allocator_->Allocate(edx); |
4590 ASSERT(scratch.is_valid()); | 4593 frame_->SetElementAt(arg_count + 1, &result); |
4591 __ mov(scratch.reg(), FieldOperand(result.reg(), FixedArray::kHeaderSize)); | 4594 frame_->SetElementAt(arg_count, &receiver); |
4592 frame_->SetElementAt(arg_count + 1, &scratch); | 4595 receiver.Unuse(); |
4593 | |
4594 // We can reuse the result register now. | |
4595 frame_->Spill(result.reg()); | |
4596 __ mov(result.reg(), | |
4597 FieldOperand(result.reg(), FixedArray::kHeaderSize + kPointerSize)); | |
4598 frame_->SetElementAt(arg_count, &result); | |
4599 | 4596 |
4600 // Call the function. | 4597 // Call the function. |
4601 CodeForSourcePosition(node->position()); | 4598 CodeForSourcePosition(node->position()); |
4602 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; | 4599 InLoopFlag in_loop = loop_nesting() > 0 ? IN_LOOP : NOT_IN_LOOP; |
4603 CallFunctionStub call_function(arg_count, in_loop); | 4600 CallFunctionStub call_function(arg_count, in_loop); |
4604 result = frame_->CallStub(&call_function, arg_count + 1); | 4601 result = frame_->CallStub(&call_function, arg_count + 1); |
4605 | 4602 |
4606 // Restore the context and overwrite the function on the stack with | 4603 // Restore the context and overwrite the function on the stack with |
4607 // the result. | 4604 // the result. |
4608 frame_->RestoreContextRegister(); | 4605 frame_->RestoreContextRegister(); |
(...skipping 4291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8900 __ add(Operand(dest), Immediate(2)); | 8897 __ add(Operand(dest), Immediate(2)); |
8901 } | 8898 } |
8902 __ sub(Operand(count), Immediate(1)); | 8899 __ sub(Operand(count), Immediate(1)); |
8903 __ j(not_zero, &loop); | 8900 __ j(not_zero, &loop); |
8904 } | 8901 } |
8905 | 8902 |
8906 | 8903 |
8907 #undef __ | 8904 #undef __ |
8908 | 8905 |
8909 } } // namespace v8::internal | 8906 } } // namespace v8::internal |
OLD | NEW |