Reviewers: Jarin,
Description:
[turbofan] Handle void returns in instruction selector.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/1269183002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+14, -3 lines):
M src/compiler/instruction-selector.cc
M test/cctest/compiler/test-run-machops.cc
Index: src/compiler/instruction-selector.cc
diff --git a/src/compiler/instruction-selector.cc
b/src/compiler/instruction-selector.cc
index
4981f6427aaa412efb9146020d900abdee088699..01c5f6f3c64e963f4f95cee8fcfabd749710ebfb
100644
--- a/src/compiler/instruction-selector.cc
+++ b/src/compiler/instruction-selector.cc
@@ -1000,9 +1000,13 @@ void InstructionSelector::VisitGoto(BasicBlock*
target) {
void InstructionSelector::VisitReturn(Node* value) {
DCHECK_NOT_NULL(value);
OperandGenerator g(this);
- Emit(kArchRet, g.NoOutput(),
- g.UseLocation(value, linkage()->GetReturnLocation(),
- linkage()->GetReturnType()));
+ if (linkage()->GetIncomingDescriptor()->ReturnCount() == 0) {
+ Emit(kArchRet, g.NoOutput(), g.Use(value));
+ } else {
+ Emit(kArchRet, g.NoOutput(),
+ g.UseLocation(value, linkage()->GetReturnLocation(),
+ linkage()->GetReturnType()));
+ }
}
Index: test/cctest/compiler/test-run-machops.cc
diff --git a/test/cctest/compiler/test-run-machops.cc
b/test/cctest/compiler/test-run-machops.cc
index
b1fc36968fb7ac48497b5e00893a3cb17da448a7..10e9e9f0edaa1e91a36b02273807a177757cc8b2
100644
--- a/test/cctest/compiler/test-run-machops.cc
+++ b/test/cctest/compiler/test-run-machops.cc
@@ -82,6 +82,13 @@ TEST(CodeGenInt32Binop) {
}
+TEST(CodeGenNop) {
+ RawMachineAssemblerTester<void> m;
+ m.Return(m.Int32Constant(0));
+ m.GenerateCode();
+}
+
+
#if V8_TURBOFAN_BACKEND_64
static Node* Int64Input(RawMachineAssemblerTester<int64_t>* m, int index) {
switch (index) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.