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

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

Issue 93863006: Revert "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/x64/builtins-x64.cc ('k') | src/x64/full-codegen-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 } 2343 }
2344 2344
2345 2345
2346 void CallFunctionStub::Generate(MacroAssembler* masm) { 2346 void CallFunctionStub::Generate(MacroAssembler* masm) {
2347 // rbx : cache cell for call target 2347 // rbx : cache cell for call target
2348 // rdi : the function to call 2348 // rdi : the function to call
2349 Isolate* isolate = masm->isolate(); 2349 Isolate* isolate = masm->isolate();
2350 Label slow, non_function; 2350 Label slow, non_function;
2351 StackArgumentsAccessor args(rsp, argc_); 2351 StackArgumentsAccessor args(rsp, argc_);
2352 2352
2353 // Check that the function really is a JavaScript function.
2354 __ JumpIfSmi(rdi, &non_function);
2355
2356 // The receiver might implicitly be the global object. This is 2353 // The receiver might implicitly be the global object. This is
2357 // indicated by passing the hole as the receiver to the call 2354 // indicated by passing the hole as the receiver to the call
2358 // function stub. 2355 // function stub.
2359 if (ReceiverMightBeImplicit() || ReceiverIsImplicit()) { 2356 if (ReceiverMightBeImplicit()) {
2360 Label try_call, call, patch_current_context; 2357 Label call;
2361 if (ReceiverMightBeImplicit()) { 2358 // Get the receiver from the stack.
2362 // Get the receiver from the stack. 2359 __ movq(rax, args.GetReceiverOperand());
2363 __ movq(rax, args.GetReceiverOperand()); 2360 // Call as function is indicated with the hole.
2364 // Call as function is indicated with the hole. 2361 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
2365 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 2362 __ j(not_equal, &call, Label::kNear);
2366 __ j(not_equal, &try_call, Label::kNear);
2367 }
2368 // Patch the receiver on the stack with the global receiver object. 2363 // Patch the receiver on the stack with the global receiver object.
2369 // Goto slow case if we do not have a function. 2364 __ movq(rcx, GlobalObjectOperand());
2370 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 2365 __ movq(rcx, FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
2371 __ j(not_equal, &patch_current_context);
2372 CallStubCompiler::FetchGlobalProxy(masm, rcx, rdi);
2373 __ movq(args.GetReceiverOperand(), rcx); 2366 __ movq(args.GetReceiverOperand(), rcx);
2374 __ jmp(&call, Label::kNear); 2367 __ bind(&call);
2368 }
2375 2369
2376 __ bind(&patch_current_context); 2370 // Check that the function really is a JavaScript function.
2377 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); 2371 __ JumpIfSmi(rdi, &non_function);
2378 __ movq(args.GetReceiverOperand(), kScratchRegister); 2372 // Goto slow case if we do not have a function.
2379 __ jmp(&slow); 2373 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2380 2374 __ j(not_equal, &slow);
2381 __ bind(&try_call);
2382 // Goto slow case if we do not have a function.
2383 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2384 __ j(not_equal, &slow);
2385
2386 __ bind(&call);
2387 } else {
2388 // Goto slow case if we do not have a function.
2389 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2390 __ j(not_equal, &slow);
2391 }
2392 2375
2393 if (RecordCallTarget()) { 2376 if (RecordCallTarget()) {
2394 GenerateRecordCallTarget(masm); 2377 GenerateRecordCallTarget(masm);
2395 } 2378 }
2396 2379
2397 // Fast-case: Just invoke the function. 2380 // Fast-case: Just invoke the function.
2398 ParameterCount actual(argc_); 2381 ParameterCount actual(argc_);
2399 2382
2400 if (ReceiverMightBeImplicit()) { 2383 if (ReceiverMightBeImplicit()) {
2401 Label call_as_function; 2384 Label call_as_function;
(...skipping 22 matching lines...) Expand all
2424 TypeFeedbackCells::MegamorphicSentinel(isolate)); 2407 TypeFeedbackCells::MegamorphicSentinel(isolate));
2425 } 2408 }
2426 // Check for function proxy. 2409 // Check for function proxy.
2427 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE); 2410 __ CmpInstanceType(rcx, JS_FUNCTION_PROXY_TYPE);
2428 __ j(not_equal, &non_function); 2411 __ j(not_equal, &non_function);
2429 __ PopReturnAddressTo(rcx); 2412 __ PopReturnAddressTo(rcx);
2430 __ push(rdi); // put proxy as additional argument under return address 2413 __ push(rdi); // put proxy as additional argument under return address
2431 __ PushReturnAddressFrom(rcx); 2414 __ PushReturnAddressFrom(rcx);
2432 __ Set(rax, argc_ + 1); 2415 __ Set(rax, argc_ + 1);
2433 __ Set(rbx, 0); 2416 __ Set(rbx, 0);
2434 __ SetCallKind(rcx, CALL_AS_FUNCTION); 2417 __ SetCallKind(rcx, CALL_AS_METHOD);
2435 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY); 2418 __ GetBuiltinEntry(rdx, Builtins::CALL_FUNCTION_PROXY);
2436 { 2419 {
2437 Handle<Code> adaptor = 2420 Handle<Code> adaptor =
2438 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 2421 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
2439 __ jmp(adaptor, RelocInfo::CODE_TARGET); 2422 __ jmp(adaptor, RelocInfo::CODE_TARGET);
2440 } 2423 }
2441 2424
2442 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 2425 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
2443 // of the original receiver from the call site). 2426 // of the original receiver from the call site).
2444 __ bind(&non_function); 2427 __ bind(&non_function);
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after
5538 __ bind(&fast_elements_case); 5521 __ bind(&fast_elements_case);
5539 GenerateCase(masm, FAST_ELEMENTS); 5522 GenerateCase(masm, FAST_ELEMENTS);
5540 } 5523 }
5541 5524
5542 5525
5543 #undef __ 5526 #undef __
5544 5527
5545 } } // namespace v8::internal 5528 } } // namespace v8::internal
5546 5529
5547 #endif // V8_TARGET_ARCH_X64 5530 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698