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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 111613003: Load the global proxy from the context of the target function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: hydrogen Created 7 years 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
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 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 Label success; 2371 Label success;
2372 // Check that the object is a boolean. 2372 // Check that the object is a boolean.
2373 __ CompareRoot(object, Heap::kTrueValueRootIndex); 2373 __ CompareRoot(object, Heap::kTrueValueRootIndex);
2374 __ j(equal, &success); 2374 __ j(equal, &success);
2375 __ CompareRoot(object, Heap::kFalseValueRootIndex); 2375 __ CompareRoot(object, Heap::kFalseValueRootIndex);
2376 __ j(not_equal, miss); 2376 __ j(not_equal, miss);
2377 __ bind(&success); 2377 __ bind(&success);
2378 } 2378 }
2379 2379
2380 2380
2381 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { 2381 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object,
2382 Handle<JSFunction> function) {
2382 if (object->IsGlobalObject()) { 2383 if (object->IsGlobalObject()) {
2383 StackArgumentsAccessor args(rsp, arguments()); 2384 StackArgumentsAccessor args(rsp, arguments());
2384 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 2385 __ MoveHeapObject(rdx, handle(function->context()->global_proxy()));
2385 __ movq(args.GetReceiverOperand(), rdx); 2386 __ movq(args.GetReceiverOperand(), rdx);
2386 } 2387 }
2387 } 2388 }
2388 2389
2389 2390
2390 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, 2391 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object,
2391 Handle<JSObject> holder, 2392 Handle<JSObject> holder,
2392 Handle<Name> name, 2393 Handle<Name> name,
2393 CheckType check, 2394 CheckType check,
2394 Label* miss) { 2395 Label* miss) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2468 } 2469 }
2469 2470
2470 2471
2471 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, 2472 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
2472 Register function, 2473 Register function,
2473 Label* miss) { 2474 Label* miss) {
2474 // Check that the function really is a function. 2475 // Check that the function really is a function.
2475 GenerateFunctionCheck(function, rbx, miss); 2476 GenerateFunctionCheck(function, rbx, miss);
2476 2477
2477 if (!function.is(rdi)) __ movq(rdi, function); 2478 if (!function.is(rdi)) __ movq(rdi, function);
2478 PatchGlobalProxy(object); 2479 PatchGlobalProxy(object, function);
2479 2480
2480 // Invoke the function. 2481 // Invoke the function.
2481 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, 2482 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION,
2482 NullCallWrapper(), call_kind()); 2483 NullCallWrapper(), call_kind());
2483 } 2484 }
2484 2485
2485 2486
2486 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, 2487 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
2487 Handle<JSObject> holder, 2488 Handle<JSObject> holder,
2488 Handle<Name> name) { 2489 Handle<Name> name) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2581 2582
2582 // Return the generated code. 2583 // Return the generated code.
2583 return GetCode(kind(), Code::FAST, name); 2584 return GetCode(kind(), Code::FAST, name);
2584 } 2585 }
2585 2586
2586 2587
2587 #undef __ 2588 #undef __
2588 #define __ ACCESS_MASM(masm) 2589 #define __ ACCESS_MASM(masm)
2589 2590
2590 2591
2592 void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm,
2593 Register function,
2594 Register target) {
2595 __ movq(target, FieldOperand(function, JSFunction::kContextOffset));
2596 __ movq(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX));
2597 __ movq(target, FieldOperand(target, GlobalObject::kGlobalReceiverOffset));
2598 }
2599
2600
2591 void StoreStubCompiler::GenerateStoreViaSetter( 2601 void StoreStubCompiler::GenerateStoreViaSetter(
2592 MacroAssembler* masm, 2602 MacroAssembler* masm,
2593 Handle<JSFunction> setter) { 2603 Handle<JSFunction> setter) {
2594 // ----------- S t a t e ------------- 2604 // ----------- S t a t e -------------
2595 // -- rax : value 2605 // -- rax : value
2596 // -- rcx : name 2606 // -- rcx : name
2597 // -- rdx : receiver 2607 // -- rdx : receiver
2598 // -- rsp[0] : return address 2608 // -- rsp[0] : return address
2599 // ----------------------------------- 2609 // -----------------------------------
2600 { 2610 {
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2910 // ----------------------------------- 2920 // -----------------------------------
2911 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 2921 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
2912 } 2922 }
2913 2923
2914 2924
2915 #undef __ 2925 #undef __
2916 2926
2917 } } // namespace v8::internal 2927 } } // namespace v8::internal
2918 2928
2919 #endif // V8_TARGET_ARCH_X64 2929 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698