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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 | 2233 |
2234 if (var != NULL && !var->is_this() && var->is_global()) { | 2234 if (var != NULL && !var->is_this() && var->is_global()) { |
2235 // ---------------------------------- | 2235 // ---------------------------------- |
2236 // JavaScript example: 'foo(1, 2, 3)' // foo is global | 2236 // JavaScript example: 'foo(1, 2, 3)' // foo is global |
2237 // ---------------------------------- | 2237 // ---------------------------------- |
2238 | 2238 |
2239 // Push the name of the function and the receiver onto the stack. | 2239 // Push the name of the function and the receiver onto the stack. |
2240 __ mov(r0, Operand(var->name())); | 2240 __ mov(r0, Operand(var->name())); |
2241 __ push(r0); | 2241 __ push(r0); |
2242 | 2242 |
2243 // TODO(120): Use global object for function lookup and inline | 2243 // Pass the global object as the receiver and let the IC stub |
2244 // cache, and use global proxy as 'this' for invocation. | 2244 // patch the stack to use the global proxy as 'this' in the |
2245 LoadGlobalReceiver(r0); | 2245 // invoked function. |
| 2246 LoadGlobal(); |
2246 | 2247 |
2247 // Load the arguments. | 2248 // Load the arguments. |
2248 for (int i = 0; i < args->length(); i++) Load(args->at(i)); | 2249 for (int i = 0; i < args->length(); i++) Load(args->at(i)); |
2249 | 2250 |
2250 // Setup the receiver register and call the IC initialization code. | 2251 // Setup the receiver register and call the IC initialization code. |
2251 Handle<Code> stub = ComputeCallInitialize(args->length()); | 2252 Handle<Code> stub = ComputeCallInitialize(args->length()); |
2252 __ RecordPosition(node->position()); | 2253 __ RecordPosition(node->position()); |
2253 __ Call(stub, RelocInfo::CODE_TARGET_CONTEXT); | 2254 __ Call(stub, RelocInfo::CODE_TARGET_CONTEXT); |
2254 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2255 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2255 // Remove the function from the stack. | 2256 // Remove the function from the stack. |
(...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4184 // Slow-case: Non-function called. | 4185 // Slow-case: Non-function called. |
4185 __ bind(&slow); | 4186 __ bind(&slow); |
4186 __ mov(r0, Operand(argc_)); // Setup the number of arguments. | 4187 __ mov(r0, Operand(argc_)); // Setup the number of arguments. |
4187 __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); | 4188 __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); |
4188 } | 4189 } |
4189 | 4190 |
4190 | 4191 |
4191 #undef __ | 4192 #undef __ |
4192 | 4193 |
4193 } } // namespace v8::internal | 4194 } } // namespace v8::internal |
OLD | NEW |