Chromium Code Reviews| Index: src/interpreter/bytecodes.cc |
| diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc |
| index 15c4e98a023a90e025e26ab95cd4d9ff881f286b..08b89a0d61cf2e577bac47f403a7040860fd3de1 100644 |
| --- a/src/interpreter/bytecodes.cc |
| +++ b/src/interpreter/bytecodes.cc |
| @@ -289,6 +289,30 @@ bool Bytecodes::BytecodeHasHandler(Bytecode bytecode, |
| Bytecodes::IsBytecodeWithScalableOperands(bytecode); |
| } |
| +// static |
| +bool Bytecodes::BytecodeIsReadOnly(Bytecode bytecode) { |
| + // TODO(yangguo): whitelist more bytecodes. |
| + if (IsWithoutExternalSideEffects(bytecode)) return true; |
| + if (IsCallRuntime(bytecode)) return true; |
|
jgruber
2017/01/10 12:46:37
Is CallRuntime really side-effect-free? What about
|
| + if (IsCallOrNew(bytecode)) return true; |
|
jgruber
2017/01/10 12:46:37
This is considered side-effect-free because we re-
Yang
2017/01/10 14:14:06
Yes.
|
| + switch (bytecode) { |
| + case Bytecode::kStackCheck: |
| + case Bytecode::kLdaLookupSlot: |
| + case Bytecode::kLdaGlobal: |
| + case Bytecode::kLdaNamedProperty: |
| + case Bytecode::kLdaKeyedProperty: |
| + case Bytecode::kAdd: |
| + case Bytecode::kReturn: |
| + case Bytecode::kCreateCatchContext: |
| + case Bytecode::kSetPendingMessage: |
| + case Bytecode::kPushContext: |
| + case Bytecode::kPopContext: |
| + return true; |
| + default: |
| + return false; |
| + } |
| +} |
| + |
| std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode) { |
| return os << Bytecodes::ToString(bytecode); |
| } |