Commit a890034b authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[GetIsolate] Remove GetIsolate in src/debug

Bug: v8:7786
Change-Id: I369eb0bf32d89603b6b944c2bb8fe402a16e429b
Reviewed-on: https://chromium-review.googlesource.com/1104423
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53880}
parent 48d66504
......@@ -44,7 +44,8 @@ MaybeHandle<Object> DebugEvaluate::Global(Isolate* isolate,
context);
if (throw_on_side_effect) isolate->debug()->StartSideEffectCheckMode();
MaybeHandle<Object> result = Execution::Call(
isolate, fun, Handle<JSObject>(context->global_proxy()), 0, nullptr);
isolate, fun, Handle<JSObject>(context->global_proxy(), isolate), 0,
nullptr);
if (throw_on_side_effect) isolate->debug()->StopSideEffectCheckMode();
return result;
}
......@@ -72,7 +73,7 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
if (isolate->has_pending_exception()) return MaybeHandle<Object>();
Handle<Context> context = context_builder.evaluation_context();
Handle<JSObject> receiver(context->global_proxy());
Handle<JSObject> receiver(context->global_proxy(), isolate);
MaybeHandle<Object> maybe_result =
Evaluate(isolate, context_builder.outer_info(), context, receiver, source,
throw_on_side_effect);
......@@ -115,7 +116,7 @@ MaybeHandle<Object> DebugEvaluate::WithTopmostArguments(Isolate* isolate,
Handle<Context>(), Handle<StringSet>());
Handle<SharedFunctionInfo> outer_info(
native_context->empty_function()->shared(), isolate);
Handle<JSObject> receiver(native_context->global_proxy());
Handle<JSObject> receiver(native_context->global_proxy(), isolate);
const bool throw_on_side_effect = false;
MaybeHandle<Object> maybe_result =
Evaluate(isolate, outer_info, evaluation_context, receiver, source,
......@@ -170,7 +171,8 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
frame_inspector_(frame, inlined_jsframe_index, isolate),
scope_iterator_(isolate, &frame_inspector_,
ScopeIterator::COLLECT_NON_LOCALS) {
Handle<Context> outer_context(frame_inspector_.GetFunction()->context());
Handle<Context> outer_context(frame_inspector_.GetFunction()->context(),
isolate);
evaluation_context_ = outer_context;
Factory* factory = isolate->factory();
......@@ -856,7 +858,7 @@ bool BytecodeRequiresRuntimeCheck(interpreter::Bytecode bytecode) {
// static
SharedFunctionInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
Handle<SharedFunctionInfo> info) {
Isolate* isolate, Handle<SharedFunctionInfo> info) {
if (FLAG_trace_side_effect_free_debug_evaluate) {
PrintF("[debug-evaluate] Checking function %s for side effect.\n",
info->DebugName()->ToCString().get());
......@@ -865,7 +867,7 @@ SharedFunctionInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
DCHECK(info->is_compiled());
if (info->HasBytecodeArray()) {
// Check bytecodes against whitelist.
Handle<BytecodeArray> bytecode_array(info->GetBytecodeArray());
Handle<BytecodeArray> bytecode_array(info->GetBytecodeArray(), isolate);
if (FLAG_trace_side_effect_free_debug_evaluate) bytecode_array->Print();
bool requires_runtime_checks = false;
for (interpreter::BytecodeArrayIterator it(bytecode_array); !it.done();
......@@ -914,7 +916,6 @@ SharedFunctionInfo::SideEffectState DebugEvaluate::FunctionGetSideEffectState(
BuiltinGetSideEffectState(static_cast<Builtins::Name>(builtin_index));
#ifdef DEBUG
if (state == SharedFunctionInfo::kHasNoSideEffect) {
Isolate* isolate = info->GetIsolate();
Code* code = isolate->builtins()->builtin(builtin_index);
if (code->builtin_index() == Builtins::kDeserializeLazy) {
// Target builtin is not yet deserialized. Deserialize it now.
......
......@@ -40,7 +40,7 @@ class DebugEvaluate : public AllStatic {
Handle<String> source);
static SharedFunctionInfo::SideEffectState FunctionGetSideEffectState(
Handle<SharedFunctionInfo> info);
Isolate* isolate, Handle<SharedFunctionInfo> info);
static bool CallbackHasNoSideEffect(Object* callback_info);
static void ApplySideEffectChecks(Handle<BytecodeArray> bytecode_array);
......
......@@ -46,7 +46,7 @@ Handle<Object> ScopeIterator::GetFunctionDebugName() const {
if (!context_->IsNativeContext()) {
DisallowHeapAllocation no_gc;
ScopeInfo* closure_info = context_->closure_context()->scope_info();
Handle<String> debug_name(closure_info->FunctionDebugName());
Handle<String> debug_name(closure_info->FunctionDebugName(), isolate_);
if (debug_name->length() > 0) return debug_name;
}
return isolate_->factory()->undefined_value();
......@@ -54,8 +54,8 @@ Handle<Object> ScopeIterator::GetFunctionDebugName() const {
ScopeIterator::ScopeIterator(Isolate* isolate, Handle<JSFunction> function)
: isolate_(isolate),
context_(function->context()),
script_(Script::cast(function->shared()->script())) {
context_(function->context(), isolate),
script_(Script::cast(function->shared()->script()), isolate) {
if (!function->shared()->IsSubjectToDebugging()) {
context_ = Handle<Context>();
return;
......@@ -67,9 +67,9 @@ ScopeIterator::ScopeIterator(Isolate* isolate,
Handle<JSGeneratorObject> generator)
: isolate_(isolate),
generator_(generator),
function_(generator->function()),
context_(generator->context()),
script_(Script::cast(function_->shared()->script())) {
function_(generator->function(), isolate),
context_(generator->context(), isolate),
script_(Script::cast(function_->shared()->script()), isolate) {
if (!function_->shared()->IsSubjectToDebugging()) {
context_ = Handle<Context>();
return;
......@@ -88,8 +88,8 @@ void ScopeIterator::Restart() {
void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
// Catch the case when the debugger stops in an internal function.
Handle<SharedFunctionInfo> shared_info(function_->shared());
Handle<ScopeInfo> scope_info(shared_info->scope_info());
Handle<SharedFunctionInfo> shared_info(function_->shared(), isolate_);
Handle<ScopeInfo> scope_info(shared_info->scope_info(), isolate_);
if (shared_info->script()->IsUndefined(isolate_)) {
current_scope_ = closure_scope_ = nullptr;
context_ = handle(function_->context(), isolate_);
......@@ -106,7 +106,7 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
// inspect the function scope.
// This can only happen if we set a break point inside right before the
// return, which requires a debug info to be available.
Handle<DebugInfo> debug_info(shared_info->GetDebugInfo());
Handle<DebugInfo> debug_info(shared_info->GetDebugInfo(), isolate_);
// Find the break point where execution has stopped.
BreakLocation location = BreakLocation::FromFrame(debug_info, GetFrame());
......@@ -121,7 +121,7 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
info_ = new ParseInfo(isolate_, shared_info);
} else {
// Global or eval code.
Handle<Script> script(Script::cast(shared_info->script()));
Handle<Script> script(Script::cast(shared_info->script()), isolate_);
info_ = new ParseInfo(isolate_, script);
if (scope_info->scope_type() == EVAL_SCOPE) {
info_->set_eval();
......@@ -547,7 +547,7 @@ void ScopeIterator::VisitScriptScope(const Visitor& visitor) const {
context_index++) {
Handle<Context> context =
ScriptContextTable::GetContext(script_contexts, context_index);
Handle<ScopeInfo> scope_info(context->scope_info());
Handle<ScopeInfo> scope_info(context->scope_info(), isolate_);
if (VisitContextLocals(visitor, scope_info, context)) return;
}
}
......@@ -555,7 +555,7 @@ void ScopeIterator::VisitScriptScope(const Visitor& visitor) const {
void ScopeIterator::VisitModuleScope(const Visitor& visitor) const {
DCHECK(context_->IsModuleContext());
Handle<ScopeInfo> scope_info(context_->scope_info());
Handle<ScopeInfo> scope_info(context_->scope_info(), isolate_);
if (VisitContextLocals(visitor, scope_info, context_)) return;
int count_index = scope_info->ModuleVariableCountIndex();
......@@ -585,7 +585,7 @@ bool ScopeIterator::VisitContextLocals(const Visitor& visitor,
Handle<Context> context) const {
// Fill all context locals to the context extension.
for (int i = 0; i < scope_info->ContextLocalCount(); ++i) {
Handle<String> name(scope_info->ContextLocalName(i));
Handle<String> name(scope_info->ContextLocalName(i), isolate_);
if (ScopeInfo::VariableIsSynthetic(*name)) continue;
int context_index = Context::MIN_CONTEXT_SLOTS + i;
Handle<Object> value(context->get(context_index), isolate_);
......@@ -759,7 +759,7 @@ void ScopeIterator::VisitLocalScope(const Visitor& visitor, Mode mode) const {
for (int i = 0; i < keys->length(); i++) {
// Names of variables introduced by eval are strings.
DCHECK(keys->get(i)->IsString());
Handle<String> key(String::cast(keys->get(i)));
Handle<String> key(String::cast(keys->get(i)), isolate_);
Handle<Object> value = JSReceiver::GetDataProperty(extension, key);
if (visitor(key, value)) return;
}
......@@ -890,7 +890,8 @@ bool ScopeIterator::SetModuleVariableValue(Handle<String> variable_name,
bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name,
Handle<Object> new_value) {
Handle<ScriptContextTable> script_contexts(
context_->global_object()->native_context()->script_context_table());
context_->global_object()->native_context()->script_context_table(),
isolate_);
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, variable_name,
&lookup_result)) {
......
......@@ -84,7 +84,7 @@ v8::MaybeLocal<v8::Value> DebugStackTraceIterator::GetReceiver() const {
// So let's try to fetch it using same logic as is used to retrieve 'this'
// during DebugEvaluate::Local.
Handle<JSFunction> function = frame_inspector_->GetFunction();
Handle<Context> context(function->context());
Handle<Context> context(function->context(), isolate_);
// Arrow function defined in top level function without references to
// variables may have NativeContext as context.
if (!context->IsFunctionContext()) return v8::MaybeLocal<v8::Value>();
......@@ -95,7 +95,7 @@ v8::MaybeLocal<v8::Value> DebugStackTraceIterator::GetReceiver() const {
if (!scope_iterator.GetNonLocals()->Has(isolate_->factory()->this_string()))
return v8::MaybeLocal<v8::Value>();
Handle<ScopeInfo> scope_info(context->scope_info());
Handle<ScopeInfo> scope_info(context->scope_info(), isolate_);
VariableMode mode;
InitializationFlag flag;
MaybeAssignedFlag maybe_assigned_flag;
......
This diff is collapsed.
......@@ -170,7 +170,7 @@ class BreakIterator {
// weak handles to avoid a debug info object to keep a function alive.
class DebugInfoListNode {
public:
explicit DebugInfoListNode(DebugInfo* debug_info);
DebugInfoListNode(Isolate* isolate, DebugInfo* debug_info);
~DebugInfoListNode();
DebugInfoListNode* next() { return next_; }
......@@ -295,7 +295,7 @@ class Debug {
int position);
static Handle<Object> GetSourceBreakLocations(
Handle<SharedFunctionInfo> shared);
Isolate* isolate, Handle<SharedFunctionInfo> shared);
// Check whether a global object is the debug global object.
bool IsDebugGlobal(JSGlobalObject* global);
......
This diff is collapsed.
......@@ -77,12 +77,13 @@ class LiveEdit : AllStatic {
static void InitializeThreadLocal(Debug* debug);
V8_WARN_UNUSED_RESULT static MaybeHandle<JSArray> GatherCompileInfo(
Handle<Script> script, Handle<String> source);
Isolate* isolate, Handle<Script> script, Handle<String> source);
static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array,
Handle<JSArray> shared_info_array);
static void FixupScript(Handle<Script> script, int max_function_literal_id);
static void FixupScript(Isolate* isolate, Handle<Script> script,
int max_function_literal_id);
static void FunctionSourceUpdated(Handle<JSArray> shared_info_array,
int new_function_literal_id);
......@@ -97,7 +98,8 @@ class LiveEdit : AllStatic {
// For a script updates its source field. If old_script_name is provided
// (i.e. is a String), also creates a copy of the script with its original
// source and sends notification to debugger.
static Handle<Object> ChangeScriptSource(Handle<Script> original_script,
static Handle<Object> ChangeScriptSource(Isolate* isolate,
Handle<Script> original_script,
Handle<String> new_source,
Handle<Object> old_script_name);
......@@ -110,7 +112,8 @@ class LiveEdit : AllStatic {
// Find open generator activations, and set corresponding "result" elements to
// FUNCTION_BLOCKED_ACTIVE_GENERATOR.
static bool FindActiveGenerators(Handle<FixedArray> shared_info_array,
static bool FindActiveGenerators(Isolate* isolate,
Handle<FixedArray> shared_info_array,
Handle<FixedArray> result, int len);
// Checks listed functions on stack and return array with corresponding
......@@ -141,7 +144,7 @@ class LiveEdit : AllStatic {
// Compares 2 strings line-by-line, then token-wise and returns diff in form
// of array of triplets (pos1, pos1_end, pos2_end) describing list
// of diff chunks.
static Handle<JSArray> CompareStrings(Handle<String> s1,
static Handle<JSArray> CompareStrings(Isolate* isolate, Handle<String> s1,
Handle<String> s2);
// Architecture-specific constant.
......@@ -254,7 +257,7 @@ class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> {
this->SetField(kFunctionScopeInfoOffset_, scope_info_array);
}
void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info);
void SetSharedFunctionInfo(Isolate* isolate, Handle<SharedFunctionInfo> info);
Handle<SharedFunctionInfo> GetSharedFunctionInfo();
......
......@@ -13721,10 +13721,10 @@ String* SharedFunctionInfo::DebugName() {
// static
SharedFunctionInfo::SideEffectState SharedFunctionInfo::GetSideEffectState(
Handle<SharedFunctionInfo> info) {
Isolate* isolate, Handle<SharedFunctionInfo> info) {
if (info->side_effect_state() == kNotComputed) {
SharedFunctionInfo::SideEffectState has_no_side_effect =
DebugEvaluate::FunctionGetSideEffectState(info);
DebugEvaluate::FunctionGetSideEffectState(isolate, info);
info->set_side_effect_state(has_no_side_effect);
}
return static_cast<SideEffectState>(info->side_effect_state());
......
......@@ -282,7 +282,8 @@ class SharedFunctionInfo : public HeapObject {
kRequiresRuntimeChecks = 2,
kHasNoSideEffect = 3,
};
static SideEffectState GetSideEffectState(Handle<SharedFunctionInfo> info);
static SideEffectState GetSideEffectState(Isolate* isolate,
Handle<SharedFunctionInfo> info);
// Used for flags such as --turbo-filter.
bool PassesFilter(const char* raw_filter);
......
......@@ -387,7 +387,8 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
Handle<SharedFunctionInfo> shared(fun->shared());
// Find the number of break points
Handle<Object> break_locations = Debug::GetSourceBreakLocations(shared);
Handle<Object> break_locations =
Debug::GetSourceBreakLocations(isolate, shared);
if (break_locations->IsUndefined(isolate)) {
return isolate->heap()->undefined_value();
}
......
......@@ -71,8 +71,8 @@ RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) {
CHECK(script->value()->IsScript());
Handle<Script> script_handle(Script::cast(script->value()), isolate);
RETURN_RESULT_OR_FAILURE(isolate,
LiveEdit::GatherCompileInfo(script_handle, source));
RETURN_RESULT_OR_FAILURE(
isolate, LiveEdit::GatherCompileInfo(isolate, script_handle, source));
}
......@@ -91,7 +91,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) {
Handle<Script> original_script(Script::cast(original_script_value->value()));
Handle<Object> old_script = LiveEdit::ChangeScriptSource(
original_script, new_source, old_script_name);
isolate, original_script, new_source, old_script_name);
if (old_script->IsScript()) {
Handle<Script> script_handle = Handle<Script>::cast(old_script);
......@@ -113,7 +113,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFixupScript) {
CHECK(script_value->value()->IsScript());
Handle<Script> script(Script::cast(script_value->value()));
LiveEdit::FixupScript(script, max_function_literal_id);
LiveEdit::FixupScript(isolate, script, max_function_literal_id);
return isolate->heap()->undefined_value();
}
......@@ -257,7 +257,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditCompareStrings) {
CONVERT_ARG_HANDLE_CHECKED(String, s1, 0);
CONVERT_ARG_HANDLE_CHECKED(String, s2, 1);
Handle<JSArray> result = LiveEdit::CompareStrings(s1, s2);
Handle<JSArray> result = LiveEdit::CompareStrings(isolate, s1, s2);
uint32_t array_length = 0;
CHECK(result->length()->ToArrayLength(&array_length));
if (array_length > 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment