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

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: Created 5 years, 2 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 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Emit bitwise operator invocations 85 // Emit bitwise operator invocations
86 builder.BinaryOperation(Token::Value::BIT_OR, reg, Strength::WEAK) 86 builder.BinaryOperation(Token::Value::BIT_OR, reg, Strength::WEAK)
87 .BinaryOperation(Token::Value::BIT_XOR, reg, Strength::WEAK) 87 .BinaryOperation(Token::Value::BIT_XOR, reg, Strength::WEAK)
88 .BinaryOperation(Token::Value::BIT_AND, reg, Strength::WEAK); 88 .BinaryOperation(Token::Value::BIT_AND, reg, Strength::WEAK);
89 89
90 // Emit shift operator invocations 90 // Emit shift operator invocations
91 builder.BinaryOperation(Token::Value::SHL, reg, Strength::WEAK) 91 builder.BinaryOperation(Token::Value::SHL, reg, Strength::WEAK)
92 .BinaryOperation(Token::Value::SAR, reg, Strength::WEAK) 92 .BinaryOperation(Token::Value::SAR, reg, Strength::WEAK)
93 .BinaryOperation(Token::Value::SHR, reg, Strength::WEAK); 93 .BinaryOperation(Token::Value::SHR, reg, Strength::WEAK);
94 94
95 // Emit count operatior invocations
96 builder.CountOperation(Token::Value::ADD, Strength::WEAK)
97 .CountOperation(Token::Value::SUB, Strength::WEAK);
98
95 // Emit unary operator invocations. 99 // Emit unary operator invocations.
96 builder.LogicalNot().TypeOf(); 100 builder.LogicalNot().TypeOf();
97 101
102
98 // Emit new. 103 // Emit new.
99 builder.New(reg, reg, 0); 104 builder.New(reg, reg, 0);
100 105
101 // Emit test operator invocations. 106 // Emit test operator invocations.
102 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 107 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
103 .CompareOperation(Token::Value::NE, reg, Strength::WEAK) 108 .CompareOperation(Token::Value::NE, reg, Strength::WEAK)
104 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK) 109 .CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK)
105 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK) 110 .CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK)
106 .CompareOperation(Token::Value::LT, reg, Strength::WEAK) 111 .CompareOperation(Token::Value::LT, reg, Strength::WEAK)
107 .CompareOperation(Token::Value::GT, reg, Strength::WEAK) 112 .CompareOperation(Token::Value::GT, reg, Strength::WEAK)
108 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK) 113 .CompareOperation(Token::Value::LTE, reg, Strength::WEAK)
109 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK) 114 .CompareOperation(Token::Value::GTE, reg, Strength::WEAK)
110 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK) 115 .CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK)
111 .CompareOperation(Token::Value::IN, reg, Strength::WEAK); 116 .CompareOperation(Token::Value::IN, reg, Strength::WEAK);
112 117
113 // Emit cast operator invocations. 118 // Emit cast operator invocations.
114 builder.LoadNull() 119 builder.CastAccumulatorToNumber()
115 .CastAccumulatorToBoolean() 120 .CastAccumulatorToBoolean()
116 .CastAccumulatorToName(); 121 .CastAccumulatorToName();
117 122
118 // Emit control flow. Return must be the last instruction. 123 // Emit control flow. Return must be the last instruction.
119 BytecodeLabel start; 124 BytecodeLabel start;
120 builder.Bind(&start); 125 builder.Bind(&start);
121 // Short jumps with Imm8 operands 126 // Short jumps with Imm8 operands
122 builder.Jump(&start) 127 builder.Jump(&start)
123 .JumpIfTrue(&start) 128 .JumpIfTrue(&start)
124 .JumpIfFalse(&start) 129 .JumpIfFalse(&start)
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 500
496 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 501 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
497 iterator.Advance(); 502 iterator.Advance();
498 CHECK(iterator.done()); 503 CHECK(iterator.done());
499 } 504 }
500 505
501 506
502 } // namespace interpreter 507 } // namespace interpreter
503 } // namespace internal 508 } // namespace internal
504 } // namespace v8 509 } // namespace v8
OLDNEW
« test/cctest/interpreter/test-interpreter.cc ('K') | « test/cctest/interpreter/test-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698