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

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

Issue 1563213002: Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 4 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); 988 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT);
989 } 989 }
990 990
991 991
992 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { 992 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
993 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); 993 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
994 } 994 }
995 995
996 996
997 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 997 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
998 // ----------- S t a t e -------------
999 // -- x3 : new target (preserved for callee)
1000 // -- x1 : target function (preserved for callee)
1001 // -----------------------------------
1002 // First lookup code, maybe we don't need to compile!
1003 Label gotta_call_runtime;
1004 Label maybe_call_runtime;
1005 Label try_shared;
1006 Label loop_top, loop_bottom;
1007
1008 Register closure = x1;
1009 Register new_target = x3;
1010 Register map = x0;
1011 Register index = x2;
1012 __ Ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1013 __ Ldr(map,
1014 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1015 __ Ldrsw(index, UntagSmiFieldMemOperand(map, FixedArray::kLengthOffset));
1016 __ Cmp(index, Operand(2));
1017 __ B(lt, &gotta_call_runtime);
1018
1019 // Find literals.
1020 // x3 : native context
1021 // x2 : length / index
1022 // x0 : optimized code map
1023 // stack[0] : new target
1024 // stack[4] : closure
1025 Register native_context = x4;
1026 __ Ldr(native_context, NativeContextMemOperand());
1027
1028 __ Bind(&loop_top);
1029 Register temp = x5;
1030 Register array_pointer = x6;
1031
1032 // Does the native context match?
1033 __ Add(array_pointer, map, Operand(index, LSL, kPointerSizeLog2));
1034 __ Ldr(temp, FieldMemOperand(array_pointer,
1035 SharedFunctionInfo::OffsetToPreviousContext()));
1036 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1037 __ Cmp(temp, native_context);
1038 __ B(ne, &loop_bottom);
1039 // OSR id set to none?
1040 __ Ldr(temp, FieldMemOperand(array_pointer,
1041 SharedFunctionInfo::OffsetToPreviousOsrAstId()));
1042 const int bailout_id = BailoutId::None().ToInt();
1043 __ Cmp(temp, Operand(Smi::FromInt(bailout_id)));
1044 __ B(ne, &loop_bottom);
1045 // Literals available?
1046 __ Ldr(temp, FieldMemOperand(array_pointer,
1047 SharedFunctionInfo::OffsetToPreviousLiterals()));
1048 __ Ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1049 __ JumpIfSmi(temp, &gotta_call_runtime);
1050
1051 // Save the literals in the closure.
1052 __ Str(temp, FieldMemOperand(closure, JSFunction::kLiteralsOffset));
1053 __ RecordWriteField(closure, JSFunction::kLiteralsOffset, temp, x7,
1054 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1055 OMIT_SMI_CHECK);
1056
1057 // Code available?
1058 Register entry = x7;
1059 __ Ldr(entry,
1060 FieldMemOperand(array_pointer,
1061 SharedFunctionInfo::OffsetToPreviousCachedCode()));
1062 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1063 __ JumpIfSmi(entry, &maybe_call_runtime);
1064
1065 // Found literals and code. Get them into the closure and return.
1066 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1067
1068 Label install_optimized_code_and_tailcall;
1069 __ Bind(&install_optimized_code_and_tailcall);
1070 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1071
1072 // Link the closure into the optimized function list.
1073 // x7 : code entry
1074 // x4 : native context
1075 // x1 : closure
1076 __ Ldr(x8,
1077 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1078 __ Str(x8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
1079 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, x8, x0,
1080 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1081 OMIT_SMI_CHECK);
1082 const int function_list_offset =
1083 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
1084 __ Str(closure,
1085 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1086 __ Mov(x5, closure);
1087 __ RecordWriteContextSlot(native_context, function_list_offset, x5, x0,
1088 kLRHasNotBeenSaved, kDontSaveFPRegs);
1089 __ Jump(entry);
1090
1091 __ Bind(&loop_bottom);
1092 __ Sub(index, index, Operand(SharedFunctionInfo::kEntryLength));
1093 __ Cmp(index, Operand(1));
1094 __ B(gt, &loop_top);
1095
1096 // We suck. We didn't even find literals. Hating life, we will go to the
1097 // runtime.
1098 __ B(&gotta_call_runtime);
1099
1100 __ Bind(&maybe_call_runtime);
1101
1102 // Last possibility. Check the context free optimized code map entry.
1103 __ Ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize));
1104 __ Ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1105 __ JumpIfSmi(entry, &try_shared);
1106
1107 // Store code entry in the closure.
1108 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1109 __ B(&install_optimized_code_and_tailcall);
1110
1111 __ Bind(&try_shared);
1112 // Is the full code valid?
1113 __ Ldr(entry,
1114 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1115 __ Ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1116 __ Ldr(x5, FieldMemOperand(entry, Code::kFlagsOffset));
1117 __ and_(x5, x5, Operand(Code::KindField::kMask));
1118 __ Mov(x5, Operand(x5, LSR, Code::KindField::kShift));
1119 __ Cmp(x5, Operand(Code::BUILTIN));
1120 __ B(eq, &gotta_call_runtime);
1121 // Yes, install the full code.
1122 __ Add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1123 __ Str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1124 __ Jump(entry);
1125
1126 __ Bind(&gotta_call_runtime);
998 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1127 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
999 GenerateTailCallToReturnedCode(masm); 1128 GenerateTailCallToReturnedCode(masm);
1000 } 1129 }
1001 1130
1002 1131
1003 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 1132 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
1004 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); 1133 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent);
1005 GenerateTailCallToReturnedCode(masm); 1134 GenerateTailCallToReturnedCode(masm);
1006 } 1135 }
1007 1136
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 } 2637 }
2509 } 2638 }
2510 2639
2511 2640
2512 #undef __ 2641 #undef __
2513 2642
2514 } // namespace internal 2643 } // namespace internal
2515 } // namespace v8 2644 } // namespace v8
2516 2645
2517 #endif // V8_TARGET_ARCH_ARM 2646 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698