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

Unified 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: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecodes.cc
diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc
index 46134b7f1d418c52dbecbfe82775ad20586f08cf..e626acc69022e88089d4b9f3d20ff86689c73d52 100644
--- a/src/interpreter/bytecodes.cc
+++ b/src/interpreter/bytecodes.cc
@@ -107,7 +107,6 @@ Bytecode Bytecodes::FromByte(uint8_t value) {
return bytecode;
}
-
// static
Bytecode Bytecodes::GetDebugBreak(Bytecode bytecode) {
DCHECK(!IsDebugBreak(bytecode));
@@ -140,7 +139,6 @@ int Bytecodes::Size(Bytecode bytecode, OperandScale operand_scale) {
return size;
}
-
// static
size_t Bytecodes::ReturnCount(Bytecode bytecode) {
return bytecode == Bytecode::kReturn ? 1 : 0;
@@ -160,7 +158,6 @@ int Bytecodes::NumberOfOperands(Bytecode bytecode) {
return 0;
}
-
// static
int Bytecodes::NumberOfRegisterOperands(Bytecode bytecode) {
DCHECK(bytecode <= Bytecode::kLast);
@@ -277,6 +274,34 @@ bool Bytecodes::IsAccumulatorLoadWithoutEffects(Bytecode bytecode) {
}
// static
+bool Bytecodes::IsJumpWithoutEffects(Bytecode bytecode) {
+ return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode);
+}
+
+// static
+bool Bytecodes::IsRegisterLoadWithoutEffects(Bytecode bytecode) {
+ switch (bytecode) {
+ case Bytecode::kMov:
+ case Bytecode::kPopContext:
+ case Bytecode::kPushContext:
+ case Bytecode::kStar:
+ case Bytecode::kLdrUndefined:
+ return true;
+ default:
+ return false;
+ }
+}
+
+// static
+bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
+ // These bytecodes only manipulate interpreter frame state and will
+ // never throw.
+ return (IsAccumulatorLoadWithoutEffects(bytecode) ||
+ IsRegisterLoadWithoutEffects(bytecode) ||
+ bytecode == Bytecode::kNop || IsJumpWithoutEffects(bytecode));
+}
+
+// static
OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) {
DCHECK_LE(bytecode, Bytecode::kLast);
DCHECK_LT(i, NumberOfOperands(bytecode));
@@ -488,15 +513,6 @@ bool Bytecodes::IsPrefixScalingBytecode(Bytecode bytecode) {
}
// static
-bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
- // These bytecodes only manipulate interpreter frame state and will
- // never throw.
- return (IsAccumulatorLoadWithoutEffects(bytecode) || IsLdarOrStar(bytecode) ||
- bytecode == Bytecode::kMov || bytecode == Bytecode::kNop ||
- IsJump(bytecode));
-}
-
-// static
bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) {
return bytecode == Bytecode::kReturn || IsJump(bytecode);
}
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | test/cctest/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698