OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 // ------------------------------------------------------------------------ | 2653 // ------------------------------------------------------------------------ |
2654 | 2654 |
2655 if (var != NULL && !var->is_this() && var->is_global()) { | 2655 if (var != NULL && !var->is_this() && var->is_global()) { |
2656 // ---------------------------------- | 2656 // ---------------------------------- |
2657 // JavaScript example: 'foo(1, 2, 3)' // foo is global | 2657 // JavaScript example: 'foo(1, 2, 3)' // foo is global |
2658 // ---------------------------------- | 2658 // ---------------------------------- |
2659 | 2659 |
2660 // Push the name of the function and the receiver onto the stack. | 2660 // Push the name of the function and the receiver onto the stack. |
2661 frame_->Push(Immediate(var->name())); | 2661 frame_->Push(Immediate(var->name())); |
2662 | 2662 |
2663 // TODO(120): Use global object for function lookup and inline | 2663 // Pass the global object as the receiver and let the IC stub |
2664 // cache, and use global proxy as 'this' for invocation. | 2664 // patch the stack to use the global proxy as 'this' in the |
2665 LoadGlobalReceiver(eax); | 2665 // invoked function. |
| 2666 LoadGlobal(); |
2666 | 2667 |
2667 // Load the arguments. | 2668 // Load the arguments. |
2668 for (int i = 0; i < args->length(); i++) { | 2669 for (int i = 0; i < args->length(); i++) { |
2669 Load(args->at(i)); | 2670 Load(args->at(i)); |
2670 } | 2671 } |
2671 | 2672 |
2672 // Setup the receiver register and call the IC initialization code. | 2673 // Setup the receiver register and call the IC initialization code. |
2673 Handle<Code> stub = ComputeCallInitialize(args->length()); | 2674 Handle<Code> stub = ComputeCallInitialize(args->length()); |
2674 __ RecordPosition(node->position()); | 2675 __ RecordPosition(node->position()); |
2675 __ call(stub, RelocInfo::CODE_TARGET_CONTEXT); | 2676 __ call(stub, RelocInfo::CODE_TARGET_CONTEXT); |
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5113 | 5114 |
5114 // Slow-case: Go through the JavaScript implementation. | 5115 // Slow-case: Go through the JavaScript implementation. |
5115 __ bind(&slow); | 5116 __ bind(&slow); |
5116 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5117 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
5117 } | 5118 } |
5118 | 5119 |
5119 | 5120 |
5120 #undef __ | 5121 #undef __ |
5121 | 5122 |
5122 } } // namespace v8::internal | 5123 } } // namespace v8::internal |
OLD | NEW |