Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(656)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 104013008: Reland v8:18458 "Load the global proxy from the context of the target function." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 3175
3176 __ bind(&done); 3176 __ bind(&done);
3177 } 3177 }
3178 3178
3179 3179
3180 void CallFunctionStub::Generate(MacroAssembler* masm) { 3180 void CallFunctionStub::Generate(MacroAssembler* masm) {
3181 // r1 : the function to call 3181 // r1 : the function to call
3182 // r2 : cache cell for call target 3182 // r2 : cache cell for call target
3183 Label slow, non_function; 3183 Label slow, non_function;
3184 3184
3185 // Check that the function is really a JavaScript function.
3186 // r1: pushed function (to be verified)
3187 __ JumpIfSmi(r1, &non_function);
3188
3185 // The receiver might implicitly be the global object. This is 3189 // The receiver might implicitly be the global object. This is
3186 // indicated by passing the hole as the receiver to the call 3190 // indicated by passing the hole as the receiver to the call
3187 // function stub. 3191 // function stub.
3188 if (ReceiverMightBeImplicit()) { 3192 if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) {
3189 Label call; 3193 Label try_call, call, patch_current_context;
3190 // Get the receiver from the stack. 3194 if (ReceiverMightBeImplicit()) {
3191 // function, receiver [, arguments] 3195 // Get the receiver from the stack.
3192 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize)); 3196 // function, receiver [, arguments]
3193 // Call as function is indicated with the hole. 3197 __ ldr(r4, MemOperand(sp, argc_ * kPointerSize));
3194 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); 3198 // Call as function is indicated with the hole.
3195 __ b(ne, &call); 3199 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
3200 __ b(ne, &try_call);
3201 }
3196 // Patch the receiver on the stack with the global receiver object. 3202 // Patch the receiver on the stack with the global receiver object.
3197 __ ldr(r3, 3203 // Goto slow case if we do not have a function.
3198 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 3204 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE);
3199 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalReceiverOffset)); 3205 __ b(ne, &patch_current_context);
3206 CallStubCompiler::FetchGlobalProxy(masm, r3, r1);
3200 __ str(r3, MemOperand(sp, argc_ * kPointerSize)); 3207 __ str(r3, MemOperand(sp, argc_ * kPointerSize));
3208 __ jmp(&call);
3209
3210 __ bind(&patch_current_context);
3211 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
3212 __ str(r4, MemOperand(sp, argc_ * kPointerSize));
3213 __ jmp(&slow);
3214
3215 __ bind(&try_call);
3216 // Get the map of the function object.
3217 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE);
3218 __ b(ne, &slow);
3219
3201 __ bind(&call); 3220 __ bind(&call);
3221 } else {
3222 // Get the map of the function object.
3223 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE);
3224 __ b(ne, &slow);
3202 } 3225 }
3203 3226
3204 // Check that the function is really a JavaScript function.
3205 // r1: pushed function (to be verified)
3206 __ JumpIfSmi(r1, &non_function);
3207 // Get the map of the function object.
3208 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE);
3209 __ b(ne, &slow);
3210
3211 if (RecordCallTarget()) { 3227 if (RecordCallTarget()) {
3212 GenerateRecordCallTarget(masm); 3228 GenerateRecordCallTarget(masm);
3213 } 3229 }
3214 3230
3215 // Fast-case: Invoke the function now. 3231 // Fast-case: Invoke the function now.
3216 // r1: pushed function 3232 // r1: pushed function
3217 ParameterCount actual(argc_); 3233 ParameterCount actual(argc_);
3218 3234
3219 if (ReceiverMightBeImplicit()) { 3235 if (ReceiverMightBeImplicit()) {
3220 Label call_as_function; 3236 Label call_as_function;
(...skipping 23 matching lines...) Expand all
3244 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 3260 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3245 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset)); 3261 __ str(ip, FieldMemOperand(r2, Cell::kValueOffset));
3246 } 3262 }
3247 // Check for function proxy. 3263 // Check for function proxy.
3248 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE)); 3264 __ cmp(r3, Operand(JS_FUNCTION_PROXY_TYPE));
3249 __ b(ne, &non_function); 3265 __ b(ne, &non_function);
3250 __ push(r1); // put proxy as additional argument 3266 __ push(r1); // put proxy as additional argument
3251 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32)); 3267 __ mov(r0, Operand(argc_ + 1, RelocInfo::NONE32));
3252 __ mov(r2, Operand::Zero()); 3268 __ mov(r2, Operand::Zero());
3253 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); 3269 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY);
3254 __ SetCallKind(r5, CALL_AS_METHOD); 3270 __ SetCallKind(r5, CALL_AS_FUNCTION);
3255 { 3271 {
3256 Handle<Code> adaptor = 3272 Handle<Code> adaptor =
3257 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 3273 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
3258 __ Jump(adaptor, RelocInfo::CODE_TARGET); 3274 __ Jump(adaptor, RelocInfo::CODE_TARGET);
3259 } 3275 }
3260 3276
3261 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 3277 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
3262 // of the original receiver from the call site). 3278 // of the original receiver from the call site).
3263 __ bind(&non_function); 3279 __ bind(&non_function);
3264 __ str(r1, MemOperand(sp, argc_ * kPointerSize)); 3280 __ str(r1, MemOperand(sp, argc_ * kPointerSize));
(...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after
5838 __ bind(&fast_elements_case); 5854 __ bind(&fast_elements_case);
5839 GenerateCase(masm, FAST_ELEMENTS); 5855 GenerateCase(masm, FAST_ELEMENTS);
5840 } 5856 }
5841 5857
5842 5858
5843 #undef __ 5859 #undef __
5844 5860
5845 } } // namespace v8::internal 5861 } } // namespace v8::internal
5846 5862
5847 #endif // V8_TARGET_ARCH_ARM 5863 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698