Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Side by Side Diff: src/compiler/arm/code-generator-arm.cc

Issue 2584603002: [wasm] TrapIf and TrapUnless TurboFan operators implemented on arm. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/bailout-reason.h ('k') | src/compiler/arm/instruction-selector-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compilation-info.h" 8 #include "src/compilation-info.h"
9 #include "src/compiler/code-generator-impl.h" 9 #include "src/compiler/code-generator-impl.h"
10 #include "src/compiler/gap-resolver.h" 10 #include "src/compiler/gap-resolver.h"
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel. 1586 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel.
1587 } 1587 }
1588 1588
1589 1589
1590 void CodeGenerator::AssembleArchJump(RpoNumber target) { 1590 void CodeGenerator::AssembleArchJump(RpoNumber target) {
1591 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target)); 1591 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target));
1592 } 1592 }
1593 1593
1594 void CodeGenerator::AssembleArchTrap(Instruction* instr, 1594 void CodeGenerator::AssembleArchTrap(Instruction* instr,
1595 FlagsCondition condition) { 1595 FlagsCondition condition) {
1596 UNREACHABLE(); 1596 class OutOfLineTrap final : public OutOfLineCode {
1597 public:
1598 OutOfLineTrap(CodeGenerator* gen, bool frame_elided, Instruction* instr)
1599 : OutOfLineCode(gen),
1600 frame_elided_(frame_elided),
1601 instr_(instr),
1602 gen_(gen) {}
1603
1604 void Generate() final {
1605 ArmOperandConverter i(gen_, instr_);
1606
1607 Runtime::FunctionId trap_id = static_cast<Runtime::FunctionId>(
1608 i.InputInt32(instr_->InputCount() - 1));
1609 bool old_has_frame = __ has_frame();
1610 if (frame_elided_) {
1611 __ set_has_frame(true);
1612 __ EnterFrame(StackFrame::WASM);
1613 }
1614 GenerateCallToTrap(trap_id);
1615 if (frame_elided_) {
1616 __ set_has_frame(old_has_frame);
1617 }
1618 if (FLAG_debug_code) {
1619 __ stop(GetBailoutReason(kUnexpectedReturnFromWasmTrap));
1620 }
1621 }
1622
1623 private:
1624 void GenerateCallToTrap(Runtime::FunctionId trap_id) {
1625 if (trap_id == Runtime::kNumFunctions) {
1626 // We cannot test calls to the runtime in cctest/test-run-wasm.
1627 // Therefore we emit a call to C here instead of a call to the runtime.
1628 // We use the context register as the scratch register, because we do
1629 // not have a context here.
1630 __ PrepareCallCFunction(0, 0, cp);
1631 __ CallCFunction(
1632 ExternalReference::wasm_call_trap_callback_for_testing(isolate()),
1633 0);
1634 } else {
1635 __ Move(cp, isolate()->native_context());
1636 gen_->AssembleSourcePosition(instr_);
1637 __ CallRuntime(trap_id);
1638 }
1639 ReferenceMap* reference_map =
1640 new (gen_->zone()) ReferenceMap(gen_->zone());
1641 gen_->RecordSafepoint(reference_map, Safepoint::kSimple, 0,
1642 Safepoint::kNoLazyDeopt);
1643 }
1644
1645 bool frame_elided_;
1646 Instruction* instr_;
1647 CodeGenerator* gen_;
1648 };
1649 bool frame_elided = !frame_access_state()->has_frame();
1650 auto ool = new (zone()) OutOfLineTrap(this, frame_elided, instr);
1651 Label* tlabel = ool->entry();
1652 Condition cc = FlagsConditionToCondition(condition);
1653 __ b(cc, tlabel);
1597 } 1654 }
1598 1655
1599 // Assembles boolean materializations after an instruction. 1656 // Assembles boolean materializations after an instruction.
1600 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 1657 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
1601 FlagsCondition condition) { 1658 FlagsCondition condition) {
1602 ArmOperandConverter i(this, instr); 1659 ArmOperandConverter i(this, instr);
1603 1660
1604 // Materialize a full 32-bit 1 or 0 value. The result register is always the 1661 // Materialize a full 32-bit 1 or 0 value. The result register is always the
1605 // last output of the instruction. 1662 // last output of the instruction.
1606 DCHECK_NE(0u, instr->OutputCount()); 1663 DCHECK_NE(0u, instr->OutputCount());
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 padding_size -= v8::internal::Assembler::kInstrSize; 2165 padding_size -= v8::internal::Assembler::kInstrSize;
2109 } 2166 }
2110 } 2167 }
2111 } 2168 }
2112 2169
2113 #undef __ 2170 #undef __
2114 2171
2115 } // namespace compiler 2172 } // namespace compiler
2116 } // namespace internal 2173 } // namespace internal
2117 } // namespace v8 2174 } // namespace v8
OLDNEW
« no previous file with comments | « src/bailout-reason.h ('k') | src/compiler/arm/instruction-selector-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698