OLD | NEW |
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 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 __ jmp(code()->GetLabel(i.InputBlock(0))); | 115 __ jmp(code()->GetLabel(i.InputBlock(0))); |
116 break; | 116 break; |
117 case kArchNop: | 117 case kArchNop: |
118 // don't emit code for nops. | 118 // don't emit code for nops. |
119 break; | 119 break; |
120 case kArchRet: | 120 case kArchRet: |
121 AssembleReturn(); | 121 AssembleReturn(); |
122 break; | 122 break; |
123 case kArchDeoptimize: { | 123 case kArchDeoptimize: { |
124 int deoptimization_id = MiscField::decode(instr->opcode()); | 124 int deoptimization_id = MiscField::decode(instr->opcode()); |
125 BuildTranslation(instr, deoptimization_id); | 125 BuildTranslation(instr, 0, deoptimization_id); |
126 | 126 |
127 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 127 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
128 isolate(), deoptimization_id, Deoptimizer::LAZY); | 128 isolate(), deoptimization_id, Deoptimizer::LAZY); |
129 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 129 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
130 break; | 130 break; |
131 } | 131 } |
132 case kArchTruncateDoubleToI: | 132 case kArchTruncateDoubleToI: |
133 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); | 133 __ TruncateDoubleToI(i.OutputRegister(), i.InputDoubleRegister(0)); |
134 break; | 134 break; |
135 case kIA32Add: | 135 case kIA32Add: |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 break; | 239 break; |
240 case kIA32CallCodeObject: { | 240 case kIA32CallCodeObject: { |
241 if (HasImmediateInput(instr, 0)) { | 241 if (HasImmediateInput(instr, 0)) { |
242 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); | 242 Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0)); |
243 __ call(code, RelocInfo::CODE_TARGET); | 243 __ call(code, RelocInfo::CODE_TARGET); |
244 } else { | 244 } else { |
245 Register reg = i.InputRegister(0); | 245 Register reg = i.InputRegister(0); |
246 int entry = Code::kHeaderSize - kHeapObjectTag; | 246 int entry = Code::kHeaderSize - kHeapObjectTag; |
247 __ call(Operand(reg, entry)); | 247 __ call(Operand(reg, entry)); |
248 } | 248 } |
249 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | |
250 Safepoint::kNoLazyDeopt); | |
251 | 249 |
252 bool lazy_deopt = (MiscField::decode(instr->opcode()) == 1); | 250 AddSafepointAndDeopt(instr); |
253 if (lazy_deopt) { | 251 |
254 RecordLazyDeoptimizationEntry(instr); | |
255 } | |
256 AddNopForSmiCodeInlining(); | 252 AddNopForSmiCodeInlining(); |
257 break; | 253 break; |
258 } | 254 } |
259 case kIA32CallAddress: | 255 case kIA32CallAddress: |
260 if (HasImmediateInput(instr, 0)) { | 256 if (HasImmediateInput(instr, 0)) { |
261 // TODO(dcarney): wire up EXTERNAL_REFERENCE instead of RUNTIME_ENTRY. | 257 // TODO(dcarney): wire up EXTERNAL_REFERENCE instead of RUNTIME_ENTRY. |
262 __ call(reinterpret_cast<byte*>(i.InputInt32(0)), | 258 __ call(reinterpret_cast<byte*>(i.InputInt32(0)), |
263 RelocInfo::RUNTIME_ENTRY); | 259 RelocInfo::RUNTIME_ENTRY); |
264 } else { | 260 } else { |
265 __ call(i.InputRegister(0)); | 261 __ call(i.InputRegister(0)); |
266 } | 262 } |
267 break; | 263 break; |
268 case kPopStack: { | 264 case kPopStack: { |
269 int words = MiscField::decode(instr->opcode()); | 265 int words = MiscField::decode(instr->opcode()); |
270 __ add(esp, Immediate(kPointerSize * words)); | 266 __ add(esp, Immediate(kPointerSize * words)); |
271 break; | 267 break; |
272 } | 268 } |
273 case kIA32CallJSFunction: { | 269 case kIA32CallJSFunction: { |
274 Register func = i.InputRegister(0); | 270 Register func = i.InputRegister(0); |
275 | 271 |
276 // TODO(jarin) The load of the context should be separated from the call. | 272 // TODO(jarin) The load of the context should be separated from the call. |
277 __ mov(esi, FieldOperand(func, JSFunction::kContextOffset)); | 273 __ mov(esi, FieldOperand(func, JSFunction::kContextOffset)); |
278 __ call(FieldOperand(func, JSFunction::kCodeEntryOffset)); | 274 __ call(FieldOperand(func, JSFunction::kCodeEntryOffset)); |
279 | 275 |
280 RecordSafepoint(instr->pointer_map(), Safepoint::kSimple, 0, | 276 AddSafepointAndDeopt(instr); |
281 Safepoint::kNoLazyDeopt); | |
282 RecordLazyDeoptimizationEntry(instr); | |
283 break; | 277 break; |
284 } | 278 } |
285 case kSSEFloat64Cmp: | 279 case kSSEFloat64Cmp: |
286 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); | 280 __ ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
287 break; | 281 break; |
288 case kSSEFloat64Add: | 282 case kSSEFloat64Add: |
289 __ addsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); | 283 __ addsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); |
290 break; | 284 break; |
291 case kSSEFloat64Sub: | 285 case kSSEFloat64Sub: |
292 __ subsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); | 286 __ subsd(i.InputDoubleRegister(0), i.InputDoubleRegister(1)); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 } | 938 } |
945 | 939 |
946 | 940 |
947 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } | 941 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } |
948 | 942 |
949 #undef __ | 943 #undef __ |
950 | 944 |
951 } | 945 } |
952 } | 946 } |
953 } // namespace v8::internal::compiler | 947 } // namespace v8::internal::compiler |
OLD | NEW |