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

Unified Diff: test/unittests/compiler/interpreter-assembler-unittest.cc

Issue 1245133002: [interpreter] Add Interpreter{Entry,Exit}Trampoline builtins. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@oth_bytecode_array
Patch Set: Adding MIPS based on https://codereview.chromium.org/1257953002/ Created 5 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/interpreter-assembler-unittest.cc
diff --git a/test/unittests/compiler/interpreter-assembler-unittest.cc b/test/unittests/compiler/interpreter-assembler-unittest.cc
index 7bc91ce994e2698ae7fe854ff6f73dc50eef9ca9..70b940f87863c2855b3d0cc08ee8c4e33e2d3887 100644
--- a/test/unittests/compiler/interpreter-assembler-unittest.cc
+++ b/test/unittests/compiler/interpreter-assembler-unittest.cc
@@ -6,6 +6,7 @@
#include "src/compiler/graph.h"
#include "src/compiler/node.h"
+#include "src/unique.h"
#include "test/unittests/compiler/compiler-test-utils.h"
#include "test/unittests/compiler/node-test-utils.h"
@@ -52,6 +53,20 @@ Matcher<Node*> IsIntPtrAdd(const Matcher<Node*>& lhs_matcher,
}
+Matcher<Node*> IsIntPtrSub(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& rhs_matcher) {
+ return kPointerSize == 8 ? IsInt64Sub(lhs_matcher, rhs_matcher)
+ : IsInt32Sub(lhs_matcher, rhs_matcher);
+}
+
+
+Matcher<Node*> IsWordShl(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& rhs_matcher) {
+ return kPointerSize == 8 ? IsWord64Shl(lhs_matcher, rhs_matcher)
+ : IsWord32Shl(lhs_matcher, rhs_matcher);
+}
+
+
TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
InterpreterAssemblerForTest m(this, bytecode);
@@ -86,6 +101,32 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
}
+TARGET_TEST_F(InterpreterAssemblerTest, Return) {
+ TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
+ InterpreterAssemblerForTest m(this, bytecode);
+ m.Return();
+ Graph* graph = m.GetCompletedGraph();
+
+ Node* end = graph->end();
+ EXPECT_EQ(1, end->InputCount());
+ Node* tail_call_node = end->InputAt(0);
+
+ EXPECT_EQ(CallDescriptor::kInterpreterDispatch,
+ m.call_descriptor()->kind());
+ Matcher<Unique<HeapObject>> exit_trampoline(
+ Unique<HeapObject>::CreateImmovable(
+ isolate()->builtins()->InterpreterExitTrampoline()));
+ EXPECT_THAT(
+ tail_call_node,
+ IsTailCall(m.call_descriptor(), IsHeapConstant(exit_trampoline),
+ IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
+ IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
+ IsParameter(Linkage::kInterpreterDispatchTableParameter),
+ graph->start(), graph->start()));
+ }
+}
+
+
TARGET_TEST_F(InterpreterAssemblerTest, BytecodeArg) {
TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
InterpreterAssemblerForTest m(this, bytecode);
@@ -127,9 +168,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadRegister) {
EXPECT_THAT(
load_reg_node,
m.IsLoad(kMachPtr, IsLoadFramePointer(),
- IsInt32Sub(IsInt32Constant(m.kFirstRegisterOffsetFromFp),
- IsWord32Shl(reg_index_node,
- IsInt32Constant(kPointerSizeLog2)))));
+ IsIntPtrSub(IsInt32Constant(m.kFirstRegisterOffsetFromFp),
+ IsWordShl(reg_index_node,
+ IsInt32Constant(kPointerSizeLog2)))));
}
}
@@ -161,9 +202,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, StoreRegister) {
store_reg_node,
m.IsStore(StoreRepresentation(kMachPtr, kNoWriteBarrier),
IsLoadFramePointer(),
- IsInt32Sub(IsInt32Constant(m.kFirstRegisterOffsetFromFp),
- IsWord32Shl(reg_index_node,
- IsInt32Constant(kPointerSizeLog2))),
+ IsIntPtrSub(IsInt32Constant(m.kFirstRegisterOffsetFromFp),
+ IsWordShl(reg_index_node,
+ IsInt32Constant(kPointerSizeLog2))),
store_value));
}
}
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698