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

Side by Side Diff: test/unittests/interpreter/bytecode-array-builder-unittest.cc

Issue 1416623003: [Interpreter] Add support for for count operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc error Created 5 years, 1 month 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/cctest/interpreter/test-interpreter.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 "src/interpreter/bytecode-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Emit bitwise operator invocations 87 // Emit bitwise operator invocations
88 builder.BinaryOperation(Token::Value::BIT_OR, reg, Strength::WEAK) 88 builder.BinaryOperation(Token::Value::BIT_OR, reg, Strength::WEAK)
89 .BinaryOperation(Token::Value::BIT_XOR, reg, Strength::WEAK) 89 .BinaryOperation(Token::Value::BIT_XOR, reg, Strength::WEAK)
90 .BinaryOperation(Token::Value::BIT_AND, reg, Strength::WEAK); 90 .BinaryOperation(Token::Value::BIT_AND, reg, Strength::WEAK);
91 91
92 // Emit shift operator invocations 92 // Emit shift operator invocations
93 builder.BinaryOperation(Token::Value::SHL, reg, Strength::WEAK) 93 builder.BinaryOperation(Token::Value::SHL, reg, Strength::WEAK)
94 .BinaryOperation(Token::Value::SAR, reg, Strength::WEAK) 94 .BinaryOperation(Token::Value::SAR, reg, Strength::WEAK)
95 .BinaryOperation(Token::Value::SHR, reg, Strength::WEAK); 95 .BinaryOperation(Token::Value::SHR, reg, Strength::WEAK);
96 96
97 // Emit count operatior invocations
98 builder.CountOperation(Token::Value::ADD, Strength::WEAK)
99 .CountOperation(Token::Value::SUB, Strength::WEAK);
100
97 // Emit unary operator invocations. 101 // Emit unary operator invocations.
98 builder.LogicalNot().TypeOf(); 102 builder.LogicalNot().TypeOf();
99 103
104
100 // Emit new. 105 // Emit new.
101 builder.New(reg, reg, 0); 106 builder.New(reg, reg, 0);
102 107
103 // Emit test operator invocations. 108 // Emit test operator invocations.
104 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 109 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
105 .CompareOperation(Token::Value::NE, reg, Strength::WEAK) 110 .CompareOperation(Token::Value::NE, reg, Strength::WEAK)
106 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) 111 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK)
107 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) 112 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK)
108 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) 113 .CompareOperation(Token::Value::LT, reg, Strength::WEAK)
109 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) 114 .CompareOperation(Token::Value::GT, reg, Strength::WEAK)
110 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) 115 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK)
111 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) 116 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK)
112 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) 117 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK)
113 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); 118 .CompareOperation(Token::Value::IN, reg, Strength::WEAK);
114 119
115 // Emit cast operator invocations. 120 // Emit cast operator invocations.
116 builder.LoadNull() 121 builder.CastAccumulatorToNumber()
117 .CastAccumulatorToBoolean() 122 .CastAccumulatorToBoolean()
118 .CastAccumulatorToName(); 123 .CastAccumulatorToName();
119 124
120 // Emit control flow. Return must be the last instruction. 125 // Emit control flow. Return must be the last instruction.
121 BytecodeLabel start; 126 BytecodeLabel start;
122 builder.Bind(&start); 127 builder.Bind(&start);
123 // Short jumps with Imm8 operands 128 // Short jumps with Imm8 operands
124 builder.Jump(&start) 129 builder.Jump(&start)
125 .JumpIfTrue(&start) 130 .JumpIfTrue(&start)
126 .JumpIfFalse(&start) 131 .JumpIfFalse(&start)
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 533
529 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 534 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
530 iterator.Advance(); 535 iterator.Advance();
531 CHECK(iterator.done()); 536 CHECK(iterator.done());
532 } 537 }
533 538
534 539
535 } // namespace interpreter 540 } // namespace interpreter
536 } // namespace internal 541 } // namespace internal
537 } // namespace v8 542 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698