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/assembler-inl.h" | 8 #include "src/assembler-inl.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 // Assembles an instruction after register allocation, producing machine code. | 683 // Assembles an instruction after register allocation, producing machine code. |
684 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( | 684 CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
685 Instruction* instr) { | 685 Instruction* instr) { |
686 ArmOperandConverter i(this, instr); | 686 ArmOperandConverter i(this, instr); |
687 | 687 |
688 __ MaybeCheckConstPool(); | 688 __ MaybeCheckConstPool(); |
689 InstructionCode opcode = instr->opcode(); | 689 InstructionCode opcode = instr->opcode(); |
690 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); | 690 ArchOpcode arch_opcode = ArchOpcodeField::decode(opcode); |
691 switch (arch_opcode) { | 691 switch (arch_opcode) { |
692 case kArchCallCodeObject: { | 692 case kArchCallCodeObject: { |
| 693 // We must not share code targets for calls to builtins for WASM code, as |
| 694 // they might need to be patched individually. |
| 695 internal::Assembler::BlockCodeTargetSharingScope scope; |
| 696 if (info()->IsWasm()) scope.Open(masm()); |
| 697 |
693 EnsureSpaceForLazyDeopt(); | 698 EnsureSpaceForLazyDeopt(); |
694 if (instr->InputAt(0)->IsImmediate()) { | 699 if (instr->InputAt(0)->IsImmediate()) { |
695 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), | 700 __ Call(Handle<Code>::cast(i.InputHeapObject(0)), |
696 RelocInfo::CODE_TARGET); | 701 RelocInfo::CODE_TARGET); |
697 } else { | 702 } else { |
698 __ add(ip, i.InputRegister(0), | 703 __ add(ip, i.InputRegister(0), |
699 Operand(Code::kHeaderSize - kHeapObjectTag)); | 704 Operand(Code::kHeaderSize - kHeapObjectTag)); |
700 __ Call(ip); | 705 __ Call(ip); |
701 } | 706 } |
702 RecordCallPosition(instr); | 707 RecordCallPosition(instr); |
703 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 708 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
704 frame_access_state()->ClearSPDelta(); | 709 frame_access_state()->ClearSPDelta(); |
705 break; | 710 break; |
706 } | 711 } |
707 case kArchTailCallCodeObjectFromJSFunction: | 712 case kArchTailCallCodeObjectFromJSFunction: |
708 case kArchTailCallCodeObject: { | 713 case kArchTailCallCodeObject: { |
| 714 // We must not share code targets for calls to builtins for WASM code, as |
| 715 // they might need to be patched individually. |
| 716 internal::Assembler::BlockCodeTargetSharingScope scope; |
| 717 if (info()->IsWasm()) scope.Open(masm()); |
| 718 |
709 if (arch_opcode == kArchTailCallCodeObjectFromJSFunction) { | 719 if (arch_opcode == kArchTailCallCodeObjectFromJSFunction) { |
710 AssemblePopArgumentsAdaptorFrame(kJavaScriptCallArgCountRegister, | 720 AssemblePopArgumentsAdaptorFrame(kJavaScriptCallArgCountRegister, |
711 i.TempRegister(0), i.TempRegister(1), | 721 i.TempRegister(0), i.TempRegister(1), |
712 i.TempRegister(2)); | 722 i.TempRegister(2)); |
713 } | 723 } |
714 if (instr->InputAt(0)->IsImmediate()) { | 724 if (instr->InputAt(0)->IsImmediate()) { |
715 __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), | 725 __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), |
716 RelocInfo::CODE_TARGET); | 726 RelocInfo::CODE_TARGET); |
717 } else { | 727 } else { |
718 __ add(ip, i.InputRegister(0), | 728 __ add(ip, i.InputRegister(0), |
(...skipping 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3237 padding_size -= v8::internal::Assembler::kInstrSize; | 3247 padding_size -= v8::internal::Assembler::kInstrSize; |
3238 } | 3248 } |
3239 } | 3249 } |
3240 } | 3250 } |
3241 | 3251 |
3242 #undef __ | 3252 #undef __ |
3243 | 3253 |
3244 } // namespace compiler | 3254 } // namespace compiler |
3245 } // namespace internal | 3255 } // namespace internal |
3246 } // namespace v8 | 3256 } // namespace v8 |
OLD | NEW |