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

Side by Side Diff: src/interpreter/bytecodes.cc

Issue 1502243002: [Interpreter] Local flow control in the bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate comments by mstarzinger on patchet 10. Created 5 years 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 | « src/interpreter/bytecodes.h ('k') | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "src/interpreter/bytecodes.h" 5 #include "src/interpreter/bytecodes.h"
6 6
7 #include "src/frames.h" 7 #include "src/frames.h"
8 #include "src/interpreter/bytecode-traits.h" 8 #include "src/interpreter/bytecode-traits.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 return Size; 152 return Size;
153 OPERAND_TYPE_LIST(CASE) 153 OPERAND_TYPE_LIST(CASE)
154 #undef CASE 154 #undef CASE
155 } 155 }
156 UNREACHABLE(); 156 UNREACHABLE();
157 return OperandSize::kNone; 157 return OperandSize::kNone;
158 } 158 }
159 159
160 160
161 // static 161 // static
162 bool Bytecodes::IsJump(Bytecode bytecode) { 162 bool Bytecodes::IsConditionalJumpImmediate(Bytecode bytecode) {
163 return bytecode == Bytecode::kJump || bytecode == Bytecode::kJumpIfTrue || 163 return bytecode == Bytecode::kJumpIfTrue ||
164 bytecode == Bytecode::kJumpIfFalse || 164 bytecode == Bytecode::kJumpIfFalse ||
165 bytecode == Bytecode::kJumpIfToBooleanTrue || 165 bytecode == Bytecode::kJumpIfToBooleanTrue ||
166 bytecode == Bytecode::kJumpIfToBooleanFalse || 166 bytecode == Bytecode::kJumpIfToBooleanFalse ||
167 bytecode == Bytecode::kJumpIfNull || 167 bytecode == Bytecode::kJumpIfNull ||
168 bytecode == Bytecode::kJumpIfUndefined; 168 bytecode == Bytecode::kJumpIfUndefined;
169 } 169 }
170 170
171 171
172 // static 172 // static
173 bool Bytecodes::IsConditionalJumpConstant(Bytecode bytecode) {
174 return bytecode == Bytecode::kJumpIfTrueConstant ||
175 bytecode == Bytecode::kJumpIfFalseConstant ||
176 bytecode == Bytecode::kJumpIfToBooleanTrueConstant ||
177 bytecode == Bytecode::kJumpIfToBooleanFalseConstant ||
178 bytecode == Bytecode::kJumpIfNullConstant ||
179 bytecode == Bytecode::kJumpIfUndefinedConstant;
180 }
181
182
183 // static
184 bool Bytecodes::IsConditionalJump(Bytecode bytecode) {
185 return IsConditionalJumpImmediate(bytecode) ||
186 IsConditionalJumpConstant(bytecode);
187 }
188
189
190 // static
191 bool Bytecodes::IsJumpImmediate(Bytecode bytecode) {
192 return bytecode == Bytecode::kJump || IsConditionalJumpImmediate(bytecode);
193 }
194
195
196 // static
173 bool Bytecodes::IsJumpConstant(Bytecode bytecode) { 197 bool Bytecodes::IsJumpConstant(Bytecode bytecode) {
174 return bytecode == Bytecode::kJumpConstant || 198 return bytecode == Bytecode::kJumpConstant ||
175 bytecode == Bytecode::kJumpIfTrueConstant || 199 IsConditionalJumpConstant(bytecode);
176 bytecode == Bytecode::kJumpIfFalseConstant || 200 }
177 bytecode == Bytecode::kJumpIfToBooleanTrueConstant || 201
178 bytecode == Bytecode::kJumpIfToBooleanFalseConstant || 202
179 bytecode == Bytecode::kJumpIfNull || 203 // static
180 bytecode == Bytecode::kJumpIfUndefinedConstant; 204 bool Bytecodes::IsJump(Bytecode bytecode) {
205 return IsJumpImmediate(bytecode) || IsJumpConstant(bytecode);
206 }
207
208
209 // static
210 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) {
211 return bytecode == Bytecode::kReturn || IsJump(bytecode);
181 } 212 }
182 213
183 214
184 // static 215 // static
185 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start, 216 std::ostream& Bytecodes::Decode(std::ostream& os, const uint8_t* bytecode_start,
186 int parameter_count) { 217 int parameter_count) {
187 Vector<char> buf = Vector<char>::New(50); 218 Vector<char> buf = Vector<char>::New(50);
188 219
189 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]); 220 Bytecode bytecode = Bytecodes::FromByte(bytecode_start[0]);
190 int bytecode_size = Bytecodes::Size(bytecode); 221 int bytecode_size = Bytecodes::Size(bytecode);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 385 }
355 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) { 386 if (reg5.is_valid() && reg4.index() + 1 != reg5.index()) {
356 return false; 387 return false;
357 } 388 }
358 return true; 389 return true;
359 } 390 }
360 391
361 } // namespace interpreter 392 } // namespace interpreter
362 } // namespace internal 393 } // namespace internal
363 } // namespace v8 394 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/control-flow-builders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698