| OLD | NEW |
| 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1051 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
| 1052 // ----------- S t a t e ------------- | 1052 // ----------- S t a t e ------------- |
| 1053 // -- eax : argument count (preserved for callee) | 1053 // -- eax : argument count (preserved for callee) |
| 1054 // -- edx : new target (preserved for callee) | 1054 // -- edx : new target (preserved for callee) |
| 1055 // -- edi : target function (preserved for callee) | 1055 // -- edi : target function (preserved for callee) |
| 1056 // ----------------------------------- | 1056 // ----------------------------------- |
| 1057 // First lookup code, maybe we don't need to compile! | 1057 // First lookup code, maybe we don't need to compile! |
| 1058 Label gotta_call_runtime, gotta_call_runtime_no_stack; | 1058 Label gotta_call_runtime, gotta_call_runtime_no_stack; |
| 1059 Label maybe_call_runtime; | |
| 1060 Label try_shared; | 1059 Label try_shared; |
| 1061 Label loop_top, loop_bottom; | 1060 Label loop_top, loop_bottom; |
| 1062 | 1061 |
| 1063 Register closure = edi; | 1062 Register closure = edi; |
| 1064 Register new_target = edx; | 1063 Register new_target = edx; |
| 1065 Register argument_count = eax; | 1064 Register argument_count = eax; |
| 1066 | 1065 |
| 1067 __ push(argument_count); | 1066 __ push(argument_count); |
| 1068 __ push(new_target); | 1067 __ push(new_target); |
| 1069 __ push(closure); | 1068 __ push(closure); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1112 __ push(index); | 1111 __ push(index); |
| 1113 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, | 1112 __ RecordWriteField(ecx, JSFunction::kLiteralsOffset, temp, index, |
| 1114 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 1113 kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 1115 __ pop(index); | 1114 __ pop(index); |
| 1116 | 1115 |
| 1117 // Code available? | 1116 // Code available? |
| 1118 Register entry = ecx; | 1117 Register entry = ecx; |
| 1119 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, | 1118 __ mov(entry, FieldOperand(map, index, times_half_pointer_size, |
| 1120 SharedFunctionInfo::kOffsetToPreviousCachedCode)); | 1119 SharedFunctionInfo::kOffsetToPreviousCachedCode)); |
| 1121 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); | 1120 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); |
| 1122 __ JumpIfSmi(entry, &maybe_call_runtime); | 1121 __ JumpIfSmi(entry, &try_shared); |
| 1123 | 1122 |
| 1124 // Found literals and code. Get them into the closure and return. | 1123 // Found literals and code. Get them into the closure and return. |
| 1125 __ pop(closure); | 1124 __ pop(closure); |
| 1126 // Store code entry in the closure. | 1125 // Store code entry in the closure. |
| 1127 __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); | 1126 __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); |
| 1128 | |
| 1129 Label install_optimized_code_and_tailcall; | |
| 1130 __ bind(&install_optimized_code_and_tailcall); | |
| 1131 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); | 1127 __ mov(FieldOperand(closure, JSFunction::kCodeEntryOffset), entry); |
| 1132 __ RecordWriteCodeEntryField(closure, entry, eax); | 1128 __ RecordWriteCodeEntryField(closure, entry, eax); |
| 1133 | 1129 |
| 1134 // Link the closure into the optimized function list. | 1130 // Link the closure into the optimized function list. |
| 1135 // ecx : code entry | 1131 // ecx : code entry |
| 1136 // edx : native context | 1132 // edx : native context |
| 1137 // edi : closure | 1133 // edi : closure |
| 1138 __ mov(ebx, | 1134 __ mov(ebx, |
| 1139 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); | 1135 ContextOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST)); |
| 1140 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx); | 1136 __ mov(FieldOperand(closure, JSFunction::kNextFunctionLinkOffset), ebx); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1154 __ jmp(entry); | 1150 __ jmp(entry); |
| 1155 | 1151 |
| 1156 __ bind(&loop_bottom); | 1152 __ bind(&loop_bottom); |
| 1157 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); | 1153 __ sub(index, Immediate(Smi::FromInt(SharedFunctionInfo::kEntryLength))); |
| 1158 __ cmp(index, Immediate(Smi::FromInt(1))); | 1154 __ cmp(index, Immediate(Smi::FromInt(1))); |
| 1159 __ j(greater, &loop_top); | 1155 __ j(greater, &loop_top); |
| 1160 | 1156 |
| 1161 // We found neither literals nor code. | 1157 // We found neither literals nor code. |
| 1162 __ jmp(&gotta_call_runtime); | 1158 __ jmp(&gotta_call_runtime); |
| 1163 | 1159 |
| 1164 __ bind(&maybe_call_runtime); | 1160 __ bind(&try_shared); |
| 1165 __ pop(closure); | 1161 __ pop(closure); |
| 1166 | |
| 1167 // Last possibility. Check the context free optimized code map entry. | |
| 1168 __ mov(entry, FieldOperand(map, FixedArray::kHeaderSize + | |
| 1169 SharedFunctionInfo::kSharedCodeIndex)); | |
| 1170 __ mov(entry, FieldOperand(entry, WeakCell::kValueOffset)); | |
| 1171 __ JumpIfSmi(entry, &try_shared); | |
| 1172 | |
| 1173 // Store code entry in the closure. | |
| 1174 __ lea(entry, FieldOperand(entry, Code::kHeaderSize)); | |
| 1175 __ jmp(&install_optimized_code_and_tailcall); | |
| 1176 | |
| 1177 __ bind(&try_shared); | |
| 1178 __ pop(new_target); | 1162 __ pop(new_target); |
| 1179 __ pop(argument_count); | 1163 __ pop(argument_count); |
| 1180 // Is the full code valid? | 1164 // Is the full code valid? |
| 1181 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); | 1165 __ mov(entry, FieldOperand(closure, JSFunction::kSharedFunctionInfoOffset)); |
| 1182 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); | 1166 __ mov(entry, FieldOperand(entry, SharedFunctionInfo::kCodeOffset)); |
| 1183 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset)); | 1167 __ mov(ebx, FieldOperand(entry, Code::kFlagsOffset)); |
| 1184 __ and_(ebx, Code::KindField::kMask); | 1168 __ and_(ebx, Code::KindField::kMask); |
| 1185 __ shr(ebx, Code::KindField::kShift); | 1169 __ shr(ebx, Code::KindField::kShift); |
| 1186 __ cmp(ebx, Immediate(Code::BUILTIN)); | 1170 __ cmp(ebx, Immediate(Code::BUILTIN)); |
| 1187 __ j(equal, &gotta_call_runtime_no_stack); | 1171 __ j(equal, &gotta_call_runtime_no_stack); |
| (...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3166 | 3150 |
| 3167 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3151 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 3168 Generate_OnStackReplacementHelper(masm, true); | 3152 Generate_OnStackReplacementHelper(masm, true); |
| 3169 } | 3153 } |
| 3170 | 3154 |
| 3171 #undef __ | 3155 #undef __ |
| 3172 } // namespace internal | 3156 } // namespace internal |
| 3173 } // namespace v8 | 3157 } // namespace v8 |
| 3174 | 3158 |
| 3175 #endif // V8_TARGET_ARCH_X87 | 3159 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |