| OLD | NEW |
| 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 2357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 Label success; | 2368 Label success; |
| 2369 // Check that the object is a boolean. | 2369 // Check that the object is a boolean. |
| 2370 __ CompareRoot(object, Heap::kTrueValueRootIndex); | 2370 __ CompareRoot(object, Heap::kTrueValueRootIndex); |
| 2371 __ j(equal, &success); | 2371 __ j(equal, &success); |
| 2372 __ CompareRoot(object, Heap::kFalseValueRootIndex); | 2372 __ CompareRoot(object, Heap::kFalseValueRootIndex); |
| 2373 __ j(not_equal, miss); | 2373 __ j(not_equal, miss); |
| 2374 __ bind(&success); | 2374 __ bind(&success); |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 | 2377 |
| 2378 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | 2378 void CallStubCompiler::PatchImplicitReceiver(Handle<Object> object) { |
| 2379 Handle<JSFunction> function) { | |
| 2380 if (object->IsGlobalObject()) { | 2379 if (object->IsGlobalObject()) { |
| 2381 StackArgumentsAccessor args(rsp, arguments()); | 2380 StackArgumentsAccessor args(rsp, arguments()); |
| 2382 __ MoveHeapObject(rdx, handle(function->context()->global_proxy())); | 2381 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
| 2383 __ movq(args.GetReceiverOperand(), rdx); | 2382 __ movq(args.GetReceiverOperand(), rdx); |
| 2384 } | 2383 } |
| 2385 } | 2384 } |
| 2386 | |
| 2387 | |
| 2388 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | |
| 2389 Register function) { | |
| 2390 if (object->IsGlobalObject()) { | |
| 2391 FetchGlobalProxy(masm(), rdx, function); | |
| 2392 StackArgumentsAccessor args(rsp, arguments().immediate()); | |
| 2393 __ movq(args.GetReceiverOperand(), rdx); | |
| 2394 } | |
| 2395 } | |
| 2396 | 2385 |
| 2397 | 2386 |
| 2398 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2387 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
| 2399 Handle<JSObject> holder, | 2388 Handle<JSObject> holder, |
| 2400 Handle<Name> name, | 2389 Handle<Name> name, |
| 2401 CheckType check, | 2390 CheckType check, |
| 2402 Label* miss) { | 2391 Label* miss) { |
| 2403 GenerateNameCheck(name, miss); | 2392 GenerateNameCheck(name, miss); |
| 2404 | 2393 |
| 2405 Register reg = rdx; | 2394 Register reg = rdx; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 } | 2465 } |
| 2477 | 2466 |
| 2478 | 2467 |
| 2479 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2468 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
| 2480 Register function, | 2469 Register function, |
| 2481 Label* miss) { | 2470 Label* miss) { |
| 2482 // Check that the function really is a function. | 2471 // Check that the function really is a function. |
| 2483 GenerateFunctionCheck(function, rbx, miss); | 2472 GenerateFunctionCheck(function, rbx, miss); |
| 2484 | 2473 |
| 2485 if (!function.is(rdi)) __ movq(rdi, function); | 2474 if (!function.is(rdi)) __ movq(rdi, function); |
| 2486 PatchGlobalProxy(object, function); | 2475 PatchImplicitReceiver(object); |
| 2487 | 2476 |
| 2488 // Invoke the function. | 2477 // Invoke the function. |
| 2489 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, | 2478 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION, |
| 2490 NullCallWrapper(), call_kind()); | 2479 NullCallWrapper(), call_kind()); |
| 2491 } | 2480 } |
| 2492 | 2481 |
| 2493 | 2482 |
| 2494 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2483 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
| 2495 Handle<JSObject> holder, | 2484 Handle<JSObject> holder, |
| 2496 Handle<Name> name) { | 2485 Handle<Name> name) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2589 | 2578 |
| 2590 // Return the generated code. | 2579 // Return the generated code. |
| 2591 return GetCode(kind(), Code::FAST, name); | 2580 return GetCode(kind(), Code::FAST, name); |
| 2592 } | 2581 } |
| 2593 | 2582 |
| 2594 | 2583 |
| 2595 #undef __ | 2584 #undef __ |
| 2596 #define __ ACCESS_MASM(masm) | 2585 #define __ ACCESS_MASM(masm) |
| 2597 | 2586 |
| 2598 | 2587 |
| 2599 void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm, | |
| 2600 Register target, | |
| 2601 Register function) { | |
| 2602 __ movq(target, FieldOperand(function, JSFunction::kContextOffset)); | |
| 2603 __ movq(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX)); | |
| 2604 __ movq(target, FieldOperand(target, GlobalObject::kGlobalReceiverOffset)); | |
| 2605 } | |
| 2606 | |
| 2607 | |
| 2608 void StoreStubCompiler::GenerateStoreViaSetter( | 2588 void StoreStubCompiler::GenerateStoreViaSetter( |
| 2609 MacroAssembler* masm, | 2589 MacroAssembler* masm, |
| 2610 Handle<JSFunction> setter) { | 2590 Handle<JSFunction> setter) { |
| 2611 // ----------- S t a t e ------------- | 2591 // ----------- S t a t e ------------- |
| 2612 // -- rax : value | 2592 // -- rax : value |
| 2613 // -- rcx : name | 2593 // -- rcx : name |
| 2614 // -- rdx : receiver | 2594 // -- rdx : receiver |
| 2615 // -- rsp[0] : return address | 2595 // -- rsp[0] : return address |
| 2616 // ----------------------------------- | 2596 // ----------------------------------- |
| 2617 { | 2597 { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2927 // ----------------------------------- | 2907 // ----------------------------------- |
| 2928 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2908 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2929 } | 2909 } |
| 2930 | 2910 |
| 2931 | 2911 |
| 2932 #undef __ | 2912 #undef __ |
| 2933 | 2913 |
| 2934 } } // namespace v8::internal | 2914 } } // namespace v8::internal |
| 2935 | 2915 |
| 2936 #endif // V8_TARGET_ARCH_X64 | 2916 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |