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

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

Issue 1300813005: [Interpreter] Add implementations of arithmetic binary op bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@mstar_v8h
Patch Set: Fix unittest too... Created 5 years, 4 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 | « test/unittests/compiler/instruction-selector-unittest.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 bc5be263fff4d615741e78189144a08f6ce975e5..03d80fd9f1fcc517e1bd9cf1d60a836155bc0917 100644
--- a/test/unittests/compiler/interpreter-assembler-unittest.cc
+++ b/test/unittests/compiler/interpreter-assembler-unittest.cc
@@ -277,6 +277,52 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadContextSlot) {
}
}
+
+TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) {
+ TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
+ InterpreterAssemblerForTest m(this, bytecode);
+ Node* object = m.IntPtrConstant(0xdeadbeef);
+ int offset = 16;
+ Node* load_field = m.LoadObjectField(object, offset);
+ EXPECT_THAT(load_field,
+ m.IsLoad(kMachAnyTagged, object,
+ IsIntPtrConstant(offset - kHeapObjectTag)));
+ }
+}
+
+
+TARGET_TEST_F(InterpreterAssemblerTest, CallJSBuiltin) {
+ TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
+ InterpreterAssemblerForTest m(this, bytecode);
+ Node* receiver = m.IntPtrConstant(1234);
+ Node* call_js_builtin_0 = m.CallJSBuiltin(Builtins::SUB, receiver);
+
+ Matcher<Node*> load_globals_matcher = m.IsLoad(
+ kMachAnyTagged, IsParameter(Linkage::kInterpreterContextParameter),
+ IsIntPtrConstant(Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
+ Matcher<Node*> load_builtins_matcher = m.IsLoad(
+ kMachAnyTagged, load_globals_matcher,
+ IsIntPtrConstant(GlobalObject::kBuiltinsOffset - kHeapObjectTag));
+ Matcher<Node*> function_matcher =
+ m.IsLoad(kMachAnyTagged, load_builtins_matcher,
+ IsIntPtrConstant(
+ JSBuiltinsObject::OffsetOfFunctionWithId(Builtins::SUB) -
+ kHeapObjectTag));
+ Matcher<Node*> context_matcher =
+ m.IsLoad(kMachAnyTagged, function_matcher,
+ IsIntPtrConstant(JSFunction::kContextOffset - kHeapObjectTag));
+ EXPECT_THAT(call_js_builtin_0,
+ IsCall(_, function_matcher, receiver, context_matcher,
+ m.graph()->start(), m.graph()->start()));
+
+ Node* arg1 = m.Int32Constant(0xabcd);
+ Node* call_js_builtin_1 = m.CallJSBuiltin(Builtins::SUB, receiver, arg1);
+ EXPECT_THAT(call_js_builtin_1,
+ IsCall(_, function_matcher, receiver, arg1, context_matcher,
+ m.graph()->start(), m.graph()->start()));
+ }
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.cc ('k') | test/unittests/compiler/node-test-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698