| 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 return_value_operand, | 640 return_value_operand, |
| 641 restore_context ? | 641 restore_context ? |
| 642 &context_restore_operand : NULL); | 642 &context_restore_operand : NULL); |
| 643 } | 643 } |
| 644 | 644 |
| 645 | 645 |
| 646 class CallInterceptorCompiler BASE_EMBEDDED { | 646 class CallInterceptorCompiler BASE_EMBEDDED { |
| 647 public: | 647 public: |
| 648 CallInterceptorCompiler(CallStubCompiler* stub_compiler, | 648 CallInterceptorCompiler(CallStubCompiler* stub_compiler, |
| 649 const ParameterCount& arguments, | 649 const ParameterCount& arguments, |
| 650 Register name, | 650 Register name) |
| 651 ExtraICState extra_state) | |
| 652 : stub_compiler_(stub_compiler), | 651 : stub_compiler_(stub_compiler), |
| 653 arguments_(arguments), | 652 arguments_(arguments), |
| 654 name_(name) {} | 653 name_(name) {} |
| 655 | 654 |
| 656 void Compile(MacroAssembler* masm, | 655 void Compile(MacroAssembler* masm, |
| 657 Handle<JSObject> object, | 656 Handle<JSObject> object, |
| 658 Handle<JSObject> holder, | 657 Handle<JSObject> holder, |
| 659 Handle<Name> name, | 658 Handle<Name> name, |
| 660 LookupResult* lookup, | 659 LookupResult* lookup, |
| 661 Register receiver, | 660 Register receiver, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 LoadWithInterceptor(masm, receiver, holder, interceptor_holder, | 732 LoadWithInterceptor(masm, receiver, holder, interceptor_holder, |
| 734 ®ular_invoke); | 733 ®ular_invoke); |
| 735 | 734 |
| 736 // Interceptor returned nothing for this property. Try to use cached | 735 // Interceptor returned nothing for this property. Try to use cached |
| 737 // constant function. | 736 // constant function. |
| 738 | 737 |
| 739 // Check that the maps from interceptor's holder to constant function's | 738 // Check that the maps from interceptor's holder to constant function's |
| 740 // holder haven't changed and thus we can use cached constant function. | 739 // holder haven't changed and thus we can use cached constant function. |
| 741 if (*interceptor_holder != lookup->holder()) { | 740 if (*interceptor_holder != lookup->holder()) { |
| 742 stub_compiler_->CheckPrototypes( | 741 stub_compiler_->CheckPrototypes( |
| 743 IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver, | 742 IC::CurrentTypeOf(interceptor_holder, masm->isolate()), holder, |
| 744 handle(lookup->holder()), scratch1, scratch2, scratch3, | 743 handle(lookup->holder()), scratch1, scratch2, scratch3, |
| 745 name, depth2, miss); | 744 name, depth2, miss); |
| 746 } else { | 745 } else { |
| 747 // CheckPrototypes has a side effect of fetching a 'holder' | 746 // CheckPrototypes has a side effect of fetching a 'holder' |
| 748 // for API (object which is instanceof for the signature). It's | 747 // for API (object which is instanceof for the signature). It's |
| 749 // safe to omit it here, as if present, it should be fetched | 748 // safe to omit it here, as if present, it should be fetched |
| 750 // by the previous CheckPrototypes. | 749 // by the previous CheckPrototypes. |
| 751 ASSERT(depth2 == kInvalidProtoDepth); | 750 ASSERT(depth2 == kInvalidProtoDepth); |
| 752 } | 751 } |
| 753 | 752 |
| 754 // Invoke function. | 753 // Invoke function. |
| 755 if (can_do_fast_api_call) { | 754 if (can_do_fast_api_call) { |
| 756 GenerateFastApiCall(masm, optimization, arguments_.immediate()); | 755 GenerateFastApiCall(masm, optimization, arguments_.immediate()); |
| 757 } else { | 756 } else { |
| 758 Handle<JSFunction> fun = optimization.constant_function(); | 757 Handle<JSFunction> fun = optimization.constant_function(); |
| 759 stub_compiler_->GenerateJumpFunctionIgnoreReceiver(fun); | 758 stub_compiler_->GenerateJumpFunction(object, fun); |
| 760 } | 759 } |
| 761 | 760 |
| 762 // Deferred code for fast API call case---clean preallocated space. | 761 // Deferred code for fast API call case---clean preallocated space. |
| 763 if (can_do_fast_api_call) { | 762 if (can_do_fast_api_call) { |
| 764 __ bind(&miss_cleanup); | 763 __ bind(&miss_cleanup); |
| 765 FreeSpaceForFastApiCall(masm, scratch1); | 764 FreeSpaceForFastApiCall(masm, scratch1); |
| 766 __ jmp(miss_label); | 765 __ jmp(miss_label); |
| 767 } | 766 } |
| 768 | 767 |
| 769 // Invoke a regular function. | 768 // Invoke a regular function. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 // Leave the internal frame. | 800 // Leave the internal frame. |
| 802 } | 801 } |
| 803 | 802 |
| 804 void LoadWithInterceptor(MacroAssembler* masm, | 803 void LoadWithInterceptor(MacroAssembler* masm, |
| 805 Register receiver, | 804 Register receiver, |
| 806 Register holder, | 805 Register holder, |
| 807 Handle<JSObject> holder_obj, | 806 Handle<JSObject> holder_obj, |
| 808 Label* interceptor_succeeded) { | 807 Label* interceptor_succeeded) { |
| 809 { | 808 { |
| 810 FrameScope scope(masm, StackFrame::INTERNAL); | 809 FrameScope scope(masm, StackFrame::INTERNAL); |
| 811 __ push(holder); // Save the holder. | 810 __ push(receiver); |
| 812 __ push(name_); // Save the name. | 811 __ push(holder); |
| 812 __ push(name_); |
| 813 | 813 |
| 814 CompileCallLoadPropertyWithInterceptor( | 814 CompileCallLoadPropertyWithInterceptor( |
| 815 masm, receiver, holder, name_, holder_obj, | 815 masm, receiver, holder, name_, holder_obj, |
| 816 IC::kLoadPropertyWithInterceptorOnly); | 816 IC::kLoadPropertyWithInterceptorOnly); |
| 817 | 817 |
| 818 __ pop(name_); // Restore the name. | 818 __ pop(name_); |
| 819 __ pop(receiver); // Restore the holder. | 819 __ pop(holder); |
| 820 __ pop(receiver); |
| 820 // Leave the internal frame. | 821 // Leave the internal frame. |
| 821 } | 822 } |
| 822 | 823 |
| 823 __ cmp(eax, masm->isolate()->factory()->no_interceptor_result_sentinel()); | 824 __ cmp(eax, masm->isolate()->factory()->no_interceptor_result_sentinel()); |
| 824 __ j(not_equal, interceptor_succeeded); | 825 __ j(not_equal, interceptor_succeeded); |
| 825 } | 826 } |
| 826 | 827 |
| 827 CallStubCompiler* stub_compiler_; | 828 CallStubCompiler* stub_compiler_; |
| 828 const ParameterCount& arguments_; | 829 const ParameterCount& arguments_; |
| 829 Register name_; | 830 Register name_; |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2582 | 2583 |
| 2583 // Get the number of arguments. | 2584 // Get the number of arguments. |
| 2584 const int argc = arguments().immediate(); | 2585 const int argc = arguments().immediate(); |
| 2585 | 2586 |
| 2586 LookupResult lookup(isolate()); | 2587 LookupResult lookup(isolate()); |
| 2587 LookupPostInterceptor(holder, name, &lookup); | 2588 LookupPostInterceptor(holder, name, &lookup); |
| 2588 | 2589 |
| 2589 // Get the receiver from the stack. | 2590 // Get the receiver from the stack. |
| 2590 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 2591 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 2591 | 2592 |
| 2592 CallInterceptorCompiler compiler(this, arguments(), ecx, extra_state()); | 2593 CallInterceptorCompiler compiler(this, arguments(), ecx); |
| 2593 compiler.Compile(masm(), object, holder, name, &lookup, edx, ebx, edi, eax, | 2594 compiler.Compile(masm(), object, holder, name, &lookup, edx, ebx, edi, eax, |
| 2594 &miss); | 2595 &miss); |
| 2595 | 2596 |
| 2596 // Restore receiver. | 2597 // Restore receiver. |
| 2597 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); | 2598 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
| 2598 | 2599 |
| 2599 GenerateJumpFunction(object, eax, &miss); | 2600 GenerateJumpFunction(object, eax, &miss); |
| 2600 | 2601 |
| 2601 HandlerFrontendFooter(&miss); | 2602 HandlerFrontendFooter(&miss); |
| 2602 | 2603 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2992 // ----------------------------------- | 2993 // ----------------------------------- |
| 2993 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2994 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2994 } | 2995 } |
| 2995 | 2996 |
| 2996 | 2997 |
| 2997 #undef __ | 2998 #undef __ |
| 2998 | 2999 |
| 2999 } } // namespace v8::internal | 3000 } } // namespace v8::internal |
| 3000 | 3001 |
| 3001 #endif // V8_TARGET_ARCH_IA32 | 3002 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |