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

Side by Side Diff: test/unittests/interpreter/bytecode-array-builder-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 unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/node-test-utils.cc ('k') | no next file » | 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/bytecode-array-builder.h" 7 #include "src/interpreter/bytecode-array-builder.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 23 matching lines...) Expand all
34 .LoadFalse(); 34 .LoadFalse();
35 35
36 // Emit accumulator transfers. 36 // Emit accumulator transfers.
37 Register reg(0); 37 Register reg(0);
38 builder.LoadAccumulatorWithRegister(reg).StoreAccumulatorInRegister(reg); 38 builder.LoadAccumulatorWithRegister(reg).StoreAccumulatorInRegister(reg);
39 39
40 // Emit binary operators invocations. 40 // Emit binary operators invocations.
41 builder.BinaryOperation(Token::Value::ADD, reg) 41 builder.BinaryOperation(Token::Value::ADD, reg)
42 .BinaryOperation(Token::Value::SUB, reg) 42 .BinaryOperation(Token::Value::SUB, reg)
43 .BinaryOperation(Token::Value::MUL, reg) 43 .BinaryOperation(Token::Value::MUL, reg)
44 .BinaryOperation(Token::Value::DIV, reg); 44 .BinaryOperation(Token::Value::DIV, reg)
45 .BinaryOperation(Token::Value::MOD, reg);
45 46
46 // Emit control flow. Return must be the last instruction. 47 // Emit control flow. Return must be the last instruction.
47 builder.Return(); 48 builder.Return();
48 49
49 // Generate BytecodeArray. 50 // Generate BytecodeArray.
50 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); 51 Handle<BytecodeArray> the_array = builder.ToBytecodeArray();
51 CHECK_EQ(the_array->frame_size(), builder.locals_count() * kPointerSize); 52 CHECK_EQ(the_array->frame_size(), builder.locals_count() * kPointerSize);
52 53
53 // Build scorecard of bytecodes encountered in the BytecodeArray. 54 // Build scorecard of bytecodes encountered in the BytecodeArray.
54 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); 55 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 int actual_operand = the_register.ToOperand(); 129 int actual_operand = the_register.ToOperand();
129 CHECK_EQ(actual_operand, operand); 130 CHECK_EQ(actual_operand, operand);
130 131
131 int actual_index = Register::FromOperand(actual_operand).index(); 132 int actual_index = Register::FromOperand(actual_operand).index();
132 CHECK_EQ(actual_index, index); 133 CHECK_EQ(actual_index, index);
133 } 134 }
134 135
135 } // namespace interpreter 136 } // namespace interpreter
136 } // namespace internal 137 } // namespace internal
137 } // namespace v8 138 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/node-test-utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698