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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 case kArchCallAddress: | 219 case kArchCallAddress: |
220 if (HasImmediateInput(instr, 0)) { | 220 if (HasImmediateInput(instr, 0)) { |
221 Immediate64 imm = i.InputImmediate64(0); | 221 Immediate64 imm = i.InputImmediate64(0); |
222 DCHECK_EQ(kImm64Value, imm.type); | 222 DCHECK_EQ(kImm64Value, imm.type); |
223 __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64); | 223 __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64); |
224 } else { | 224 } else { |
225 __ call(i.InputRegister(0)); | 225 __ call(i.InputRegister(0)); |
226 } | 226 } |
227 break; | 227 break; |
228 case kArchCallJSFunction: { | 228 case kArchCallJSFunction: { |
229 // TODO(jarin) The load of the context should be separated from the call. | |
230 Register func = i.InputRegister(0); | 229 Register func = i.InputRegister(0); |
231 __ movp(rsi, FieldOperand(func, JSFunction::kContextOffset)); | 230 if (FLAG_debug_code) { |
| 231 // Check the function's context matches the context argument. |
| 232 __ cmpp(rsi, FieldOperand(func, JSFunction::kContextOffset)); |
| 233 __ Assert(equal, kWrongFunctionContext); |
| 234 } |
232 __ Call(FieldOperand(func, JSFunction::kCodeEntryOffset)); | 235 __ Call(FieldOperand(func, JSFunction::kCodeEntryOffset)); |
233 AddSafepointAndDeopt(instr); | 236 AddSafepointAndDeopt(instr); |
234 break; | 237 break; |
235 } | 238 } |
236 case kArchDrop: { | 239 case kArchDrop: { |
237 int words = MiscField::decode(instr->opcode()); | 240 int words = MiscField::decode(instr->opcode()); |
238 __ addq(rsp, Immediate(kPointerSize * words)); | 241 __ addq(rsp, Immediate(kPointerSize * words)); |
239 break; | 242 break; |
240 } | 243 } |
241 case kArchJmp: | 244 case kArchJmp: |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 } else { | 855 } else { |
853 // No saved registers. | 856 // No saved registers. |
854 __ movq(rsp, rbp); // Move stack pointer back to frame pointer. | 857 __ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
855 __ popq(rbp); // Pop caller's frame pointer. | 858 __ popq(rbp); // Pop caller's frame pointer. |
856 __ ret(0); | 859 __ ret(0); |
857 } | 860 } |
858 } else { | 861 } else { |
859 __ movq(rsp, rbp); // Move stack pointer back to frame pointer. | 862 __ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
860 __ popq(rbp); // Pop caller's frame pointer. | 863 __ popq(rbp); // Pop caller's frame pointer. |
861 int pop_count = | 864 int pop_count = |
862 descriptor->IsJSFunctionCall() ? descriptor->ParameterCount() : 0; | 865 descriptor->IsJSFunctionCall() ? descriptor->JSParameterCount() : 0; |
863 __ ret(pop_count * kPointerSize); | 866 __ ret(pop_count * kPointerSize); |
864 } | 867 } |
865 } | 868 } |
866 | 869 |
867 | 870 |
868 void CodeGenerator::AssembleMove(InstructionOperand* source, | 871 void CodeGenerator::AssembleMove(InstructionOperand* source, |
869 InstructionOperand* destination) { | 872 InstructionOperand* destination) { |
870 X64OperandConverter g(this, NULL); | 873 X64OperandConverter g(this, NULL); |
871 // Dispatch on the source and destination operand kinds. Not all | 874 // Dispatch on the source and destination operand kinds. Not all |
872 // combinations are possible. | 875 // combinations are possible. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 } | 998 } |
996 | 999 |
997 | 1000 |
998 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } | 1001 void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); } |
999 | 1002 |
1000 #undef __ | 1003 #undef __ |
1001 | 1004 |
1002 } // namespace internal | 1005 } // namespace internal |
1003 } // namespace compiler | 1006 } // namespace compiler |
1004 } // namespace v8 | 1007 } // namespace v8 |
OLD | NEW |