OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/arm64/macro-assembler-arm64.h" | 7 #include "src/arm64/macro-assembler-arm64.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 RelocInfo::CODE_TARGET); | 142 RelocInfo::CODE_TARGET); |
143 } else { | 143 } else { |
144 Register target = i.InputRegister(0); | 144 Register target = i.InputRegister(0); |
145 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); | 145 __ Add(target, target, Code::kHeaderSize - kHeapObjectTag); |
146 __ Call(target); | 146 __ Call(target); |
147 } | 147 } |
148 AddSafepointAndDeopt(instr); | 148 AddSafepointAndDeopt(instr); |
149 break; | 149 break; |
150 } | 150 } |
151 case kArchCallJSFunction: { | 151 case kArchCallJSFunction: { |
152 // TODO(jarin) The load of the context should be separated from the call. | |
153 Register func = i.InputRegister(0); | 152 Register func = i.InputRegister(0); |
154 __ Ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset)); | 153 if (FLAG_debug_code) { |
| 154 // Check the function's context matches the context argument. |
| 155 UseScratchRegisterScope scope(masm()); |
| 156 Register temp = scope.AcquireX(); |
| 157 __ Ldr(temp, FieldMemOperand(func, JSFunction::kContextOffset)); |
| 158 __ cmp(cp, temp); |
| 159 __ Assert(eq, kWrongFunctionContext); |
| 160 } |
155 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 161 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
156 __ Call(x10); | 162 __ Call(x10); |
157 AddSafepointAndDeopt(instr); | 163 AddSafepointAndDeopt(instr); |
158 break; | 164 break; |
159 } | 165 } |
160 case kArchDrop: { | 166 case kArchDrop: { |
161 int words = MiscField::decode(instr->opcode()); | 167 int words = MiscField::decode(instr->opcode()); |
162 __ Drop(words); | 168 __ Drop(words); |
163 break; | 169 break; |
164 } | 170 } |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 // Restore registers. | 700 // Restore registers. |
695 // TODO(dcarney): correct callee saved registers. | 701 // TODO(dcarney): correct callee saved registers. |
696 __ PopCalleeSavedRegisters(); | 702 __ PopCalleeSavedRegisters(); |
697 } | 703 } |
698 __ Mov(csp, fp); | 704 __ Mov(csp, fp); |
699 __ Pop(fp, lr); | 705 __ Pop(fp, lr); |
700 __ Ret(); | 706 __ Ret(); |
701 } else { | 707 } else { |
702 __ Mov(jssp, fp); | 708 __ Mov(jssp, fp); |
703 __ Pop(fp, lr); | 709 __ Pop(fp, lr); |
704 int pop_count = | 710 int pop_count = descriptor->IsJSFunctionCall() |
705 descriptor->IsJSFunctionCall() ? descriptor->ParameterCount() : 0; | 711 ? static_cast<int>(descriptor->JSParameterCount()) |
| 712 : 0; |
706 __ Drop(pop_count); | 713 __ Drop(pop_count); |
707 __ Ret(); | 714 __ Ret(); |
708 } | 715 } |
709 } | 716 } |
710 | 717 |
711 | 718 |
712 void CodeGenerator::AssembleMove(InstructionOperand* source, | 719 void CodeGenerator::AssembleMove(InstructionOperand* source, |
713 InstructionOperand* destination) { | 720 InstructionOperand* destination) { |
714 Arm64OperandConverter g(this, NULL); | 721 Arm64OperandConverter g(this, NULL); |
715 // Dispatch on the source and destination operand kinds. Not all | 722 // Dispatch on the source and destination operand kinds. Not all |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 } | 846 } |
840 | 847 |
841 | 848 |
842 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } | 849 void CodeGenerator::AddNopForSmiCodeInlining() { __ movz(xzr, 0); } |
843 | 850 |
844 #undef __ | 851 #undef __ |
845 | 852 |
846 } // namespace compiler | 853 } // namespace compiler |
847 } // namespace internal | 854 } // namespace internal |
848 } // namespace v8 | 855 } // namespace v8 |
OLD | NEW |