| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 argc + kFastApiCallArguments + 1, | 632 argc + kFastApiCallArguments + 1, |
| 633 return_value_operand, | 633 return_value_operand, |
| 634 restore_context ? &context_restore_operand : NULL); | 634 restore_context ? &context_restore_operand : NULL); |
| 635 } | 635 } |
| 636 | 636 |
| 637 | 637 |
| 638 class CallInterceptorCompiler BASE_EMBEDDED { | 638 class CallInterceptorCompiler BASE_EMBEDDED { |
| 639 public: | 639 public: |
| 640 CallInterceptorCompiler(CallStubCompiler* stub_compiler, | 640 CallInterceptorCompiler(CallStubCompiler* stub_compiler, |
| 641 const ParameterCount& arguments, | 641 const ParameterCount& arguments, |
| 642 Register name, | 642 Register name) |
| 643 ExtraICState extra_ic_state) | |
| 644 : stub_compiler_(stub_compiler), | 643 : stub_compiler_(stub_compiler), |
| 645 arguments_(arguments), | 644 arguments_(arguments), |
| 646 name_(name), | 645 name_(name) {} |
| 647 extra_ic_state_(extra_ic_state) {} | |
| 648 | 646 |
| 649 void Compile(MacroAssembler* masm, | 647 void Compile(MacroAssembler* masm, |
| 650 Handle<JSObject> object, | 648 Handle<JSObject> object, |
| 651 Handle<JSObject> holder, | 649 Handle<JSObject> holder, |
| 652 Handle<Name> name, | 650 Handle<Name> name, |
| 653 LookupResult* lookup, | 651 LookupResult* lookup, |
| 654 Register receiver, | 652 Register receiver, |
| 655 Register scratch1, | 653 Register scratch1, |
| 656 Register scratch2, | 654 Register scratch2, |
| 657 Register scratch3, | 655 Register scratch3, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 LoadWithInterceptor(masm, receiver, holder, interceptor_holder, | 724 LoadWithInterceptor(masm, receiver, holder, interceptor_holder, |
| 727 ®ular_invoke); | 725 ®ular_invoke); |
| 728 | 726 |
| 729 // Interceptor returned nothing for this property. Try to use cached | 727 // Interceptor returned nothing for this property. Try to use cached |
| 730 // constant function. | 728 // constant function. |
| 731 | 729 |
| 732 // Check that the maps from interceptor's holder to constant function's | 730 // Check that the maps from interceptor's holder to constant function's |
| 733 // holder haven't changed and thus we can use cached constant function. | 731 // holder haven't changed and thus we can use cached constant function. |
| 734 if (*interceptor_holder != lookup->holder()) { | 732 if (*interceptor_holder != lookup->holder()) { |
| 735 stub_compiler_->CheckPrototypes( | 733 stub_compiler_->CheckPrototypes( |
| 736 IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver, | 734 IC::CurrentTypeOf(interceptor_holder, masm->isolate()), holder, |
| 737 handle(lookup->holder()), scratch1, scratch2, scratch3, | 735 handle(lookup->holder()), scratch1, scratch2, scratch3, |
| 738 name, depth2, miss); | 736 name, depth2, miss); |
| 739 } else { | 737 } else { |
| 740 // CheckPrototypes has a side effect of fetching a 'holder' | 738 // CheckPrototypes has a side effect of fetching a 'holder' |
| 741 // for API (object which is instanceof for the signature). It's | 739 // for API (object which is instanceof for the signature). It's |
| 742 // safe to omit it here, as if present, it should be fetched | 740 // safe to omit it here, as if present, it should be fetched |
| 743 // by the previous CheckPrototypes. | 741 // by the previous CheckPrototypes. |
| 744 ASSERT(depth2 == kInvalidProtoDepth); | 742 ASSERT(depth2 == kInvalidProtoDepth); |
| 745 } | 743 } |
| 746 | 744 |
| 747 // Invoke function. | 745 // Invoke function. |
| 748 if (can_do_fast_api_call) { | 746 if (can_do_fast_api_call) { |
| 749 GenerateFastApiCall(masm, optimization, arguments_.immediate()); | 747 GenerateFastApiCall(masm, optimization, arguments_.immediate()); |
| 750 } else { | 748 } else { |
| 751 Handle<JSFunction> fun = optimization.constant_function(); | 749 Handle<JSFunction> fun = optimization.constant_function(); |
| 752 stub_compiler_->GenerateJumpFunctionIgnoreReceiver(fun); | 750 stub_compiler_->GenerateJumpFunction(object, fun); |
| 753 } | 751 } |
| 754 | 752 |
| 755 // Deferred code for fast API call case---clean preallocated space. | 753 // Deferred code for fast API call case---clean preallocated space. |
| 756 if (can_do_fast_api_call) { | 754 if (can_do_fast_api_call) { |
| 757 __ bind(&miss_cleanup); | 755 __ bind(&miss_cleanup); |
| 758 FreeSpaceForFastApiCall(masm, scratch1); | 756 FreeSpaceForFastApiCall(masm, scratch1); |
| 759 __ jmp(miss_label); | 757 __ jmp(miss_label); |
| 760 } | 758 } |
| 761 | 759 |
| 762 // Invoke a regular function. | 760 // Invoke a regular function. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 // Leave the internal frame. | 792 // Leave the internal frame. |
| 795 } | 793 } |
| 796 | 794 |
| 797 void LoadWithInterceptor(MacroAssembler* masm, | 795 void LoadWithInterceptor(MacroAssembler* masm, |
| 798 Register receiver, | 796 Register receiver, |
| 799 Register holder, | 797 Register holder, |
| 800 Handle<JSObject> holder_obj, | 798 Handle<JSObject> holder_obj, |
| 801 Label* interceptor_succeeded) { | 799 Label* interceptor_succeeded) { |
| 802 { | 800 { |
| 803 FrameScope scope(masm, StackFrame::INTERNAL); | 801 FrameScope scope(masm, StackFrame::INTERNAL); |
| 804 __ push(holder); // Save the holder. | 802 __ push(receiver); |
| 805 __ push(name_); // Save the name. | 803 __ push(holder); |
| 804 __ push(name_); |
| 806 | 805 |
| 807 CompileCallLoadPropertyWithInterceptor( | 806 CompileCallLoadPropertyWithInterceptor( |
| 808 masm, receiver, holder, name_, holder_obj, | 807 masm, receiver, holder, name_, holder_obj, |
| 809 IC::kLoadPropertyWithInterceptorOnly); | 808 IC::kLoadPropertyWithInterceptorOnly); |
| 810 | 809 |
| 811 __ pop(name_); // Restore the name. | 810 __ pop(name_); |
| 812 __ pop(receiver); // Restore the holder. | 811 __ pop(holder); |
| 812 __ pop(receiver); |
| 813 // Leave the internal frame. | 813 // Leave the internal frame. |
| 814 } | 814 } |
| 815 | 815 |
| 816 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); | 816 __ CompareRoot(rax, Heap::kNoInterceptorResultSentinelRootIndex); |
| 817 __ j(not_equal, interceptor_succeeded); | 817 __ j(not_equal, interceptor_succeeded); |
| 818 } | 818 } |
| 819 | 819 |
| 820 CallStubCompiler* stub_compiler_; | 820 CallStubCompiler* stub_compiler_; |
| 821 const ParameterCount& arguments_; | 821 const ParameterCount& arguments_; |
| 822 Register name_; | 822 Register name_; |
| 823 ExtraICState extra_ic_state_; | |
| 824 }; | 823 }; |
| 825 | 824 |
| 826 | 825 |
| 827 void StoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, | 826 void StoreStubCompiler::GenerateRestoreName(MacroAssembler* masm, |
| 828 Label* label, | 827 Label* label, |
| 829 Handle<Name> name) { | 828 Handle<Name> name) { |
| 830 if (!label->is_unused()) { | 829 if (!label->is_unused()) { |
| 831 __ bind(label); | 830 __ bind(label); |
| 832 __ Move(this->name(), name); | 831 __ Move(this->name(), name); |
| 833 } | 832 } |
| (...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2490 Label miss; | 2489 Label miss; |
| 2491 GenerateNameCheck(name, &miss); | 2490 GenerateNameCheck(name, &miss); |
| 2492 | 2491 |
| 2493 LookupResult lookup(isolate()); | 2492 LookupResult lookup(isolate()); |
| 2494 LookupPostInterceptor(holder, name, &lookup); | 2493 LookupPostInterceptor(holder, name, &lookup); |
| 2495 | 2494 |
| 2496 // Get the receiver from the stack. | 2495 // Get the receiver from the stack. |
| 2497 StackArgumentsAccessor args(rsp, arguments()); | 2496 StackArgumentsAccessor args(rsp, arguments()); |
| 2498 __ movq(rdx, args.GetReceiverOperand()); | 2497 __ movq(rdx, args.GetReceiverOperand()); |
| 2499 | 2498 |
| 2500 CallInterceptorCompiler compiler(this, arguments(), rcx, extra_state()); | 2499 CallInterceptorCompiler compiler(this, arguments(), rcx); |
| 2501 compiler.Compile(masm(), object, holder, name, &lookup, rdx, rbx, rdi, rax, | 2500 compiler.Compile(masm(), object, holder, name, &lookup, rdx, rbx, rdi, rax, |
| 2502 &miss); | 2501 &miss); |
| 2503 | 2502 |
| 2504 // Restore receiver. | 2503 // Restore receiver. |
| 2505 __ movq(rdx, args.GetReceiverOperand()); | 2504 __ movq(rdx, args.GetReceiverOperand()); |
| 2506 | 2505 |
| 2507 GenerateJumpFunction(object, rax, &miss); | 2506 GenerateJumpFunction(object, rax, &miss); |
| 2508 | 2507 |
| 2509 HandlerFrontendFooter(&miss); | 2508 HandlerFrontendFooter(&miss); |
| 2510 | 2509 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2911 // ----------------------------------- | 2910 // ----------------------------------- |
| 2912 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2911 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2913 } | 2912 } |
| 2914 | 2913 |
| 2915 | 2914 |
| 2916 #undef __ | 2915 #undef __ |
| 2917 | 2916 |
| 2918 } } // namespace v8::internal | 2917 } } // namespace v8::internal |
| 2919 | 2918 |
| 2920 #endif // V8_TARGET_ARCH_X64 | 2919 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |