| 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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3912 // Enter the exit frame that transitions from JavaScript to C++. | 3913 // Enter the exit frame that transitions from JavaScript to C++. |
| 3913 __ EnterExitFrame(frame_type); | 3914 __ EnterExitFrame(frame_type); |
| 3914 | 3915 |
| 3915 // r4: number of arguments (C callee-saved) | 3916 // r4: number of arguments (C callee-saved) |
| 3916 // r5: pointer to builtin function (C callee-saved) | 3917 // r5: pointer to builtin function (C callee-saved) |
| 3917 // r6: pointer to first argument (C callee-saved) | 3918 // r6: pointer to first argument (C callee-saved) |
| 3918 | 3919 |
| 3919 Label throw_out_of_memory_exception; | 3920 Label throw_out_of_memory_exception; |
| 3920 Label throw_normal_exception; | 3921 Label throw_normal_exception; |
| 3921 | 3922 |
| 3922 #ifdef DEBUG | 3923 // Call into the runtime system. Collect garbage before the call if |
| 3924 // running with --gc-greedy set. |
| 3923 if (FLAG_gc_greedy) { | 3925 if (FLAG_gc_greedy) { |
| 3924 Failure* failure = Failure::RetryAfterGC(0); | 3926 Failure* failure = Failure::RetryAfterGC(0); |
| 3925 __ mov(r0, Operand(reinterpret_cast<intptr_t>(failure))); | 3927 __ mov(r0, Operand(reinterpret_cast<intptr_t>(failure))); |
| 3926 } | 3928 } |
| 3929 GenerateCore(masm, &throw_normal_exception, |
| 3930 &throw_out_of_memory_exception, |
| 3931 frame_type, |
| 3932 FLAG_gc_greedy); |
| 3933 |
| 3934 // Do space-specific GC and retry runtime call. |
| 3927 GenerateCore(masm, | 3935 GenerateCore(masm, |
| 3928 &throw_normal_exception, | 3936 &throw_normal_exception, |
| 3929 &throw_out_of_memory_exception, | 3937 &throw_out_of_memory_exception, |
| 3930 frame_type, | 3938 frame_type, |
| 3931 FLAG_gc_greedy); | 3939 true); |
| 3932 #else | 3940 |
| 3941 // Do full GC and retry runtime call one final time. |
| 3942 Failure* failure = Failure::InternalError(); |
| 3943 __ mov(r0, Operand(reinterpret_cast<int32_t>(failure))); |
| 3933 GenerateCore(masm, | 3944 GenerateCore(masm, |
| 3934 &throw_normal_exception, | 3945 &throw_normal_exception, |
| 3935 &throw_out_of_memory_exception, | 3946 &throw_out_of_memory_exception, |
| 3936 frame_type, | |
| 3937 false); | |
| 3938 #endif | |
| 3939 GenerateCore(masm, | |
| 3940 &throw_normal_exception, | |
| 3941 &throw_out_of_memory_exception, | |
| 3942 frame_type, | 3947 frame_type, |
| 3943 true); | 3948 true); |
| 3944 | 3949 |
| 3945 __ bind(&throw_out_of_memory_exception); | 3950 __ bind(&throw_out_of_memory_exception); |
| 3946 GenerateThrowOutOfMemory(masm); | 3951 GenerateThrowOutOfMemory(masm); |
| 3947 // control flow for generated will not return. | 3952 // control flow for generated will not return. |
| 3948 | 3953 |
| 3949 __ bind(&throw_normal_exception); | 3954 __ bind(&throw_normal_exception); |
| 3950 GenerateThrowTOS(masm); | 3955 GenerateThrowTOS(masm); |
| 3951 } | 3956 } |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4184 // Slow-case: Non-function called. | 4189 // Slow-case: Non-function called. |
| 4185 __ bind(&slow); | 4190 __ bind(&slow); |
| 4186 __ mov(r0, Operand(argc_)); // Setup the number of arguments. | 4191 __ mov(r0, Operand(argc_)); // Setup the number of arguments. |
| 4187 __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); | 4192 __ InvokeBuiltin(Builtins::CALL_NON_FUNCTION, JUMP_JS); |
| 4188 } | 4193 } |
| 4189 | 4194 |
| 4190 | 4195 |
| 4191 #undef __ | 4196 #undef __ |
| 4192 | 4197 |
| 4193 } } // namespace v8::internal | 4198 } } // namespace v8::internal |
| OLD | NEW |