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

Side by Side Diff: src/arm/builtins-arm.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
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.cc » ('j') | src/crankshaft/hydrogen.cc » ('J')
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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT); 1029 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::SOFT);
1030 } 1030 }
1031 1031
1032 1032
1033 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) { 1033 void Builtins::Generate_InterpreterNotifyLazyDeoptimized(MacroAssembler* masm) {
1034 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); 1034 Generate_InterpreterNotifyDeoptimizedHelper(masm, Deoptimizer::LAZY);
1035 } 1035 }
1036 1036
1037 1037
1038 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1038 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1039 // ----------- S t a t e -------------
1040 // -- r3 : new target (preserved for callee)
1041 // -- r1 : target function (preserved for callee)
1042 // -----------------------------------
1043 // First lookup code, maybe we don't need to compile!
1044 Label gotta_call_runtime, gotta_call_runtime_no_stack;
1045 Label maybe_call_runtime;
1046 Label try_shared;
1047 Label loop_top, loop_bottom;
1048
1049 Register closure = r1;
1050 Register new_target = r3;
1051 __ push(new_target);
1052 __ push(closure);
1053
1054 Register map = r0;
1055 Register index = r2;
1056 __ ldr(map, FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1057 __ ldr(map,
1058 FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
1059 __ ldr(index, FieldMemOperand(map, FixedArray::kLengthOffset));
1060 __ cmp(index, Operand(Smi::FromInt(2)));
1061 __ b(lt, &gotta_call_runtime);
1062
1063 // Find literals.
1064 // r3 : native context
1065 // r2 : length / index
1066 // r0 : optimized code map
1067 // stack[0] : new target
1068 // stack[4] : closure
1069 Register native_context = r3;
1070 __ ldr(native_context, NativeContextMemOperand());
1071
1072 __ bind(&loop_top);
1073 Register temp = r1;
1074 Register array_pointer = r5;
1075
1076 // Does the native context match?
1077 __ add(array_pointer, map, Operand::PointerOffsetFromSmiKey(index));
1078 __ ldr(temp, FieldMemOperand(array_pointer,
1079 SharedFunctionInfo::OffsetToPreviousContext()));
1080 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1081 __ cmp(temp, native_context);
1082 __ b(ne, &loop_bottom);
1083 // OSR id set to none?
1084 __ ldr(temp, FieldMemOperand(array_pointer,
1085 SharedFunctionInfo::OffsetToPreviousOsrAstId()));
1086 const int bailout_id = BailoutId::None().ToInt();
1087 __ cmp(temp, Operand(Smi::FromInt(bailout_id)));
1088 __ b(ne, &loop_bottom);
1089 // Literals available?
1090 __ ldr(temp, FieldMemOperand(array_pointer,
1091 SharedFunctionInfo::OffsetToPreviousLiterals()));
1092 __ ldr(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
1093 __ JumpIfSmi(temp, &gotta_call_runtime);
1094
1095 // Save the literals in the closure.
1096 __ ldr(r4, MemOperand(sp, 0));
1097 __ str(temp, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
1098 __ push(index);
1099 __ RecordWriteField(r4, JSFunction::kLiteralsOffset, temp, index,
1100 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1101 OMIT_SMI_CHECK);
1102 __ pop(index);
1103
1104 // Code available?
1105 Register entry = r4;
1106 __ ldr(entry,
1107 FieldMemOperand(array_pointer,
1108 SharedFunctionInfo::OffsetToPreviousCachedCode()));
1109 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1110 __ JumpIfSmi(entry, &maybe_call_runtime);
1111
1112 // Found literals and code. Get them into the closure and return.
1113 __ pop(closure);
1114 // Store code entry in the closure.
1115 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1116
1117 Label install_optimized_code_and_tailcall;
1118 __ bind(&install_optimized_code_and_tailcall);
1119 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1120
1121 // Link the closure into the optimized function list.
1122 // r4 : code entry
1123 // r3 : native context
1124 // r1 : closure
1125 __ ldr(r5,
1126 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1127 __ str(r5, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset));
1128 __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, r5, r0,
1129 kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
1130 OMIT_SMI_CHECK);
1131 const int function_list_offset =
1132 Context::SlotOffset(Context::OPTIMIZED_FUNCTIONS_LIST);
1133 __ str(closure,
1134 ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
1135 // Save closure before the write barrier.
1136 __ mov(r5, closure);
1137 __ RecordWriteContextSlot(native_context, function_list_offset, closure, r0,
1138 kLRHasNotBeenSaved, kDontSaveFPRegs);
1139 __ mov(closure, r5);
1140 __ pop(new_target);
1141 __ Jump(entry);
1142
1143 __ bind(&loop_bottom);
1144 __ sub(index, index, Operand(Smi::FromInt(SharedFunctionInfo::kEntryLength)));
1145 __ cmp(index, Operand(Smi::FromInt(1)));
1146 __ b(gt, &loop_top);
1147
1148 // We suck. We didn't even find literals. Hating life, we will go to the
1149 // runtime.
1150 __ jmp(&gotta_call_runtime);
1151
1152 __ bind(&maybe_call_runtime);
1153 __ pop(closure);
1154
1155 // Last possibility. Check the context free optimized code map entry.
1156 __ ldr(entry, FieldMemOperand(map, FixedArray::kHeaderSize));
1157 __ ldr(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
1158 __ JumpIfSmi(entry, &try_shared);
1159
1160 // Store code entry in the closure.
1161 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1162 __ jmp(&install_optimized_code_and_tailcall);
1163
1164 __ bind(&try_shared);
1165 __ pop(new_target);
1166 // Is the full code valid?
1167 __ ldr(entry,
1168 FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
1169 __ ldr(entry, FieldMemOperand(entry, SharedFunctionInfo::kCodeOffset));
1170 __ ldr(r5, FieldMemOperand(entry, Code::kFlagsOffset));
1171 __ and_(r5, r5, Operand(Code::KindField::kMask));
1172 __ mov(r5, Operand(r5, LSR, Code::KindField::kShift));
1173 __ cmp(r5, Operand(Code::BUILTIN));
1174 __ b(eq, &gotta_call_runtime_no_stack);
1175 // Yes, install the full code.
1176 __ add(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
1177 __ str(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset));
1178 __ Jump(entry);
1179
1180 __ bind(&gotta_call_runtime);
1181 __ pop(closure);
1182 __ pop(new_target);
1183 __ bind(&gotta_call_runtime_no_stack);
1039 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1184 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
1040 GenerateTailCallToReturnedCode(masm); 1185 GenerateTailCallToReturnedCode(masm);
1041 } 1186 }
1042 1187
1043 1188
1044 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { 1189 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) {
1045 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent); 1190 CallRuntimePassFunction(masm, Runtime::kCompileOptimized_NotConcurrent);
1046 GenerateTailCallToReturnedCode(masm); 1191 GenerateTailCallToReturnedCode(masm);
1047 } 1192 }
1048 1193
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 } 2506 }
2362 } 2507 }
2363 2508
2364 2509
2365 #undef __ 2510 #undef __
2366 2511
2367 } // namespace internal 2512 } // namespace internal
2368 } // namespace v8 2513 } // namespace v8
2369 2514
2370 #endif // V8_TARGET_ARCH_ARM 2515 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.cc » ('j') | src/crankshaft/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698