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

Side by Side Diff: src/ia32/builtins-ia32.cc

Issue 1643533003: Revert of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | src/ia32/macro-assembler-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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 // This simulates the initial call to bytecode handlers in interpreter entry 858 // This simulates the initial call to bytecode handlers in interpreter entry
859 // trampoline. The return will never actually be taken, but our stack walker 859 // trampoline. The return will never actually be taken, but our stack walker
860 // uses this address to determine whether a frame is interpreted. 860 // uses this address to determine whether a frame is interpreted.
861 __ Push(masm->isolate()->builtins()->InterpreterEntryTrampoline()); 861 __ Push(masm->isolate()->builtins()->InterpreterEntryTrampoline());
862 862
863 Generate_EnterBytecodeDispatch(masm); 863 Generate_EnterBytecodeDispatch(masm);
864 } 864 }
865 865
866 866
867 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 867 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
868 // ----------- S t a t e -------------
869 // -- edx : new target (preserved for callee)
870 // -- edi : target function (preserved for callee)
871 // -----------------------------------
872 // First lookup code, maybe we don't need to compile!
873 Label gotta_call_runtime, gotta_call_runtime_no_stack;
874 Label maybe_call_runtime;
875 Label try_shared;
876 Label loop_top, loop_bottom;
877
878 Register closure = edi;
879 Register new_target = edx;
880 __ push(new_target);
881 __ push(closure);
882
883 Register map = eax;
884 Register index = ebx;
885 __ mov(map, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
886 __ mov(map, FieldOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
887 __ mov(index, FieldOperand(map, FixedArray::kLengthOffset));
888 __ cmp(index, Immediate(Smi::FromInt(2)));
889 __ j(less, &gotta_call_runtime);
890
891 // Find literals.
892 // edx : native context
893 // ebx : length / index
894 // eax : optimized code map
895 // stack[0] : new target
896 // stack[4] : closure
897 Register native_context = edx;
898 __ mov(native_context, NativeContextOperand());
899
900 __ bind(&loop_top);
901 Register temp = edi;
902
903 // Does the native context match?
904 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
905 SharedFunctionInfo::OffsetToPreviousContext()));
906 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
907 __ cmp(temp, native_context);
908 __ j(not_equal, &loop_bottom);
909 // OSR id set to none?
910 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
911 SharedFunctionInfo::OffsetToPreviousOsrAstId()));
912 const int bailout_id = BailoutId::None().ToInt();
913 __ cmp(temp, Immediate(Smi::FromInt(bailout_id)));
914 __ j(not_equal, &loop_bottom);
915 // Literals available?
916 __ mov(temp, FieldOperand(map, index, times_half_pointer_size,
917 SharedFunctionInfo::OffsetToPreviousLiterals()));
918 __ mov(temp, FieldOperand(temp, WeakCell::kValueOffset));
919 __ JumpIfSmi(temp, &gotta_call_runtime);
920
921 // Save the literals in the closure.
922 __ mov(ecx, Operand(esp, 0));
923 __ mov(FieldOperand(ecx, JSFunction::kLiteralsOffset), temp);
924 __ push(index);
925 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index,
926 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
927 __ pop(index);
928
929 // Code available?
930 Register entry = ecx;
931 __ mov(entry, FieldOperand(map, index, times_half_pointer_size,
932 SharedFunctionInfo::OffsetToPreviousCachedCode()));
933 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset));
934 __ JumpIfSmi(entry, &maybe_call_runtime);
935
936 // Found literals and code. Get them into the closure and return.
937 __ pop(closure);
938 // Store code entry in the closure.
939 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
940
941 Label install_optimized_code_and_tailcall;
942 __ bind(&install_optimized_code_and_tailcall);
943 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
944
945 // Link the closure into the optimized function list.
946 // ecx : code entry
947 // edx : native context
948 // edi : closure
949 __ mov(ebx,
950 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
951 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx);
952 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, ebx, eax,
953 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
954 const int function_list_offset =
955 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
956 __ mov(ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST),
957 closure);
958 // Save closure before the write barrier.
959 __ mov(ebx, closure);
960 __ RecordWriteContextSlot(native_context, function_list_offset, closure, eax,
961 kDontSaveFPRegs);
962 __ mov(closure, ebx);
963 __ pop(new_target);
964 __ jmp(entry);
965
966 __ bind(&loop_bottom);
967 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
968 __ cmp(index, Immediate(Smi::FromInt(1)));
969 __ j(greater, &loop_top);
970
971 // We found neither literals nor code.
972 __ jmp(&gotta_call_runtime);
973
974 __ bind(&maybe_call_runtime);
975 __ pop(closure);
976
977 // Last possibility. Check the context free optimized code map entry.
978 __ mov(entry, FieldOperand(map, FixedArray::kHeaderSize +
979 SharedFunctionInfo::kSharedCodeIndex));
980 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset));
981 __ JumpIfSmi(entry, &try_shared);
982
983 // Store code entry in the closure.
984 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
985 __ jmp(&install_optimized_code_and_tailcall);
986
987 __ bind(&try_shared);
988 __ pop(new_target);
989 // Is the full code valid?
990 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset));
991 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset));
992 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset));
993 __ and_(ebx, Code::KindField::kMask);
994 __ shr(ebx, Code::KindField::kShift);
995 __ cmp(ebx, Immediate(Code::BUILTIN));
996 __ j(equal, &gotta_call_runtime_no_stack);
997 // Yes, install the full code.
998 __ lea(entry, FieldOperand(entry, Code::kHeaderSize));
999 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry);
1000 __ jmp(entry);
1001
1002 __ bind(&gotta_call_runtime);
1003 __ pop(closure);
1004 __ pop(new_target);
1005 __ bind(&gotta_call_runtime_no_stack);
1006 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 868 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
1007 GenerateTailCallToReturnedCode(masm); 869 GenerateTailCallToReturnedCode(masm);
1008 } 870 }
1009 871
1010 872
1011 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 873 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
1012 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); 874 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent);
1013 GenerateTailCallToReturnedCode(masm); 875 GenerateTailCallToReturnedCode(masm);
1014 } 876 }
1015 877
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2813 2675
2814 __ bind(&ok); 2676 __ bind(&ok);
2815 __ ret(0); 2677 __ ret(0);
2816 } 2678 }
2817 2679
2818 #undef __ 2680 #undef __
2819 } // namespace internal 2681 } // namespace internal
2820 } // namespace v8 2682 } // namespace v8
2821 2683
2822 #endif // V8_TARGET_ARCH_IA32 2684 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698