Index: src/debug/debug-evaluate.cc |
diff --git a/src/debug/debug-evaluate.cc b/src/debug/debug-evaluate.cc |
index e93b5952c876ad2ffc7ae80579cf7ed08520efbb..d521aa46dd29c7c2a30ea7cb077afc5b5015b51b 100644 |
--- a/src/debug/debug-evaluate.cc |
+++ b/src/debug/debug-evaluate.cc |
@@ -12,6 +12,8 @@ |
#include "src/debug/debug.h" |
#include "src/frames-inl.h" |
#include "src/globals.h" |
+#include "src/interpreter/bytecode-array-iterator.h" |
+#include "src/interpreter/bytecodes.h" |
#include "src/isolate-inl.h" |
namespace v8 { |
@@ -92,9 +94,13 @@ MaybeHandle<Object> DebugEvaluate::Evaluate( |
Object); |
Handle<Object> result; |
- ASSIGN_RETURN_ON_EXCEPTION( |
- isolate, result, Execution::Call(isolate, eval_fun, receiver, 0, NULL), |
- Object); |
+ { |
+ ReadOnlyEvaluate readonly_evaluate(isolate->debug(), |
+ FLAG_readonly_debug_evaluate); |
+ ASSIGN_RETURN_ON_EXCEPTION( |
+ isolate, result, Execution::Call(isolate, eval_fun, receiver, 0, NULL), |
+ Object); |
+ } |
// Skip the global proxy as it has no properties and always delegates to the |
// real global object. |
@@ -249,5 +255,23 @@ void DebugEvaluate::ContextBuilder::MaterializeReceiver( |
JSObject::SetOwnPropertyIgnoreAttributes(target, name, recv, NONE).Check(); |
} |
+bool DebugEvaluate::IsReadOnly(Handle<BytecodeArray> bytecode_array) { |
+ if (FLAG_trace_readonly_debug_evaluate) { |
+ PrintF("[ro] Checking bytecode array\n"); |
+ bytecode_array->Print(); |
+ } |
+ for (interpreter::BytecodeArrayIterator it(bytecode_array); !it.done(); |
+ it.Advance()) { |
+ if (!interpreter::Bytecodes::BytecodeIsReadOnly(it.current_bytecode())) { |
+ if (FLAG_trace_readonly_debug_evaluate) { |
+ PrintF("[ro] %s is not a read-only bytecode.\n", |
+ interpreter::Bytecodes::ToString(it.current_bytecode())); |
+ } |
+ return false; |
+ } |
+ } |
+ return true; |
+} |
+ |
} // namespace internal |
} // namespace v8 |