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

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

Issue 2042633002: [interpreter] Ensure optimizations preserve source positions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nits. Created 4 years, 6 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 "src/interpreter/bytecodes.h" 5 #include "src/interpreter/bytecodes.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 8
9 #include "src/frames.h" 9 #include "src/frames.h"
10 #include "src/interpreter/bytecode-traits.h" 10 #include "src/interpreter/bytecode-traits.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 case Bytecode::kLdaTrue: 269 case Bytecode::kLdaTrue:
270 case Bytecode::kLdaFalse: 270 case Bytecode::kLdaFalse:
271 case Bytecode::kLdaConstant: 271 case Bytecode::kLdaConstant:
272 case Bytecode::kLdar: 272 case Bytecode::kLdar:
273 return true; 273 return true;
274 default: 274 default:
275 return false; 275 return false;
276 } 276 }
277 } 277 }
278 278
279 bool Bytecodes::IsJumpWithoutEffects(Bytecode bytecode) {
rmcilroy 2016/06/08 11:31:40 // static
oth 2016/06/08 14:18:25 Done.
280 return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode);
281 }
282
rmcilroy 2016/06/08 11:31:40 // static
oth 2016/06/08 14:18:25 Done.
283 bool Bytecodes::IsRegisterLoadWithoutEffects(Bytecode bytecode) {
284 switch (bytecode) {
285 case Bytecode::kMov:
286 case Bytecode::kPopContext:
287 case Bytecode::kPushContext:
288 case Bytecode::kStar:
289 case Bytecode::kLdrUndefined:
290 return true;
291 default:
292 return false;
293 }
294 }
295
296 // static
297 bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
298 // These bytecodes only manipulate interpreter frame state and will
299 // never throw.
300 return (IsAccumulatorLoadWithoutEffects(bytecode) ||
301 IsRegisterLoadWithoutEffects(bytecode) ||
302 bytecode == Bytecode::kNop || IsJumpWithoutEffects(bytecode));
303 }
304
279 // static 305 // static
280 OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) { 306 OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) {
281 DCHECK_LE(bytecode, Bytecode::kLast); 307 DCHECK_LE(bytecode, Bytecode::kLast);
282 DCHECK_LT(i, NumberOfOperands(bytecode)); 308 DCHECK_LT(i, NumberOfOperands(bytecode));
283 DCHECK_GE(i, 0); 309 DCHECK_GE(i, 0);
284 return GetOperandTypes(bytecode)[i]; 310 return GetOperandTypes(bytecode)[i];
285 } 311 }
286 312
287 // static 313 // static
288 const OperandType* Bytecodes::GetOperandTypes(Bytecode bytecode) { 314 const OperandType* Bytecodes::GetOperandTypes(Bytecode bytecode) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 case Bytecode::kDebugBreakExtraWide: 507 case Bytecode::kDebugBreakExtraWide:
482 case Bytecode::kWide: 508 case Bytecode::kWide:
483 case Bytecode::kDebugBreakWide: 509 case Bytecode::kDebugBreakWide:
484 return true; 510 return true;
485 default: 511 default:
486 return false; 512 return false;
487 } 513 }
488 } 514 }
489 515
490 // static 516 // static
491 bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
492 // These bytecodes only manipulate interpreter frame state and will
493 // never throw.
494 return (IsAccumulatorLoadWithoutEffects(bytecode) || IsLdarOrStar(bytecode) ||
495 bytecode == Bytecode::kMov || bytecode == Bytecode::kNop ||
496 IsJump(bytecode));
497 }
498
499 // static
500 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { 517 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) {
501 return bytecode == Bytecode::kReturn || IsJump(bytecode); 518 return bytecode == Bytecode::kReturn || IsJump(bytecode);
502 } 519 }
503 520
504 // static 521 // static
505 bool Bytecodes::IsMaybeRegisterOperandType(OperandType operand_type) { 522 bool Bytecodes::IsMaybeRegisterOperandType(OperandType operand_type) {
506 return operand_type == OperandType::kMaybeReg; 523 return operand_type == OperandType::kMaybeReg;
507 } 524 }
508 525
509 // static 526 // static
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 } else { 989 } else {
973 std::ostringstream s; 990 std::ostringstream s;
974 s << "r" << index(); 991 s << "r" << index();
975 return s.str(); 992 return s.str();
976 } 993 }
977 } 994 }
978 995
979 } // namespace interpreter 996 } // namespace interpreter
980 } // namespace internal 997 } // namespace internal
981 } // namespace v8 998 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698