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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 "test/unittests/compiler/interpreter-assembler-unittest.h" 5 #include "test/unittests/compiler/interpreter-assembler-unittest.h"
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/unique.h" 9 #include "src/unique.h"
10 #include "test/unittests/compiler/compiler-test-utils.h" 10 #include "test/unittests/compiler/compiler-test-utils.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 270 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
271 InterpreterAssemblerForTest m(this, bytecode); 271 InterpreterAssemblerForTest m(this, bytecode);
272 Node* load_context = m.LoadContextSlot(22); 272 Node* load_context = m.LoadContextSlot(22);
273 EXPECT_THAT(load_context, 273 EXPECT_THAT(load_context,
274 m.IsLoad(kMachAnyTagged, 274 m.IsLoad(kMachAnyTagged,
275 IsParameter(Linkage::kInterpreterContextParameter), 275 IsParameter(Linkage::kInterpreterContextParameter),
276 IsIntPtrConstant(Context::SlotOffset(22)))); 276 IsIntPtrConstant(Context::SlotOffset(22))));
277 } 277 }
278 } 278 }
279 279
280
281 TARGET_TEST_F(InterpreterAssemblerTest, LoadObjectField) {
282 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
283 InterpreterAssemblerForTest m(this, bytecode);
284 Node* object = m.IntPtrConstant(0xdeadbeef);
285 int offset = 16;
286 Node* load_field = m.LoadObjectField(object, offset);
287 EXPECT_THAT(load_field,
288 m.IsLoad(kMachAnyTagged, object,
289 IsIntPtrConstant(offset - kHeapObjectTag)));
290 }
291 }
292
293
294 TARGET_TEST_F(InterpreterAssemblerTest, CallJSBuiltin) {
295 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
296 InterpreterAssemblerForTest m(this, bytecode);
297 Node* receiver = m.IntPtrConstant(1234);
298 Node* call_js_builtin_0 = m.CallJSBuiltin(Builtins::SUB, receiver);
299
300 Matcher<Node*> context_matcher =
301 IsParameter(Linkage::kInterpreterContextParameter);
302 Matcher<Node*> load_globals_matcher = m.IsLoad(
303 kMachAnyTagged, context_matcher,
304 IsIntPtrConstant(Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
305 Matcher<Node*> load_builtins_matcher = m.IsLoad(
306 kMachAnyTagged, load_globals_matcher,
307 IsIntPtrConstant(GlobalObject::kBuiltinsOffset - kHeapObjectTag));
308 Matcher<Node*> function_matcher =
309 m.IsLoad(kMachAnyTagged, load_builtins_matcher,
310 IsIntPtrConstant(
311 JSBuiltinsObject::OffsetOfFunctionWithId(Builtins::SUB) -
312 kHeapObjectTag));
313 EXPECT_THAT(call_js_builtin_0,
314 IsCall(_, function_matcher, receiver, context_matcher,
315 m.graph()->start(), m.graph()->start()));
316
317 Node* arg1 = m.Int32Constant(0xabcd);
318 Node* call_js_builtin_1 = m.CallJSBuiltin(Builtins::SUB, receiver, arg1);
319 EXPECT_THAT(call_js_builtin_1,
320 IsCall(_, function_matcher, receiver, arg1, context_matcher,
321 m.graph()->start(), m.graph()->start()));
322 }
323 }
324
280 } // namespace compiler 325 } // namespace compiler
281 } // namespace internal 326 } // namespace internal
282 } // namespace v8 327 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698