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