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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months 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
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4670 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) { 4681 static void GenerateRecordCallTargetNoArray(MacroAssembler* masm) {
4682 // Cache the called function in a global property cell. Cache states 4682 // Cache the called function in a global property cell. Cache states
4683 // are uninitialized, monomorphic (indicated by a JSFunction), and 4683 // are uninitialized, monomorphic (indicated by a JSFunction), and
4684 // megamorphic. 4684 // megamorphic.
4685 // ebx : cache cell for call target 4685 // ebx : cache cell for call target
4686 // edi : the function to call 4686 // edi : the function to call
4687 Isolate* isolate = masm->isolate(); 4687 Isolate* isolate = masm->isolate();
4688 Label initialize, done; 4688 Label initialize, done;
4689 4689
4690 // Load the cache state into ecx. 4690 // Load the cache state into ecx.
4691 __ mov(ecx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset)); 4691 __ mov(ecx, FieldOperand(ebx, PropertyCell::kValueOffset));
4692 4692
4693 // A monomorphic cache hit or an already megamorphic state: invoke the 4693 // A monomorphic cache hit or an already megamorphic state: invoke the
4694 // function without changing the state. 4694 // function without changing the state.
4695 __ cmp(ecx, edi); 4695 __ cmp(ecx, edi);
4696 __ j(equal, &done, Label::kNear); 4696 __ j(equal, &done, Label::kNear);
4697 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4697 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4698 __ j(equal, &done, Label::kNear); 4698 __ j(equal, &done, Label::kNear);
4699 4699
4700 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 4700 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
4701 // megamorphic. 4701 // megamorphic.
4702 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate))); 4702 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate)));
4703 __ j(equal, &initialize, Label::kNear); 4703 __ j(equal, &initialize, Label::kNear);
4704 // MegamorphicSentinel is an immortal immovable object (undefined) so no 4704 // MegamorphicSentinel is an immortal immovable object (undefined) so no
4705 // write-barrier is needed. 4705 // write-barrier is needed.
4706 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), 4706 __ mov(FieldOperand(ebx, Cell::kValueOffset),
4707 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4707 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4708 __ jmp(&done, Label::kNear); 4708 __ jmp(&done, Label::kNear);
4709 4709
4710 // An uninitialized cache is patched with the function. 4710 // An uninitialized cache is patched with the function.
4711 __ bind(&initialize); 4711 __ bind(&initialize);
4712 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), edi); 4712 __ mov(FieldOperand(ebx, Cell::kValueOffset), edi);
4713 // No need for a write barrier here - cells are rescanned. 4713 // No need for a write barrier here - cells are rescanned.
4714 4714
4715 __ bind(&done); 4715 __ bind(&done);
4716 } 4716 }
4717 4717
4718 4718
4719 static void GenerateRecordCallTarget(MacroAssembler* masm) { 4719 static void GenerateRecordCallTarget(MacroAssembler* masm) {
4720 // Cache the called function in a global property cell. Cache states 4720 // Cache the called function in a global property cell. Cache states
4721 // are uninitialized, monomorphic (indicated by a JSFunction), and 4721 // are uninitialized, monomorphic (indicated by a JSFunction), and
4722 // megamorphic. 4722 // megamorphic.
4723 // ebx : cache cell for call target 4723 // ebx : cache cell for call target
4724 // edi : the function to call 4724 // edi : the function to call
4725 ASSERT(FLAG_optimize_constructed_arrays); 4725 ASSERT(FLAG_optimize_constructed_arrays);
4726 Isolate* isolate = masm->isolate(); 4726 Isolate* isolate = masm->isolate();
4727 Label initialize, done, miss, megamorphic, not_array_function; 4727 Label initialize, done, miss, megamorphic, not_array_function;
4728 4728
4729 // Load the cache state into ecx. 4729 // Load the cache state into ecx.
4730 __ mov(ecx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset)); 4730 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset));
4731 4731
4732 // A monomorphic cache hit or an already megamorphic state: invoke the 4732 // A monomorphic cache hit or an already megamorphic state: invoke the
4733 // function without changing the state. 4733 // function without changing the state.
4734 __ cmp(ecx, edi); 4734 __ cmp(ecx, edi);
4735 __ j(equal, &done); 4735 __ j(equal, &done);
4736 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4736 __ cmp(ecx, Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4737 __ j(equal, &done); 4737 __ j(equal, &done);
4738 4738
4739 // Special handling of the Array() function, which caches not only the 4739 // Special handling of the Array() function, which caches not only the
4740 // monomorphic Array function but the initial ElementsKind with special 4740 // monomorphic Array function but the initial ElementsKind with special
(...skipping 14 matching lines...) Expand all
4755 4755
4756 __ bind(&miss); 4756 __ bind(&miss);
4757 4757
4758 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 4758 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
4759 // megamorphic. 4759 // megamorphic.
4760 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate))); 4760 __ cmp(ecx, Immediate(TypeFeedbackCells::UninitializedSentinel(isolate)));
4761 __ j(equal, &initialize); 4761 __ j(equal, &initialize);
4762 // MegamorphicSentinel is an immortal immovable object (undefined) so no 4762 // MegamorphicSentinel is an immortal immovable object (undefined) so no
4763 // write-barrier is needed. 4763 // write-barrier is needed.
4764 __ bind(&megamorphic); 4764 __ bind(&megamorphic);
4765 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), 4765 __ mov(FieldOperand(ebx, Cell::kValueOffset),
4766 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4766 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4767 __ jmp(&done, Label::kNear); 4767 __ jmp(&done, Label::kNear);
4768 4768
4769 // An uninitialized cache is patched with the function or sentinel to 4769 // An uninitialized cache is patched with the function or sentinel to
4770 // indicate the ElementsKind if function is the Array constructor. 4770 // indicate the ElementsKind if function is the Array constructor.
4771 __ bind(&initialize); 4771 __ bind(&initialize);
4772 __ LoadGlobalContext(ecx); 4772 __ LoadGlobalContext(ecx);
4773 // Make sure the function is the Array() function 4773 // Make sure the function is the Array() function
4774 __ cmp(edi, Operand(ecx, 4774 __ cmp(edi, Operand(ecx,
4775 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); 4775 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX)));
4776 __ j(not_equal, &not_array_function); 4776 __ j(not_equal, &not_array_function);
4777 4777
4778 // The target function is the Array constructor, install a sentinel value in 4778 // The target function is the Array constructor, install a sentinel value in
4779 // the constructor's type info cell that will track the initial ElementsKind 4779 // the constructor's type info cell that will track the initial ElementsKind
4780 // that should be used for the array when its constructed. 4780 // that should be used for the array when its constructed.
4781 Handle<Object> initial_kind_sentinel = 4781 Handle<Object> initial_kind_sentinel =
4782 TypeFeedbackCells::MonomorphicArraySentinel(isolate, 4782 TypeFeedbackCells::MonomorphicArraySentinel(isolate,
4783 GetInitialFastElementsKind()); 4783 GetInitialFastElementsKind());
4784 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), 4784 __ mov(FieldOperand(ebx, Cell::kValueOffset),
4785 Immediate(initial_kind_sentinel)); 4785 Immediate(initial_kind_sentinel));
4786 __ jmp(&done); 4786 __ jmp(&done);
4787 4787
4788 __ bind(&not_array_function); 4788 __ bind(&not_array_function);
4789 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), edi); 4789 __ mov(FieldOperand(ebx, Cell::kValueOffset), edi);
4790 // No need for a write barrier here - cells are rescanned. 4790 // No need for a write barrier here - cells are rescanned.
4791 4791
4792 __ bind(&done); 4792 __ bind(&done);
4793 } 4793 }
4794 4794
4795 4795
4796 void CallFunctionStub::Generate(MacroAssembler* masm) { 4796 void CallFunctionStub::Generate(MacroAssembler* masm) {
4797 // ebx : cache cell for call target 4797 // ebx : cache cell for call target
4798 // edi : the function to call 4798 // edi : the function to call
4799 Isolate* isolate = masm->isolate(); 4799 Isolate* isolate = masm->isolate();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
4850 JUMP_FUNCTION, 4850 JUMP_FUNCTION,
4851 NullCallWrapper(), 4851 NullCallWrapper(),
4852 CALL_AS_FUNCTION); 4852 CALL_AS_FUNCTION);
4853 4853
4854 // Slow-case: Non-function called. 4854 // Slow-case: Non-function called.
4855 __ bind(&slow); 4855 __ bind(&slow);
4856 if (RecordCallTarget()) { 4856 if (RecordCallTarget()) {
4857 // If there is a call target cache, mark it megamorphic in the 4857 // If there is a call target cache, mark it megamorphic in the
4858 // non-function case. MegamorphicSentinel is an immortal immovable 4858 // non-function case. MegamorphicSentinel is an immortal immovable
4859 // object (undefined) so no write barrier is needed. 4859 // object (undefined) so no write barrier is needed.
4860 __ mov(FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset), 4860 __ mov(FieldOperand(ebx, Cell::kValueOffset),
4861 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate))); 4861 Immediate(TypeFeedbackCells::MegamorphicSentinel(isolate)));
4862 } 4862 }
4863 // Check for function proxy. 4863 // Check for function proxy.
4864 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE); 4864 __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
4865 __ j(not_equal, &non_function); 4865 __ j(not_equal, &non_function);
4866 __ pop(ecx); 4866 __ pop(ecx);
4867 __ push(edi); // put proxy as additional argument under return address 4867 __ push(edi); // put proxy as additional argument under return address
4868 __ push(ecx); 4868 __ push(ecx);
4869 __ Set(eax, Immediate(argc_ + 1)); 4869 __ Set(eax, Immediate(argc_ + 1));
4870 __ Set(ebx, Immediate(0)); 4870 __ Set(ebx, Immediate(0));
(...skipping 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after
7654 7654
7655 __ bind(&need_incremental); 7655 __ bind(&need_incremental);
7656 7656
7657 // Fall through when we need to inform the incremental marker. 7657 // Fall through when we need to inform the incremental marker.
7658 } 7658 }
7659 7659
7660 7660
7661 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) { 7661 void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
7662 // ----------- S t a t e ------------- 7662 // ----------- S t a t e -------------
7663 // -- eax : element value to store 7663 // -- eax : element value to store
7664 // -- ebx : array literal
7665 // -- edi : map of array literal
7666 // -- ecx : element index as smi 7664 // -- ecx : element index as smi
7667 // -- edx : array literal index in function
7668 // -- esp[0] : return address 7665 // -- esp[0] : return address
7666 // -- esp[4] : array literal index in function
7667 // -- esp[8] : array literal
7668 // clobbers ebx, edx, edi
7669 // ----------------------------------- 7669 // -----------------------------------
7670 7670
7671 Label element_done; 7671 Label element_done;
7672 Label double_elements; 7672 Label double_elements;
7673 Label smi_element; 7673 Label smi_element;
7674 Label slow_elements; 7674 Label slow_elements;
7675 Label slow_elements_from_double; 7675 Label slow_elements_from_double;
7676 Label fast_elements; 7676 Label fast_elements;
7677 7677
7678 // Get array literal index, array literal and its map.
7679 __ mov(edx, Operand(esp, 1 * kPointerSize));
7680 __ mov(ebx, Operand(esp, 2 * kPointerSize));
7681 __ mov(edi, FieldOperand(ebx, JSObject::kMapOffset));
7682
7678 __ CheckFastElements(edi, &double_elements); 7683 __ CheckFastElements(edi, &double_elements);
7679 7684
7680 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements 7685 // Check for FAST_*_SMI_ELEMENTS or FAST_*_ELEMENTS elements
7681 __ JumpIfSmi(eax, &smi_element); 7686 __ JumpIfSmi(eax, &smi_element);
7682 __ CheckFastSmiElements(edi, &fast_elements, Label::kNear); 7687 __ CheckFastSmiElements(edi, &fast_elements, Label::kNear);
7683 7688
7684 // Store into the array literal requires a elements transition. Call into 7689 // Store into the array literal requires a elements transition. Call into
7685 // the runtime. 7690 // the runtime.
7686 7691
7687 __ bind(&slow_elements); 7692 __ bind(&slow_elements);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
7923 // builtin Array functions which always have maps. 7928 // builtin Array functions which always have maps.
7924 7929
7925 // Initial map for the builtin Array function should be a map. 7930 // Initial map for the builtin Array function should be a map.
7926 __ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); 7931 __ mov(ecx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
7927 // Will both indicate a NULL and a Smi. 7932 // Will both indicate a NULL and a Smi.
7928 __ test(ecx, Immediate(kSmiTagMask)); 7933 __ test(ecx, Immediate(kSmiTagMask));
7929 __ Assert(not_zero, "Unexpected initial map for Array function"); 7934 __ Assert(not_zero, "Unexpected initial map for Array function");
7930 __ CmpObjectType(ecx, MAP_TYPE, ecx); 7935 __ CmpObjectType(ecx, MAP_TYPE, ecx);
7931 __ Assert(equal, "Unexpected initial map for Array function"); 7936 __ Assert(equal, "Unexpected initial map for Array function");
7932 7937
7933 // We should either have undefined in ebx or a valid jsglobalpropertycell 7938 // We should either have undefined in ebx or a valid cell
7934 Label okay_here; 7939 Label okay_here;
7935 Handle<Map> global_property_cell_map( 7940 Handle<Map> cell_map = masm->isolate()->factory()->cell_map();
7936 masm->isolate()->heap()->global_property_cell_map());
7937 __ cmp(ebx, Immediate(undefined_sentinel)); 7941 __ cmp(ebx, Immediate(undefined_sentinel));
7938 __ j(equal, &okay_here); 7942 __ j(equal, &okay_here);
7939 __ cmp(FieldOperand(ebx, 0), Immediate(global_property_cell_map)); 7943 __ cmp(FieldOperand(ebx, 0), Immediate(cell_map));
7940 __ Assert(equal, "Expected property cell in register ebx"); 7944 __ Assert(equal, "Expected property cell in register ebx");
7941 __ bind(&okay_here); 7945 __ bind(&okay_here);
7942 } 7946 }
7943 7947
7944 if (FLAG_optimize_constructed_arrays) { 7948 if (FLAG_optimize_constructed_arrays) {
7945 Label no_info, switch_ready; 7949 Label no_info, switch_ready;
7946 // Get the elements kind and case on that. 7950 // Get the elements kind and case on that.
7947 __ cmp(ebx, Immediate(undefined_sentinel)); 7951 __ cmp(ebx, Immediate(undefined_sentinel));
7948 __ j(equal, &no_info); 7952 __ j(equal, &no_info);
7949 __ mov(edx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset)); 7953 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset));
7950 __ JumpIfNotSmi(edx, &no_info); 7954 __ JumpIfNotSmi(edx, &no_info);
7951 __ SmiUntag(edx); 7955 __ SmiUntag(edx);
7952 __ jmp(&switch_ready); 7956 __ jmp(&switch_ready);
7953 __ bind(&no_info); 7957 __ bind(&no_info);
7954 __ mov(edx, Immediate(GetInitialFastElementsKind())); 7958 __ mov(edx, Immediate(GetInitialFastElementsKind()));
7955 __ bind(&switch_ready); 7959 __ bind(&switch_ready);
7956 7960
7957 if (argument_count_ == ANY) { 7961 if (argument_count_ == ANY) {
7958 Label not_zero_case, not_one_case; 7962 Label not_zero_case, not_one_case;
7959 __ test(eax, eax); 7963 __ test(eax, eax);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
8090 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); 8094 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
8091 } 8095 }
8092 } 8096 }
8093 8097
8094 8098
8095 #undef __ 8099 #undef __
8096 8100
8097 } } // namespace v8::internal 8101 } } // namespace v8::internal
8098 8102
8099 #endif // V8_TARGET_ARCH_IA32 8103 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32-inl.h ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698