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

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

Issue 8318014: Make _CallFunction proxy-aware. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Kevin's comment. Created 9 years, 1 month 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/runtime.js ('k') | src/x64/debug-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3324 matching lines...) Expand 10 before | Expand all | Expand 10 after
3335 } 3335 }
3336 3336
3337 3337
3338 Object* CallFunctionStub::GetCachedValue(Address address) { 3338 Object* CallFunctionStub::GetCachedValue(Address address) {
3339 UNREACHABLE(); 3339 UNREACHABLE();
3340 return NULL; 3340 return NULL;
3341 } 3341 }
3342 3342
3343 3343
3344 void CallFunctionStub::Generate(MacroAssembler* masm) { 3344 void CallFunctionStub::Generate(MacroAssembler* masm) {
3345 // rdi : the function to call
3345 Label slow, non_function; 3346 Label slow, non_function;
3346 3347
3347 // The receiver might implicitly be the global object. This is 3348 // The receiver might implicitly be the global object. This is
3348 // indicated by passing the hole as the receiver to the call 3349 // indicated by passing the hole as the receiver to the call
3349 // function stub. 3350 // function stub.
3350 if (ReceiverMightBeImplicit()) { 3351 if (ReceiverMightBeImplicit()) {
3351 Label call; 3352 Label call;
3352 // Get the receiver from the stack. 3353 // Get the receiver from the stack.
3353 // +1 ~ return address 3354 // +1 ~ return address
3354 __ movq(rax, Operand(rsp, (argc_ + 1) * kPointerSize)); 3355 __ movq(rax, Operand(rsp, (argc_ + 1) * kPointerSize));
3355 // Call as function is indicated with the hole. 3356 // Call as function is indicated with the hole.
3356 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 3357 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
3357 __ j(not_equal, &call, Label::kNear); 3358 __ j(not_equal, &call, Label::kNear);
3358 // Patch the receiver on the stack with the global receiver object. 3359 // Patch the receiver on the stack with the global receiver object.
3359 __ movq(rbx, GlobalObjectOperand()); 3360 __ movq(rbx, GlobalObjectOperand());
3360 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset)); 3361 __ movq(rbx, FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset));
3361 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rbx); 3362 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rbx);
3362 __ bind(&call); 3363 __ bind(&call);
3363 } 3364 }
3364 3365
3365 // Get the function to call from the stack.
3366 // +2 ~ receiver, return address
3367 __ movq(rdi, Operand(rsp, (argc_ + 2) * kPointerSize));
3368
3369 // Check that the function really is a JavaScript function. 3366 // Check that the function really is a JavaScript function.
3370 __ JumpIfSmi(rdi, &non_function); 3367 __ JumpIfSmi(rdi, &non_function);
3371 // Goto slow case if we do not have a function. 3368 // Goto slow case if we do not have a function.
3372 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 3369 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
3373 __ j(not_equal, &slow); 3370 __ j(not_equal, &slow);
3374 3371
3375 // Fast-case: Just invoke the function. 3372 // Fast-case: Just invoke the function.
3376 ParameterCount actual(argc_); 3373 ParameterCount actual(argc_);
3377 3374
3378 if (ReceiverMightBeImplicit()) { 3375 if (ReceiverMightBeImplicit()) {
(...skipping 16 matching lines...) Expand all
3395 // Slow-case: Non-function called. 3392 // Slow-case: Non-function called.
3396 __ bind(&slow); 3393 __ bind(&slow);
3397 // Check for function proxy. 3394 // Check for function proxy.
3398 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); 3395 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
3399 __ j(not_equal, &non_function); 3396 __ j(not_equal, &non_function);
3400 __ pop(rcx); 3397 __ pop(rcx);
3401 __ push(rdi); // put proxy as additional argument under return address 3398 __ push(rdi); // put proxy as additional argument under return address
3402 __ push(rcx); 3399 __ push(rcx);
3403 __ Set(rax, argc_ + 1); 3400 __ Set(rax, argc_ + 1);
3404 __ Set(rbx, 0); 3401 __ Set(rbx, 0);
3405 __ SetCallKind(rcx, CALL_AS_FUNCTION); 3402 __ SetCallKind(rcx, CALL_AS_METHOD);
3406 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); 3403 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
3407 { 3404 {
3408 Handle<Code> adaptor = 3405 Handle<Code> adaptor =
3409 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 3406 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
3410 __ jmp(adaptor, RelocInfo::CODE_TARGET); 3407 __ jmp(adaptor, RelocInfo::CODE_TARGET);
3411 } 3408 }
3412 3409
3413 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 3410 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
3414 // of the original receiver from the call site). 3411 // of the original receiver from the call site).
3415 __ bind(&non_function); 3412 __ bind(&non_function);
(...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after
6092 OMIT_SMI_CHECK); 6089 OMIT_SMI_CHECK);
6093 __ pop(rax); 6090 __ pop(rax);
6094 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 6091 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
6095 } 6092 }
6096 6093
6097 #undef __ 6094 #undef __
6098 6095
6099 } } // namespace v8::internal 6096 } } // namespace v8::internal
6100 6097
6101 #endif // V8_TARGET_ARCH_X64 6098 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.js ('k') | src/x64/debug-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698