| 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/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.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 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1716 i.InputInt32(instr_->InputCount() - 1)); | 1716 i.InputInt32(instr_->InputCount() - 1)); |
| 1717 bool old_has_frame = __ has_frame(); | 1717 bool old_has_frame = __ has_frame(); |
| 1718 if (frame_elided_) { | 1718 if (frame_elided_) { |
| 1719 __ set_has_frame(true); | 1719 __ set_has_frame(true); |
| 1720 __ EnterFrame(StackFrame::WASM_COMPILED); | 1720 __ EnterFrame(StackFrame::WASM_COMPILED); |
| 1721 } | 1721 } |
| 1722 GenerateCallToTrap(trap_id); | 1722 GenerateCallToTrap(trap_id); |
| 1723 if (frame_elided_) { | 1723 if (frame_elided_) { |
| 1724 __ set_has_frame(old_has_frame); | 1724 __ set_has_frame(old_has_frame); |
| 1725 } | 1725 } |
| 1726 if (FLAG_debug_code) { | |
| 1727 // The trap code should never return. | |
| 1728 __ Brk(0); | |
| 1729 } | |
| 1730 } | 1726 } |
| 1731 | 1727 |
| 1732 private: | 1728 private: |
| 1733 void GenerateCallToTrap(Runtime::FunctionId trap_id) { | 1729 void GenerateCallToTrap(Runtime::FunctionId trap_id) { |
| 1734 if (trap_id == Runtime::kNumFunctions) { | 1730 if (trap_id == Runtime::kNumFunctions) { |
| 1735 // We cannot test calls to the runtime in cctest/test-run-wasm. | 1731 // We cannot test calls to the runtime in cctest/test-run-wasm. |
| 1736 // Therefore we emit a call to C here instead of a call to the runtime. | 1732 // Therefore we emit a call to C here instead of a call to the runtime. |
| 1737 __ CallCFunction( | 1733 __ CallCFunction( |
| 1738 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), | 1734 ExternalReference::wasm_call_trap_callback_for_testing(isolate()), |
| 1739 0); | 1735 0); |
| 1736 __ LeaveFrame(StackFrame::WASM_COMPILED); |
| 1737 __ Ret(); |
| 1740 } else { | 1738 } else { |
| 1741 DCHECK(csp.Is(__ StackPointer())); | 1739 DCHECK(csp.Is(__ StackPointer())); |
| 1742 __ Move(cp, Smi::kZero); | 1740 __ Move(cp, Smi::kZero); |
| 1743 // Initialize the jssp because it is required for the runtime call. | 1741 // Initialize the jssp because it is required for the runtime call. |
| 1744 __ Mov(jssp, csp); | 1742 __ Mov(jssp, csp); |
| 1745 gen_->AssembleSourcePosition(instr_); | 1743 gen_->AssembleSourcePosition(instr_); |
| 1746 __ CallRuntime(trap_id); | 1744 __ CallRuntime(trap_id); |
| 1745 ReferenceMap* reference_map = |
| 1746 new (gen_->zone()) ReferenceMap(gen_->zone()); |
| 1747 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, |
| 1748 Safepoint::kNoLazyDeopt); |
| 1749 if (FLAG_debug_code) { |
| 1750 // The trap code should never return. |
| 1751 __ Brk(0); |
| 1752 } |
| 1747 } | 1753 } |
| 1748 ReferenceMap* reference_map = | |
| 1749 new (gen_->zone()) ReferenceMap(gen_->zone()); | |
| 1750 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0, | |
| 1751 Safepoint::kNoLazyDeopt); | |
| 1752 } | 1754 } |
| 1753 bool frame_elided_; | 1755 bool frame_elided_; |
| 1754 Instruction* instr_; | 1756 Instruction* instr_; |
| 1755 CodeGenerator* gen_; | 1757 CodeGenerator* gen_; |
| 1756 }; | 1758 }; |
| 1757 bool frame_elided = !frame_access_state()->has_frame(); | 1759 bool frame_elided = !frame_access_state()->has_frame(); |
| 1758 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); | 1760 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr); |
| 1759 Label* tlabel = ool->entry(); | 1761 Label* tlabel = ool->entry(); |
| 1760 Condition cc = FlagsConditionToCondition(condition); | 1762 Condition cc = FlagsConditionToCondition(condition); |
| 1761 __ B(cc, tlabel); | 1763 __ B(cc, tlabel); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 // unoptimized | 1881 // unoptimized |
| 1880 // frame is still on the stack. Optimized code uses OSR values directly | 1882 // frame is still on the stack. Optimized code uses OSR values directly |
| 1881 // from | 1883 // from |
| 1882 // the unoptimized frame. Thus, all that needs to be done is to allocate | 1884 // the unoptimized frame. Thus, all that needs to be done is to allocate |
| 1883 // the | 1885 // the |
| 1884 // remaining stack slots. | 1886 // remaining stack slots. |
| 1885 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); | 1887 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); |
| 1886 osr_pc_offset_ = __ pc_offset(); | 1888 osr_pc_offset_ = __ pc_offset(); |
| 1887 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); | 1889 shrink_slots -= OsrHelper(info()).UnoptimizedFrameSlots(); |
| 1888 } | 1890 } |
| 1889 | |
| 1890 // Build remainder of frame, including accounting for and filling-in | 1891 // Build remainder of frame, including accounting for and filling-in |
| 1891 // frame-specific header information, e.g. claiming the extra slot that | 1892 // frame-specific header information, e.g. claiming the extra slot that |
| 1892 // other platforms explicitly push for STUB frames and frames recording | 1893 // other platforms explicitly push for STUB frames and frames recording |
| 1893 // their argument count. | 1894 // their argument count. |
| 1894 __ Claim(shrink_slots + (fixed_frame_size & 1)); | 1895 __ Claim(shrink_slots + (fixed_frame_size & 1)); |
| 1895 if (descriptor->PushArgumentCount()) { | 1896 if (descriptor->PushArgumentCount()) { |
| 1896 __ Str(kJavaScriptCallArgCountRegister, | 1897 __ Str(kJavaScriptCallArgCountRegister, |
| 1897 MemOperand(fp, OptimizedBuiltinFrameConstants::kArgCOffset)); | 1898 MemOperand(fp, OptimizedBuiltinFrameConstants::kArgCOffset)); |
| 1898 } | 1899 } |
| 1899 bool is_stub_frame = | 1900 bool is_stub_frame = |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 padding_size -= kInstructionSize; | 2175 padding_size -= kInstructionSize; |
| 2175 } | 2176 } |
| 2176 } | 2177 } |
| 2177 } | 2178 } |
| 2178 | 2179 |
| 2179 #undef __ | 2180 #undef __ |
| 2180 | 2181 |
| 2181 } // namespace compiler | 2182 } // namespace compiler |
| 2182 } // namespace internal | 2183 } // namespace internal |
| 2183 } // namespace v8 | 2184 } // namespace v8 |
| OLD | NEW |