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/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } else { | 149 } else { |
150 __ add(ip, i.InputRegister(0), | 150 __ add(ip, i.InputRegister(0), |
151 Operand(Code::kHeaderSize - kHeapObjectTag)); | 151 Operand(Code::kHeaderSize - kHeapObjectTag)); |
152 __ Call(ip); | 152 __ Call(ip); |
153 } | 153 } |
154 AddSafepointAndDeopt(instr); | 154 AddSafepointAndDeopt(instr); |
155 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 155 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
156 break; | 156 break; |
157 } | 157 } |
158 case kArchCallJSFunction: { | 158 case kArchCallJSFunction: { |
159 // TODO(jarin) The load of the context should be separated from the call. | |
160 Register func = i.InputRegister(0); | 159 Register func = i.InputRegister(0); |
161 __ ldr(cp, FieldMemOperand(func, JSFunction::kContextOffset)); | 160 if (FLAG_debug_code) { |
| 161 // Check the function's context matches the context argument. |
| 162 __ ldr(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset)); |
| 163 __ cmp(cp, kScratchReg); |
| 164 __ Assert(eq, kWrongFunctionContext); |
| 165 } |
162 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 166 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
163 __ Call(ip); | 167 __ Call(ip); |
164 AddSafepointAndDeopt(instr); | 168 AddSafepointAndDeopt(instr); |
165 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 169 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
166 break; | 170 break; |
167 } | 171 } |
168 case kArchDrop: { | 172 case kArchDrop: { |
169 int words = MiscField::decode(instr->opcode()); | 173 int words = MiscField::decode(instr->opcode()); |
170 __ Drop(words); | 174 __ Drop(words); |
171 DCHECK_LT(0, words); | 175 DCHECK_LT(0, words); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 // Restore registers. | 678 // Restore registers. |
675 const RegList saves = descriptor->CalleeSavedRegisters(); | 679 const RegList saves = descriptor->CalleeSavedRegisters(); |
676 if (saves != 0) { | 680 if (saves != 0) { |
677 __ ldm(ia_w, sp, saves); | 681 __ ldm(ia_w, sp, saves); |
678 } | 682 } |
679 } | 683 } |
680 __ LeaveFrame(StackFrame::MANUAL); | 684 __ LeaveFrame(StackFrame::MANUAL); |
681 __ Ret(); | 685 __ Ret(); |
682 } else { | 686 } else { |
683 __ LeaveFrame(StackFrame::MANUAL); | 687 __ LeaveFrame(StackFrame::MANUAL); |
684 int pop_count = | 688 int pop_count = descriptor->IsJSFunctionCall() |
685 descriptor->IsJSFunctionCall() ? descriptor->ParameterCount() : 0; | 689 ? static_cast<int>(descriptor->JSParameterCount()) |
| 690 : 0; |
686 __ Drop(pop_count); | 691 __ Drop(pop_count); |
687 __ Ret(); | 692 __ Ret(); |
688 } | 693 } |
689 } | 694 } |
690 | 695 |
691 | 696 |
692 void CodeGenerator::AssembleMove(InstructionOperand* source, | 697 void CodeGenerator::AssembleMove(InstructionOperand* source, |
693 InstructionOperand* destination) { | 698 InstructionOperand* destination) { |
694 ArmOperandConverter g(this, NULL); | 699 ArmOperandConverter g(this, NULL); |
695 // Dispatch on the source and destination operand kinds. Not all | 700 // Dispatch on the source and destination operand kinds. Not all |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 | 844 |
840 void CodeGenerator::AddNopForSmiCodeInlining() { | 845 void CodeGenerator::AddNopForSmiCodeInlining() { |
841 // On 32-bit ARM we do not insert nops for inlined Smi code. | 846 // On 32-bit ARM we do not insert nops for inlined Smi code. |
842 } | 847 } |
843 | 848 |
844 #undef __ | 849 #undef __ |
845 | 850 |
846 } // namespace compiler | 851 } // namespace compiler |
847 } // namespace internal | 852 } // namespace internal |
848 } // namespace v8 | 853 } // namespace v8 |
OLD | NEW |