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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 break; | 132 break; |
133 } | 133 } |
134 case kArchCallJSFunction: { | 134 case kArchCallJSFunction: { |
135 // TODO(jarin) The load of the context should be separated from the call. | 135 // TODO(jarin) The load of the context should be separated from the call. |
136 Register func = i.InputRegister(0); | 136 Register func = i.InputRegister(0); |
137 __ mov(esi, FieldOperand(func, JSFunction::kContextOffset)); | 137 __ mov(esi, FieldOperand(func, JSFunction::kContextOffset)); |
138 __ call(FieldOperand(func, JSFunction::kCodeEntryOffset)); | 138 __ call(FieldOperand(func, JSFunction::kCodeEntryOffset)); |
139 AddSafepointAndDeopt(instr); | 139 AddSafepointAndDeopt(instr); |
140 break; | 140 break; |
141 } | 141 } |
142 case kArchDeoptimize: { | |
143 int deoptimization_id = BuildTranslation(instr, 0); | |
144 | |
145 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | |
146 isolate(), deoptimization_id, Deoptimizer::LAZY); | |
147 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | |
148 break; | |
149 } | |
150 case kArchDrop: { | 142 case kArchDrop: { |
151 int words = MiscField::decode(instr->opcode()); | 143 int words = MiscField::decode(instr->opcode()); |
152 __ add(esp, Immediate(kPointerSize * words)); | 144 __ add(esp, Immediate(kPointerSize * words)); |
153 break; | 145 break; |
154 } | 146 } |
155 case kArchJmp: | 147 case kArchJmp: |
156 __ jmp(code()->GetLabel(i.InputBlock(0))); | 148 __ jmp(code()->GetLabel(i.InputBlock(0))); |
157 break; | 149 break; |
158 case kArchNop: | 150 case kArchNop: |
159 // don't emit code for nops. | 151 // don't emit code for nops. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 __ j(cc, &set, Label::kNear); | 567 __ j(cc, &set, Label::kNear); |
576 __ mov(reg, Immediate(0)); | 568 __ mov(reg, Immediate(0)); |
577 __ jmp(&done, Label::kNear); | 569 __ jmp(&done, Label::kNear); |
578 __ bind(&set); | 570 __ bind(&set); |
579 __ mov(reg, Immediate(1)); | 571 __ mov(reg, Immediate(1)); |
580 } | 572 } |
581 __ bind(&done); | 573 __ bind(&done); |
582 } | 574 } |
583 | 575 |
584 | 576 |
| 577 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { |
| 578 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
| 579 isolate(), deoptimization_id, Deoptimizer::LAZY); |
| 580 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 581 } |
| 582 |
| 583 |
585 // The calling convention for JSFunctions on IA32 passes arguments on the | 584 // The calling convention for JSFunctions on IA32 passes arguments on the |
586 // stack and the JSFunction and context in EDI and ESI, respectively, thus | 585 // stack and the JSFunction and context in EDI and ESI, respectively, thus |
587 // the steps of the call look as follows: | 586 // the steps of the call look as follows: |
588 | 587 |
589 // --{ before the call instruction }-------------------------------------------- | 588 // --{ before the call instruction }-------------------------------------------- |
590 // | caller frame | | 589 // | caller frame | |
591 // ^ esp ^ ebp | 590 // ^ esp ^ ebp |
592 | 591 |
593 // --{ push arguments and setup ESI, EDI }-------------------------------------- | 592 // --{ push arguments and setup ESI, EDI }-------------------------------------- |
594 // | args + receiver | caller frame | | 593 // | args + receiver | caller frame | |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 } | 941 } |
943 | 942 |
944 | 943 |
945 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } | 944 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } |
946 | 945 |
947 #undef __ | 946 #undef __ |
948 | 947 |
949 } // namespace compiler | 948 } // namespace compiler |
950 } // namespace internal | 949 } // namespace internal |
951 } // namespace v8 | 950 } // namespace v8 |
OLD | NEW |