[GetIsolate] Remove GetIsolate in simple cases

Whenever an Isolate is available on a variable, field, or method
parameter, use that instead of GetIsolate(). Also convert simple
cases of the one-argument handle constructor to either use an
available Isolate, or use GetIsolate() if their first parameter
is a variable.

Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I52805905a9ca8729615ead78859f43d5e8f605f1
Reviewed-on: https://chromium-review.googlesource.com/1092853
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53629}
This commit is contained in:
Leszek Swirski 2018-06-11 10:53:20 +01:00 committed by Commit Bot
parent 1cf4c3a983
commit d6c49a7251
44 changed files with 191 additions and 170 deletions

View File

@ -85,7 +85,8 @@ Handle<Object> FunctionCallbackArguments::Call(CallHandlerInfo* handler) {
v8::FunctionCallback f =
v8::ToCData<v8::FunctionCallback>(handler->callback());
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects &&
!isolate->debug()->PerformSideEffectCheckForCallback(handle(handler))) {
!isolate->debug()->PerformSideEffectCheckForCallback(
handle(handler, isolate))) {
return Handle<Object>();
}
VMState<EXTERNAL> state(isolate);

View File

@ -304,8 +304,7 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
i::Handle<i::Object> source_map_url(script->source_mapping_url(), isolate);
i::Handle<i::FixedArray> host_defined_options(script->host_defined_options(),
isolate);
v8::Isolate* v8_isolate =
reinterpret_cast<v8::Isolate*>(script->GetIsolate());
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
ScriptOriginOptions options(script->origin_options());
v8::ScriptOrigin origin(
Utils::ToLocal(scriptName),
@ -4805,7 +4804,7 @@ static Maybe<bool> ObjectSetAccessor(
!i::JSObject::SetAccessor(obj, accessor_name, info, attrs)
.ToHandle(&result);
RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
if (result->IsUndefined(obj->GetIsolate())) return Just(false);
if (result->IsUndefined(isolate)) return Just(false);
if (fast) {
i::JSObject::MigrateSlowToFast(obj, 0, "APISetAccessor");
}
@ -7582,7 +7581,7 @@ WasmModuleObjectBuilderStreaming::WasmModuleObjectBuilderStreaming(
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
streaming_decoder_ = i_isolate->wasm_engine()->StartStreamingCompilation(
i_isolate, handle(i_isolate->context()),
i_isolate, handle(i_isolate->context(), i_isolate),
base::make_unique<AsyncCompilationResolver>(isolate, GetPromise()));
}
@ -7614,7 +7613,8 @@ void WasmModuleObjectBuilderStreaming::Abort(MaybeLocal<Value> exception) {
Local<Promise::Resolver> resolver = promise.As<Promise::Resolver>();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate_);
i::HandleScope scope(i_isolate);
Local<Context> context = Utils::ToLocal(handle(i_isolate->context()));
Local<Context> context =
Utils::ToLocal(handle(i_isolate->context(), i_isolate));
auto maybe = resolver->Reject(context, exception.ToLocalChecked());
CHECK_IMPLIES(!maybe.FromMaybe(false), i_isolate->has_scheduled_exception());
}
@ -9781,7 +9781,7 @@ void debug::GlobalLexicalScopeNames(
for (int j = 0; j < local_count; ++j) {
i::String* name = scope_info->ContextLocalName(j);
if (i::ScopeInfo::VariableIsSynthetic(name)) continue;
names->Append(Utils::ToLocal(handle(name)));
names->Append(Utils::ToLocal(handle(name, isolate)));
}
}
}

View File

@ -395,13 +395,15 @@ Scope* Scope::DeserializeScopeChain(Zone* zone, ScopeInfo* scope_info,
AstValueFactory* ast_value_factory,
DeserializationMode deserialization_mode) {
// Reconstruct the outer scope chain from a closure's context chain.
Isolate* isolate = scope_info->GetIsolate();
Scope* current_scope = nullptr;
Scope* innermost_scope = nullptr;
Scope* outer_scope = nullptr;
while (scope_info) {
if (scope_info->scope_type() == WITH_SCOPE) {
// For scope analysis, debug-evaluate is equivalent to a with scope.
outer_scope = new (zone) Scope(zone, WITH_SCOPE, handle(scope_info));
outer_scope =
new (zone) Scope(zone, WITH_SCOPE, handle(scope_info, isolate));
// TODO(yangguo): Remove once debug-evaluate properly keeps track of the
// function scope in which we are evaluating.
@ -413,28 +415,29 @@ Scope* Scope::DeserializeScopeChain(Zone* zone, ScopeInfo* scope_info,
// scope info of this script context onto the existing script scope to
// avoid nesting script scopes.
if (deserialization_mode == DeserializationMode::kIncludingVariables) {
script_scope->SetScriptScopeInfo(handle(scope_info));
script_scope->SetScriptScopeInfo(handle(scope_info, isolate));
}
DCHECK(!scope_info->HasOuterScopeInfo());
break;
} else if (scope_info->scope_type() == FUNCTION_SCOPE) {
outer_scope =
new (zone) DeclarationScope(zone, FUNCTION_SCOPE, handle(scope_info));
outer_scope = new (zone)
DeclarationScope(zone, FUNCTION_SCOPE, handle(scope_info, isolate));
if (scope_info->IsAsmModule())
outer_scope->AsDeclarationScope()->set_asm_module();
} else if (scope_info->scope_type() == EVAL_SCOPE) {
outer_scope =
new (zone) DeclarationScope(zone, EVAL_SCOPE, handle(scope_info));
outer_scope = new (zone)
DeclarationScope(zone, EVAL_SCOPE, handle(scope_info, isolate));
} else if (scope_info->scope_type() == BLOCK_SCOPE) {
if (scope_info->is_declaration_scope()) {
outer_scope =
new (zone) DeclarationScope(zone, BLOCK_SCOPE, handle(scope_info));
outer_scope = new (zone)
DeclarationScope(zone, BLOCK_SCOPE, handle(scope_info, isolate));
} else {
outer_scope = new (zone) Scope(zone, BLOCK_SCOPE, handle(scope_info));
outer_scope =
new (zone) Scope(zone, BLOCK_SCOPE, handle(scope_info, isolate));
}
} else if (scope_info->scope_type() == MODULE_SCOPE) {
outer_scope =
new (zone) ModuleScope(handle(scope_info), ast_value_factory);
outer_scope = new (zone)
ModuleScope(handle(scope_info, isolate), ast_value_factory);
} else {
DCHECK_EQ(scope_info->scope_type(), CATCH_SCOPE);
DCHECK_EQ(scope_info->LocalCount(), 1);
@ -444,9 +447,9 @@ Scope* Scope::DeserializeScopeChain(Zone* zone, ScopeInfo* scope_info,
String* name = scope_info->ContextLocalName(0);
MaybeAssignedFlag maybe_assigned =
scope_info->ContextLocalMaybeAssignedFlag(0);
outer_scope =
new (zone) Scope(zone, ast_value_factory->GetString(handle(name)),
maybe_assigned, handle(scope_info));
outer_scope = new (zone) Scope(
zone, ast_value_factory->GetString(handle(name, name->GetIsolate())),
maybe_assigned, handle(scope_info, isolate));
}
if (deserialization_mode == DeserializationMode::kScopesOnly) {
outer_scope->scope_info_ = Handle<ScopeInfo>::null();
@ -2407,7 +2410,8 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info, Isolate* isolate,
// Ensuring that the outer script scope has a scope info avoids having
// special case for native contexts vs other contexts.
if (info->script_scope() && info->script_scope()->scope_info_.is_null()) {
info->script_scope()->scope_info_ = handle(ScopeInfo::Empty(isolate));
info->script_scope()->scope_info_ =
handle(ScopeInfo::Empty(isolate), isolate);
}
}

View File

@ -80,7 +80,8 @@ V8_WARN_UNUSED_RESULT MaybeHandle<Object> HandleApiCallHelper(
// Proxies never need access checks.
DCHECK(js_receiver->IsJSObject());
Handle<JSObject> js_obj_receiver = Handle<JSObject>::cast(js_receiver);
if (!isolate->MayAccess(handle(isolate->context()), js_obj_receiver)) {
if (!isolate->MayAccess(handle(isolate->context(), isolate),
js_obj_receiver)) {
isolate->ReportFailedAccessCheck(js_obj_receiver);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return isolate->factory()->undefined_value();

View File

@ -141,7 +141,7 @@ Handle<Code> CodeStub::GetCode() {
Code* code;
if (FindCodeInCache(&code)) {
DCHECK(code->is_stub());
return handle(code);
return handle(code, isolate_);
}
{
@ -167,7 +167,7 @@ Handle<Code> CodeStub::GetCode() {
// Update the dictionary and the root in Heap.
Handle<SimpleNumberDictionary> dict = SimpleNumberDictionary::Set(
handle(heap->code_stubs()), GetKey(), new_object);
handle(heap->code_stubs(), isolate_), GetKey(), new_object);
heap->SetRootCodeStubs(*dict);
code = *new_object;
}

View File

@ -129,7 +129,7 @@ void CompilationDependencies::AssumePrototypeMapsStable(
for (PrototypeIterator i(map); !i.IsAtEnd(); i.Advance()) {
Handle<JSReceiver> const current =
PrototypeIterator::GetCurrent<JSReceiver>(i);
AssumeMapStable(handle(current->map()));
AssumeMapStable(handle(current->map(), isolate_));
Handle<JSReceiver> last;
if (prototype.ToHandle(&last) && last.is_identical_to(current)) {
break;

View File

@ -206,7 +206,7 @@ void UnoptimizedCompileJob::PrepareOnMainThread(Isolate* isolate) {
parser_.reset(new Parser(parse_info_.get()));
MaybeHandle<ScopeInfo> outer_scope_info;
if (shared_->HasOuterScopeInfo()) {
outer_scope_info = handle(shared_->GetOuterScopeInfo());
outer_scope_info = handle(shared_->GetOuterScopeInfo(), isolate);
}
parser_->DeserializeScopeChain(isolate, parse_info_.get(), outer_scope_info);

View File

@ -1136,7 +1136,7 @@ bool Compiler::Compile(Handle<JSFunction> function, ClearExceptionFlag flag) {
DCHECK(!function->HasOptimizedCode());
Isolate* isolate = function->GetIsolate();
Handle<SharedFunctionInfo> shared_info = handle(function->shared());
Handle<SharedFunctionInfo> shared_info = handle(function->shared(), isolate);
// Ensure shared function info is compiled.
if (!shared_info->is_compiled() && !Compile(shared_info, flag)) return false;
@ -1296,7 +1296,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
// If the position is missing, attempt to get the code offset by
// walking the stack. Do not translate the code offset into source
// position, but store it as negative value for lazy translation.
StackTraceFrameIterator it(script->GetIsolate());
StackTraceFrameIterator it(isolate);
if (!it.done() && it.is_javascript()) {
FrameSummary summary = FrameSummary::GetTop(it.javascript_frame());
script->set_eval_from_shared(
@ -1314,7 +1314,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
parse_info.set_parse_restriction(restriction);
parse_info.set_parameters_end_pos(parameters_end_pos);
if (!context->IsNativeContext()) {
parse_info.set_outer_scope_info(handle(context->scope_info()));
parse_info.set_outer_scope_info(handle(context->scope_info(), isolate));
}
DCHECK(!parse_info.is_module());
@ -1786,7 +1786,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
parse_info.set_wrapped_as_function();
// parse_info.set_eager(compile_options == ScriptCompiler::kEagerCompile);
if (!context->IsNativeContext()) {
parse_info.set_outer_scope_info(handle(context->scope_info()));
parse_info.set_outer_scope_info(handle(context->scope_info(), isolate));
}
parse_info.set_language_mode(
stricter_language_mode(parse_info.language_mode(), language_mode));

View File

@ -300,7 +300,8 @@ bool AccessInfoFactory::ComputeElementAccessInfos(
if (transition_target == nullptr) {
receiver_maps.push_back(map);
} else {
transitions.push_back(std::make_pair(map, handle(transition_target)));
transitions.push_back(
std::make_pair(map, handle(transition_target, isolate())));
}
}
}
@ -665,7 +666,7 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
PropertyAccessInfo* access_info) {
// Check if the {map} has a data transition with the given {name}.
Map* transition =
TransitionsAccessor(isolate_, map).SearchTransition(*name, kData, NONE);
TransitionsAccessor(isolate(), map).SearchTransition(*name, kData, NONE);
if (transition == nullptr) return false;
Handle<Map> transition_map(transition);

View File

@ -128,7 +128,7 @@ void JsonPrintAllSourceWithPositions(std::ostream& os,
Handle<Script> script =
(info->shared_info().is_null() || !info->shared_info()->script())
? Handle<Script>()
: handle(Script::cast(info->shared_info()->script()));
: handle(Script::cast(info->shared_info()->script()), isolate);
JsonPrintFunctionSource(os, -1,
info->shared_info().is_null()
? std::unique_ptr<char[]>(new char[1]{0})
@ -141,8 +141,8 @@ void JsonPrintAllSourceWithPositions(std::ostream& os,
Handle<SharedFunctionInfo> shared = inlined[id].shared_info;
const int source_id = id_assigner.GetIdFor(shared);
JsonPrintFunctionSource(os, source_id, shared->DebugName()->ToCString(),
handle(Script::cast(shared->script())), isolate,
shared, true);
handle(Script::cast(shared->script()), isolate),
isolate, shared, true);
}
os << "}, ";
os << "\"inlinings\" : {";

View File

@ -1113,7 +1113,8 @@ Maybe<OuterContext> GetModuleContext(Handle<JSFunction> closure) {
size_t distance = 0;
while (!current->IsNativeContext()) {
if (current->IsModuleContext()) {
return Just(OuterContext(handle(current), distance));
return Just(
OuterContext(handle(current, current->GetIsolate()), distance));
}
current = current->previous();
distance++;

View File

@ -170,7 +170,7 @@ DebugEvaluate::ContextBuilder::ContextBuilder(Isolate* isolate,
Handle<JSFunction> local_function = frame_inspector.GetFunction();
Handle<Context> outer_context(local_function->context());
evaluation_context_ = outer_context;
outer_info_ = handle(local_function->shared());
outer_info_ = handle(local_function->shared(), isolate);
Factory* factory = isolate->factory();
// To evaluate as if we were running eval at the point of the debug break,

View File

@ -81,7 +81,7 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
Handle<SharedFunctionInfo> shared_info(function_->shared());
Handle<ScopeInfo> scope_info(shared_info->scope_info());
if (shared_info->script()->IsUndefined(isolate_)) {
context_ = handle(function_->context());
context_ = handle(function_->context(), isolate_);
function_ = Handle<JSFunction>();
return;
}
@ -114,7 +114,7 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
if (scope_info->HasContext()) {
context_ = Handle<Context>(context_->declaration_context(), isolate_);
} else {
context_ = handle(function_->context());
context_ = handle(function_->context(), isolate_);
}
if (scope_info->scope_type() == FUNCTION_SCOPE) {
nested_scope_chain_.emplace_back(scope_info, shared_info->StartPosition(),
@ -133,7 +133,8 @@ void ScopeIterator::TryParseAndRetrieveScopes(ScopeIterator::Option option) {
if (scope_info->scope_type() == EVAL_SCOPE) {
info->set_eval();
if (!function_->context()->IsNativeContext()) {
info->set_outer_scope_info(handle(function_->context()->scope_info()));
info->set_outer_scope_info(
handle(function_->context()->scope_info(), isolate_));
}
// Language mode may be inherited from the eval caller.
// Retrieve it from shared function info.
@ -562,7 +563,7 @@ void ScopeIterator::MaterializeStackLocals(Handle<JSObject> local_scope,
}
for (int i = 0; i < scope_info->StackLocalCount(); ++i) {
Handle<String> name = handle(scope_info->StackLocalName(i));
Handle<String> name = handle(scope_info->StackLocalName(i), isolate_);
if (ScopeInfo::VariableIsSynthetic(*name)) continue;
Handle<Object> value(parameters_and_registers->get(
parameter_count + scope_info->StackLocalIndex(i)),
@ -638,7 +639,7 @@ Handle<JSObject> ScopeIterator::WithContextExtension() {
if (context->extension_receiver()->IsJSProxy()) {
return isolate_->factory()->NewJSObjectWithNullProto();
}
return handle(JSObject::cast(context->extension_receiver()));
return handle(JSObject::cast(context->extension_receiver()), isolate_);
}
// Create a plain JSObject which materializes the block scope for the specified
@ -685,7 +686,8 @@ bool ScopeIterator::SetParameterValue(Handle<ScopeInfo> scope_info,
// Setting stack locals of optimized frames is not supported.
HandleScope scope(isolate_);
for (int i = 0; i < scope_info->ParameterCount(); ++i) {
if (String::Equals(handle(scope_info->ParameterName(i)), parameter_name)) {
if (String::Equals(handle(scope_info->ParameterName(i), isolate_),
parameter_name)) {
// Suspended generators should not get here because all parameters should
// be context-allocated.
DCHECK_NOT_NULL(frame_inspector_);
@ -707,7 +709,8 @@ bool ScopeIterator::SetStackVariableValue(Handle<ScopeInfo> scope_info,
// generators are supported.
HandleScope scope(isolate_);
for (int i = 0; i < scope_info->StackLocalCount(); ++i) {
if (String::Equals(handle(scope_info->StackLocalName(i)), variable_name)) {
if (String::Equals(handle(scope_info->StackLocalName(i), isolate_),
variable_name)) {
int stack_local_index = scope_info->StackLocalIndex(i);
if (frame_inspector_ != nullptr) {
// Set the variable on the stack.
@ -769,11 +772,11 @@ bool ScopeIterator::SetLocalVariableValue(Handle<String> variable_name,
Handle<Object> new_value) {
Handle<ScopeInfo> scope_info;
if (HasNestedScopeChain()) {
scope_info = handle(function_->shared()->scope_info());
scope_info = handle(function_->shared()->scope_info(), isolate_);
DCHECK_IMPLIES(scope_info->HasContext(),
context_->scope_info() == *scope_info);
} else {
scope_info = handle(context_->scope_info());
scope_info = handle(context_->scope_info(), isolate_);
}
// Parameter might be shadowed in context. Don't stop here.
@ -878,7 +881,7 @@ bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name,
void ScopeIterator::CopyContextLocalsToScopeObject(
Handle<ScopeInfo> scope_info, Handle<Context> context,
Handle<JSObject> scope_object) {
Isolate* isolate = scope_info->GetIsolate();
Isolate* isolate = isolate_;
int local_count = scope_info->ContextLocalCount();
if (local_count == 0) return;
// Fill all context locals to the context extension.
@ -899,7 +902,7 @@ void ScopeIterator::CopyContextLocalsToScopeObject(
void ScopeIterator::CopyModuleVarsToScopeObject(Handle<ScopeInfo> scope_info,
Handle<Context> context,
Handle<JSObject> scope_object) {
Isolate* isolate = scope_info->GetIsolate();
Isolate* isolate = isolate_;
int module_variable_count =
Smi::cast(scope_info->get(scope_info->ModuleVariableCountIndex()))

View File

@ -311,8 +311,8 @@ BreakLocation BreakIterator::GetBreakLocation() {
// bytecode array, and we'll read the actual generator object off the
// interpreter stack frame in GetGeneratorObjectForSuspendedFrame.
BytecodeArray* bytecode_array = debug_info_->OriginalBytecodeArray();
interpreter::BytecodeArrayAccessor accessor(handle(bytecode_array),
code_offset());
interpreter::BytecodeArrayAccessor accessor(
handle(bytecode_array, bytecode_array->GetIsolate()), code_offset());
DCHECK_EQ(accessor.current_bytecode(),
interpreter::Bytecode::kSuspendGenerator);
@ -1317,7 +1317,7 @@ void Debug::InstallDebugBreakTrampoline() {
if (!shared->HasDebugInfo()) continue;
if (!shared->GetDebugInfo()->CanBreakAtEntry()) continue;
if (!fun->is_compiled()) {
needs_compile.push_back(handle(fun));
needs_compile.push_back(handle(fun, isolate_));
} else {
fun->set_code(*trampoline);
}
@ -1384,7 +1384,7 @@ bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position,
}
if (!info->IsSubjectToDebugging()) continue;
if (!info->is_compiled() && !info->allows_lazy_compilation()) continue;
candidates.push_back(i::handle(info));
candidates.push_back(i::handle(info, isolate_));
}
bool was_compiled = false;
@ -1507,7 +1507,8 @@ Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
HandleScope scope(isolate_);
// Code that cannot be compiled lazily are internal and not debuggable.
DCHECK(shared->allows_lazy_compilation());
if (!Compiler::Compile(handle(shared), Compiler::CLEAR_EXCEPTION)) break;
if (!Compiler::Compile(handle(shared, isolate_), Compiler::CLEAR_EXCEPTION))
break;
}
return isolate_->factory()->undefined_value();
}
@ -1553,7 +1554,7 @@ void Debug::CreateBreakInfo(Handle<SharedFunctionInfo> shared) {
Handle<DebugInfo> Debug::GetOrCreateDebugInfo(
Handle<SharedFunctionInfo> shared) {
if (shared->HasDebugInfo()) return handle(shared->GetDebugInfo());
if (shared->HasDebugInfo()) return handle(shared->GetDebugInfo(), isolate_);
// Create debug info and add it to the list.
Handle<DebugInfo> debug_info = isolate_->factory()->NewDebugInfo(shared);
@ -1734,7 +1735,7 @@ void Debug::OnPromiseReject(Handle<Object> promise, Handle<Object> value) {
namespace {
v8::Local<v8::Context> GetDebugEventContext(Isolate* isolate) {
Handle<Context> context = handle(isolate->context());
Handle<Context> context = handle(isolate->context(), isolate);
// Isolate::context() may have been nullptr when "script collected" event
// occurred.
if (context.is_null()) return v8::Local<v8::Context>();
@ -2223,7 +2224,8 @@ bool Debug::PerformSideEffectCheck(Handle<JSFunction> function,
return false;
}
SharedFunctionInfo::SideEffectState side_effect_state =
SharedFunctionInfo::GetSideEffectState(handle(function->shared()));
SharedFunctionInfo::GetSideEffectState(
handle(function->shared(), isolate_));
switch (side_effect_state) {
case SharedFunctionInfo::kHasSideEffects:
if (FLAG_trace_side_effect_free_debug_evaluate) {
@ -2285,8 +2287,8 @@ bool Debug::PerformSideEffectCheckAtBytecode(InterpretedFrame* frame) {
SharedFunctionInfo* shared = frame->function()->shared();
BytecodeArray* bytecode_array = shared->GetBytecodeArray();
int offset = frame->GetBytecodeOffset();
interpreter::BytecodeArrayAccessor bytecode_accessor(handle(bytecode_array),
offset);
interpreter::BytecodeArrayAccessor bytecode_accessor(
handle(bytecode_array, isolate_), offset);
Bytecode bytecode = bytecode_accessor.current_bytecode();
interpreter::Register reg;

View File

@ -836,7 +836,7 @@ void LiveEdit::ReplaceFunctionCode(
if (shared_info->HasBreakInfo()) {
// Existing break points will be re-applied. Reset the debug info here.
isolate->debug()->RemoveBreakInfoAndMaybeFree(
handle(shared_info->GetDebugInfo()));
handle(shared_info->GetDebugInfo(), isolate));
}
shared_info->set_scope_info(new_shared_info->scope_info());
shared_info->set_feedback_metadata(new_shared_info->feedback_metadata());
@ -901,7 +901,7 @@ void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper,
SharedFunctionInfo::SetScript(shared_info, script_handle);
shared_info->DisableOptimization(BailoutReason::kLiveEdit);
function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info);
isolate->compilation_cache()->Remove(shared_info);
}
namespace {

View File

@ -153,7 +153,7 @@ DeoptimizerData::~DeoptimizerData() {
Code* Deoptimizer::FindDeoptimizingCode(Address addr) {
if (function_->IsHeapObject()) {
// Search all deoptimizing code in the native context of the function.
Isolate* isolate = function_->GetIsolate();
Isolate* isolate = isolate_;
Context* native_context = function_->context()->native_context();
Object* element = native_context->DeoptimizedCodeListHead();
while (!element->IsUndefined(isolate)) {

View File

@ -383,7 +383,7 @@ Handle<WeakFixedArray> FeedbackNexus::EnsureArrayOfSize(int length) {
if (GetFeedback()->ToStrongHeapObject(&heap_object) &&
heap_object->IsWeakFixedArray() &&
WeakFixedArray::cast(heap_object)->length() == length) {
return handle(WeakFixedArray::cast(heap_object));
return handle(WeakFixedArray::cast(heap_object), isolate);
}
Handle<WeakFixedArray> array = isolate->factory()->NewWeakFixedArray(length);
SetFeedback(*array);
@ -396,7 +396,7 @@ Handle<WeakFixedArray> FeedbackNexus::EnsureExtraArrayOfSize(int length) {
if (GetFeedbackExtra()->ToStrongHeapObject(&heap_object) &&
heap_object->IsWeakFixedArray() &&
WeakFixedArray::cast(heap_object)->length() == length) {
return handle(WeakFixedArray::cast(heap_object));
return handle(WeakFixedArray::cast(heap_object), isolate);
}
Handle<WeakFixedArray> array = isolate->factory()->NewWeakFixedArray(length);
SetFeedbackExtra(*array);
@ -1059,8 +1059,8 @@ void FeedbackNexus::Collect(Handle<String> type, int position) {
*FeedbackVector::UninitializedSentinel(isolate))) {
types = SimpleNumberDictionary::New(isolate, 1);
} else {
types =
handle(SimpleNumberDictionary::cast(feedback->ToStrongHeapObject()));
types = handle(SimpleNumberDictionary::cast(feedback->ToStrongHeapObject()),
isolate);
}
Handle<ArrayList> position_specific_types;
@ -1072,7 +1072,8 @@ void FeedbackNexus::Collect(Handle<String> type, int position) {
types, position, ArrayList::Add(position_specific_types, type));
} else {
DCHECK(types->ValueAt(entry)->IsArrayList());
position_specific_types = handle(ArrayList::cast(types->ValueAt(entry)));
position_specific_types =
handle(ArrayList::cast(types->ValueAt(entry)), isolate);
if (!InList(position_specific_types, type)) { // Add type
types = SimpleNumberDictionary::Set(
types, position, ArrayList::Add(position_specific_types, type));
@ -1182,7 +1183,8 @@ JSObject* FeedbackNexus::GetTypeProfile() const {
return *ConvertToJSObject(
isolate,
handle(SimpleNumberDictionary::cast(feedback->ToStrongHeapObject())));
handle(SimpleNumberDictionary::cast(feedback->ToStrongHeapObject()),
isolate));
}
void FeedbackNexus::ResetTypeProfile() {

View File

@ -99,12 +99,13 @@ void CallOptimization::Initialize(
Handle<FunctionTemplateInfo> function_template_info) {
Isolate* isolate = function_template_info->GetIsolate();
if (function_template_info->call_code()->IsUndefined(isolate)) return;
api_call_info_ =
handle(CallHandlerInfo::cast(function_template_info->call_code()));
api_call_info_ = handle(
CallHandlerInfo::cast(function_template_info->call_code()), isolate);
if (!function_template_info->signature()->IsUndefined(isolate)) {
expected_receiver_type_ =
handle(FunctionTemplateInfo::cast(function_template_info->signature()));
handle(FunctionTemplateInfo::cast(function_template_info->signature()),
isolate);
}
is_simple_api_call_ = true;
}

View File

@ -626,7 +626,7 @@ bool IC::IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map) {
Map* transitioned_map = nullptr;
if (more_general_transition) {
MapHandles map_list;
map_list.push_back(handle(target_map));
map_list.push_back(handle(target_map, isolate_));
transitioned_map = source_map->FindElementsKindTransitionedMap(map_list);
}
return transitioned_map == target_map;
@ -1914,7 +1914,7 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
if (receiver_map->is_stable()) {
receiver_map->NotifyLeafMapLayoutChange();
}
transition = handle(tmap);
transition = handle(tmap, tmap->GetIsolate());
}
}

View File

@ -144,7 +144,7 @@ class IC {
if (receiver->IsSmi()) {
receiver_map_ = isolate_->factory()->heap_number_map();
} else {
receiver_map_ = handle(HeapObject::cast(*receiver)->map());
receiver_map_ = handle(HeapObject::cast(*receiver)->map(), isolate_);
}
}

View File

@ -720,7 +720,7 @@ Maybe<bool> KeyAccumulator::CollectOwnKeys(Handle<JSReceiver> receiver,
Handle<JSObject> object) {
// Check access rights if required.
if (object->IsAccessCheckNeeded() &&
!isolate_->MayAccess(handle(isolate_->context()), object)) {
!isolate_->MayAccess(handle(isolate_->context(), isolate_), object)) {
// The cross-origin spec says that [[Enumerate]] shall return an empty
// iterator when it doesn't have access...
if (mode_ == KeyCollectionMode::kIncludePrototypes) {

View File

@ -237,7 +237,7 @@ Handle<Map> LookupIterator::GetReceiverMap() const {
bool LookupIterator::HasAccess() const {
DCHECK_EQ(ACCESS_CHECK, state_);
return isolate_->MayAccess(handle(isolate_->context()),
return isolate_->MayAccess(handle(isolate_->context(), isolate_),
GetHolder<JSObject>());
}

View File

@ -705,7 +705,8 @@ bool Object::StrictEquals(Object* that) {
// static
Handle<String> Object::TypeOf(Isolate* isolate, Handle<Object> object) {
if (object->IsNumber()) return isolate->factory()->number_string();
if (object->IsOddball()) return handle(Oddball::cast(*object)->type_of());
if (object->IsOddball())
return handle(Oddball::cast(*object)->type_of(), isolate);
if (object->IsUndetectable()) {
return isolate->factory()->undefined_string();
}
@ -1222,7 +1223,7 @@ Handle<SharedFunctionInfo> FunctionTemplateInfo::GetOrCreateSharedFunctionInfo(
if (maybe_name.ToHandle(&name) && name->IsString()) {
name_string = Handle<String>::cast(name);
} else if (info->class_name()->IsString()) {
name_string = handle(String::cast(info->class_name()));
name_string = handle(String::cast(info->class_name()), isolate);
} else {
name_string = isolate->factory()->empty_string();
}
@ -3701,7 +3702,7 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
if (maybe_tag->IsString()) return Handle<String>::cast(maybe_tag);
PrototypeIterator iter(isolate, receiver);
if (iter.IsAtEnd()) return handle(receiver->class_name());
if (iter.IsAtEnd()) return handle(receiver->class_name(), isolate);
Handle<JSReceiver> start = PrototypeIterator::GetCurrent<JSReceiver>(iter);
LookupIterator it(receiver, isolate->factory()->constructor_string(), start,
LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR);
@ -3714,7 +3715,7 @@ Handle<String> JSReceiver::GetConstructorName(Handle<JSReceiver> receiver) {
}
return result.is_identical_to(isolate->factory()->Object_string())
? handle(receiver->class_name())
? handle(receiver->class_name(), isolate)
: result;
}
@ -4726,7 +4727,7 @@ MaybeHandle<Map> Map::TryUpdate(Handle<Map> old_map) {
}
Map* new_map = root_map->TryReplayPropertyTransitions(*old_map);
if (new_map == nullptr) return MaybeHandle<Map>();
return handle(new_map);
return handle(new_map, new_map->GetIsolate());
}
Map* Map::TryReplayPropertyTransitions(Map* old_map) {
@ -5166,7 +5167,7 @@ Maybe<bool> Object::AddDataProperty(LookupIterator* it, Handle<Object> value,
if (receiver->IsJSArray()) {
Handle<JSArray> array = Handle<JSArray>::cast(receiver);
if (JSArray::WouldChangeReadOnlyLength(array, it->index())) {
RETURN_FAILURE(array->GetIsolate(), should_throw,
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kStrictReadOnlyProperty,
isolate->factory()->length_string(),
Object::TypeOf(isolate, array), array));
@ -5490,12 +5491,12 @@ Handle<Map> Map::TransitionElementsTo(Handle<Map> map,
if (from_kind == FAST_SLOPPY_ARGUMENTS_ELEMENTS) {
if (*map == native_context->fast_aliased_arguments_map()) {
DCHECK_EQ(SLOW_SLOPPY_ARGUMENTS_ELEMENTS, to_kind);
return handle(native_context->slow_aliased_arguments_map());
return handle(native_context->slow_aliased_arguments_map(), isolate);
}
} else if (from_kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS) {
if (*map == native_context->slow_aliased_arguments_map()) {
DCHECK_EQ(FAST_SLOPPY_ARGUMENTS_ELEMENTS, to_kind);
return handle(native_context->fast_aliased_arguments_map());
return handle(native_context->fast_aliased_arguments_map(), isolate);
}
} else if (IsFastElementsKind(from_kind) && IsFastElementsKind(to_kind)) {
// Reuse map transitions for JSArrays.
@ -5515,7 +5516,7 @@ Handle<Map> Map::TransitionElementsTo(Handle<Map> map,
to_kind == GetPackedElementsKind(from_kind) &&
map->GetBackPointer()->IsMap() &&
Map::cast(map->GetBackPointer())->elements_kind() == to_kind) {
return handle(Map::cast(map->GetBackPointer()));
return handle(Map::cast(map->GetBackPointer()), isolate);
}
bool allow_store_transition = IsTransitionElementsKind(from_kind);
@ -6240,7 +6241,7 @@ MaybeHandle<Map> NormalizedMapCache::Get(Handle<Map> fast_map,
if (!normalized_map->EquivalentToForNormalization(*fast_map, mode)) {
return MaybeHandle<Map>();
}
return handle(normalized_map);
return handle(normalized_map, normalized_map->GetIsolate());
}
void NormalizedMapCache::Set(Handle<Map> fast_map, Handle<Map> normalized_map,
@ -8311,7 +8312,7 @@ Maybe<bool> JSObject::PreventExtensions(Handle<JSObject> object,
}
if (object->IsAccessCheckNeeded() &&
!isolate->MayAccess(handle(isolate->context()), object)) {
!isolate->MayAccess(handle(isolate->context(), isolate), object)) {
isolate->ReportFailedAccessCheck(object);
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
RETURN_FAILURE(isolate, should_throw,
@ -8347,7 +8348,8 @@ Maybe<bool> JSObject::PreventExtensions(Handle<JSObject> object,
// Do a map transition, other objects with this map may still
// be extensible.
// TODO(adamk): Extend the NormalizedMapCache to handle non-extensible maps.
Handle<Map> new_map = Map::Copy(handle(object->map()), "PreventExtensions");
Handle<Map> new_map =
Map::Copy(handle(object->map(), isolate), "PreventExtensions");
new_map->set_is_extensible(false);
JSObject::MigrateToMap(object, new_map);
@ -8409,7 +8411,7 @@ Maybe<bool> JSProxy::IsExtensible(Handle<JSProxy> proxy) {
bool JSObject::IsExtensible(Handle<JSObject> object) {
Isolate* isolate = object->GetIsolate();
if (object->IsAccessCheckNeeded() &&
!isolate->MayAccess(handle(isolate->context()), object)) {
!isolate->MayAccess(handle(isolate->context(), isolate), object)) {
return true;
}
if (object->IsJSGlobalProxy()) {
@ -8458,7 +8460,7 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition(
Isolate* isolate = object->GetIsolate();
if (object->IsAccessCheckNeeded() &&
!isolate->MayAccess(handle(isolate->context()), object)) {
!isolate->MayAccess(handle(isolate->context(), isolate), object)) {
isolate->ReportFailedAccessCheck(object);
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
RETURN_FAILURE(isolate, should_throw,
@ -8539,8 +8541,8 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition(
// Create a new map, since other objects with this map may be extensible.
// TODO(adamk): Extend the NormalizedMapCache to handle non-extensible maps.
Handle<Map> new_map =
Map::Copy(handle(object->map()), "SlowCopyForPreventExtensions");
Handle<Map> new_map = Map::Copy(handle(object->map(), isolate),
"SlowCopyForPreventExtensions");
new_map->set_is_extensible(false);
if (!new_element_dictionary.is_null()) {
ElementsKind new_kind =
@ -9640,8 +9642,8 @@ Handle<Map> Map::Copy(Handle<Map> map, const char* reason) {
Handle<Map> Map::Create(Isolate* isolate, int inobject_properties) {
Handle<Map> copy =
Copy(handle(isolate->object_function()->initial_map()), "MapCreate");
Handle<Map> copy = Copy(
handle(isolate->object_function()->initial_map(), isolate), "MapCreate");
// Check that we do not overflow the instance size when adding the extra
// inobject properties. If the instance size overflows, we allocate as many
@ -9794,7 +9796,6 @@ Handle<Map> Map::TransitionToDataProperty(Handle<Map> map, Handle<Name> name,
Handle<Map> result;
if (!maybe_map.ToHandle(&result)) {
Isolate* isolate = name->GetIsolate();
const char* reason = "TooManyFastProperties";
#if V8_TRACE_MAPS
std::unique_ptr<ScopedVector<char>> buffer;
@ -9989,7 +9990,7 @@ Handle<Map> Map::CopyAddDescriptor(Handle<Map> map,
Handle<LayoutDescriptor> new_layout_descriptor =
FLAG_unbox_double_fields
? LayoutDescriptor::New(map, new_descriptors, nof + 1)
: handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate());
: handle(LayoutDescriptor::FastPointerLayout(), isolate);
return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor,
flag, descriptor->GetKey(), "CopyAddDescriptor",
@ -12767,7 +12768,8 @@ Handle<Object> CacheInitialJSArrayMaps(
Handle<Map> new_map;
ElementsKind next_kind = GetFastElementsKindFromSequenceIndex(i);
if (Map* maybe_elements_transition = current_map->ElementsTransitionMap()) {
new_map = handle(maybe_elements_transition);
new_map = handle(maybe_elements_transition,
maybe_elements_transition->GetIsolate());
} else {
new_map = Map::CopyAsElementsKind(
current_map, next_kind, INSERT_TRANSITION);
@ -12794,7 +12796,7 @@ void SetInstancePrototype(Isolate* isolate, Handle<JSFunction> function,
Handle<Map> initial_map(function->initial_map(), isolate);
if (!initial_map->GetIsolate()->bootstrapper()->IsActive() &&
if (!isolate->bootstrapper()->IsActive() &&
initial_map->instance_type() == JS_OBJECT_TYPE) {
// Put the value in the initial map field until an initial map is needed.
// At that point, a new initial map is created and the prototype is put
@ -12848,7 +12850,8 @@ void JSFunction::SetPrototype(Handle<JSFunction> function,
// Copy the map so this does not affect unrelated functions.
// Remove map transitions because they point to maps with a
// different prototype.
Handle<Map> new_map = Map::Copy(handle(function->map()), "SetPrototype");
Handle<Map> new_map =
Map::Copy(handle(function->map(), isolate), "SetPrototype");
JSObject::MigrateToMap(function, new_map);
new_map->SetConstructor(*value);
@ -13508,7 +13511,7 @@ Handle<JSObject> Script::GetWrapper(Handle<Script> script) {
Handle<WeakCell> cell(WeakCell::cast(script->wrapper()));
if (!cell->cleared()) {
// Return a handle for the existing script wrapper from the cache.
return handle(JSObject::cast(cell->value()));
return handle(JSObject::cast(cell->value()), isolate);
}
// If we found an empty WeakCell, that means the script wrapper was
// GCed. We are not notified directly of that, so we decrement here
@ -13541,7 +13544,7 @@ MaybeHandle<SharedFunctionInfo> Script::FindSharedFunctionInfo(
heap_object->IsUndefined(isolate)) {
return MaybeHandle<SharedFunctionInfo>();
}
return handle(SharedFunctionInfo::cast(heap_object));
return handle(SharedFunctionInfo::cast(heap_object), isolate);
}
Script::Iterator::Iterator(Isolate* isolate)
@ -13575,7 +13578,7 @@ SharedFunctionInfo* SharedFunctionInfo::ScriptIterator::Next() {
}
void SharedFunctionInfo::ScriptIterator::Reset(Handle<Script> script) {
shared_function_infos_ = handle(script->shared_function_infos());
shared_function_infos_ = handle(script->shared_function_infos(), isolate_);
index_ = 0;
}
@ -13592,7 +13595,7 @@ SharedFunctionInfo* SharedFunctionInfo::GlobalIterator::Next() {
if (next != nullptr) return next;
Script* next_script = script_iterator_.Next();
if (next_script == nullptr) return nullptr;
sfi_iterator_.Reset(handle(next_script));
sfi_iterator_.Reset(handle(next_script, next_script->GetIsolate()));
}
}
@ -14753,7 +14756,7 @@ void BytecodeArray::Disassemble(std::ostream& os) {
Address base_address = GetFirstBytecodeAddress();
SourcePositionTableIterator source_positions(SourcePositionTable());
interpreter::BytecodeArrayIterator iterator(handle(this));
interpreter::BytecodeArrayIterator iterator(handle(this, this->GetIsolate()));
while (!iterator.done()) {
if (!source_positions.done() &&
iterator.current_offset() == source_positions.code_offset()) {
@ -15250,7 +15253,7 @@ Maybe<bool> JSObject::SetPrototype(Handle<JSObject> object,
if (from_javascript) {
if (object->IsAccessCheckNeeded() &&
!isolate->MayAccess(handle(isolate->context()), object)) {
!isolate->MayAccess(handle(isolate->context(), isolate), object)) {
isolate->ReportFailedAccessCheck(object);
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
RETURN_FAILURE(isolate, should_throw,
@ -16854,7 +16857,7 @@ Handle<PropertyCell> JSGlobalObject::EnsureEmptyPropertyCell(
Handle<PropertyCell> cell;
if (entry != GlobalDictionary::kNotFound) {
if (entry_out) *entry_out = entry;
cell = handle(dictionary->CellAt(entry));
cell = handle(dictionary->CellAt(entry), isolate);
PropertyCellType original_cell_type = cell->property_details().cell_type();
DCHECK(original_cell_type == PropertyCellType::kInvalidated ||
original_cell_type == PropertyCellType::kUninitialized);
@ -18850,7 +18853,7 @@ MaybeHandle<Name> FunctionTemplateInfo::TryGetCachedPropertyName(
Handle<FunctionTemplateInfo>::cast(getter);
// Check if the accessor uses a cached property.
if (!fti->cached_property_name()->IsTheHole(isolate)) {
return handle(Name::cast(fti->cached_property_name()));
return handle(Name::cast(fti->cached_property_name()), isolate);
}
}
return MaybeHandle<Name>();

View File

@ -375,7 +375,7 @@ MaybeHandle<SmallOrderedHashSet> SmallOrderedHashSet::Add(
}
}
int hash = key->GetOrCreateHash(table->GetIsolate())->value();
int hash = key->GetOrCreateHash(isolate)->value();
int nof = table->NumberOfElements();
// Read the existing bucket values.
@ -409,7 +409,7 @@ MaybeHandle<SmallOrderedHashMap> SmallOrderedHashMap::Add(
}
}
int hash = key->GetOrCreateHash(table->GetIsolate())->value();
int hash = key->GetOrCreateHash(isolate)->value();
int nof = table->NumberOfElements();
// Read the existing bucket values.

View File

@ -283,7 +283,7 @@ void ProfilerListener::AttachDeoptInlinedFrames(Code* code,
// scope limits their lifetime.
HandleScope scope(isolate_);
std::vector<SourcePositionInfo> stack =
last_position.InliningStack(handle(code));
last_position.InliningStack(handle(code, isolate_));
CpuProfileDeoptFrame* deopt_frames =
new CpuProfileDeoptFrame[stack.size()];

View File

@ -282,7 +282,7 @@ v8::AllocationProfile* SamplingHeapProfiler::GetAllocationProfile() {
{
Script::Iterator iterator(isolate_);
while (Script* script = iterator.Next()) {
scripts[script->id()] = handle(script);
scripts[script->id()] = handle(script, isolate_);
}
}
auto profile = new v8::internal::AllocationProfile();

View File

@ -88,7 +88,7 @@ class PrototypeIterator {
// PrototypeIterator.
DCHECK(!handle_.is_null());
if (handle_->IsAccessCheckNeeded()) {
return isolate_->MayAccess(handle(isolate_->context()),
return isolate_->MayAccess(handle(isolate_->context(), isolate_),
Handle<JSObject>::cast(handle_));
}
return true;

View File

@ -1673,9 +1673,9 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
Handle<WasmCompiledModule> new_compiled_module;
{
Handle<WasmCompiledModule> original =
handle(module_object_->compiled_module());
handle(module_object_->compiled_module(), isolate_);
if (original->has_instance()) {
old_instance = handle(original->owning_instance());
old_instance = handle(original->owning_instance(), isolate_);
// Clone, but don't insert yet the clone in the instances chain.
// We do that last. Since we are holding on to the old instance,
// the owner + original state used for cloning and patching
@ -1848,7 +1848,7 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
code_specialization.ApplyToWholeModule(native_module, module_object_,
SKIP_ICACHE_FLUSH);
FlushICache(native_module);
FlushICache(handle(module_object_->export_wrappers()));
FlushICache(handle(module_object_->export_wrappers(), isolate_));
//--------------------------------------------------------------------------
// Unpack and notify signal handler of protected instructions.
@ -2284,7 +2284,7 @@ int InstanceBuilder::ProcessImports(Handle<WasmInstanceObject> instance) {
// so putting {-1} in the table will cause checks to always fail.
auto target = Handle<WasmExportedFunction>::cast(val);
Handle<WasmInstanceObject> imported_instance =
handle(target->instance());
handle(target->instance(), isolate_);
Address exported_call_target = target->GetWasmCallTarget();
FunctionSig* sig = imported_instance->module()
->functions[target->function_index()]

View File

@ -505,8 +505,9 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
Code* call_target =
Code::GetCodeFromTargetAddress(orig_it.rinfo()->target_address());
it.rinfo()->set_target_address(GetLocalAddressFor(handle(call_target)),
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
it.rinfo()->set_target_address(
GetLocalAddressFor(handle(call_target, call_target->GetIsolate())),
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
} else {
it.rinfo()->apply(delta);
}
@ -572,8 +573,9 @@ WasmCode* NativeModule::AddCode(
// code object
Handle<Object> p = it.rinfo()->target_object_handle(origin);
Code* code = Code::cast(*p);
it.rinfo()->set_target_address(GetLocalAddressFor(handle(code)),
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
it.rinfo()->set_target_address(
GetLocalAddressFor(handle(code, code->GetIsolate())),
SKIP_WRITE_BARRIER, SKIP_ICACHE_FLUSH);
} else {
it.rinfo()->apply(delta);
}

View File

@ -88,7 +88,7 @@ MaybeHandle<String> GetLocalName(Isolate* isolate,
func_locals_names->get(local_index)->IsUndefined(isolate)) {
return {};
}
return handle(String::cast(func_locals_names->get(local_index)));
return handle(String::cast(func_locals_names->get(local_index)), isolate);
}
class InterpreterHandle {
@ -144,7 +144,7 @@ class InterpreterHandle {
module_(
debug_info->wasm_instance()->module_object()->shared()->module()),
interpreter_(isolate, module_, GetBytes(debug_info),
handle(debug_info->wasm_instance())) {}
handle(debug_info->wasm_instance(), isolate)) {}
~InterpreterHandle() { DCHECK_EQ(0, activations_.size()); }
@ -410,7 +410,7 @@ class InterpreterHandle {
Handle<JSObject> GetGlobalScopeObject(wasm::InterpretedFrame* frame,
Handle<WasmDebugInfo> debug_info) {
Isolate* isolate = debug_info->GetIsolate();
Isolate* isolate = isolate_;
Handle<WasmInstanceObject> instance(debug_info->wasm_instance(), isolate);
// TODO(clemensh): Add globals to the global scope.
@ -434,7 +434,7 @@ class InterpreterHandle {
Handle<JSObject> GetLocalScopeObject(wasm::InterpretedFrame* frame,
Handle<WasmDebugInfo> debug_info) {
Isolate* isolate = debug_info->GetIsolate();
Isolate* isolate = isolate_;
Handle<JSObject> local_scope_object =
isolate_->factory()->NewJSObjectWithNullProto();
@ -787,7 +787,7 @@ Handle<JSFunction> WasmDebugInfo::GetCWasmEntry(
compiler::CWasmEntryParameters::kNumParameters);
entries->set(index, *new_entry);
}
return handle(JSFunction::cast(entries->get(index)));
return handle(JSFunction::cast(entries->get(index)), isolate);
}
} // namespace internal

View File

@ -104,7 +104,7 @@ void WasmEngine::AsyncCompile(
if (FLAG_wasm_test_streaming) {
std::shared_ptr<StreamingDecoder> streaming_decoder =
isolate->wasm_engine()->StartStreamingCompilation(
isolate, handle(isolate->context()), std::move(resolver));
isolate, handle(isolate->context(), isolate), std::move(resolver));
streaming_decoder->OnBytesReceived(bytes.module_bytes());
streaming_decoder->Finish();
return;
@ -114,9 +114,9 @@ void WasmEngine::AsyncCompile(
std::unique_ptr<byte[]> copy(new byte[bytes.length()]);
memcpy(copy.get(), bytes.start(), bytes.length());
AsyncCompileJob* job =
CreateAsyncCompileJob(isolate, std::move(copy), bytes.length(),
handle(isolate->context()), std::move(resolver));
AsyncCompileJob* job = CreateAsyncCompileJob(
isolate, std::move(copy), bytes.length(),
handle(isolate->context(), isolate), std::move(resolver));
job->Start();
}

View File

@ -406,7 +406,8 @@ void WasmTableObject::Set(Isolate* isolate, Handle<WasmTableObject> table,
DCHECK_NOT_NULL(wasm_function->sig);
Address call_target = exported_function->GetWasmCallTarget();
UpdateDispatchTables(isolate, table, table_index, wasm_function->sig,
handle(exported_function->instance()), call_target);
handle(exported_function->instance(), isolate),
call_target);
array->set(table_index, *function);
}
@ -893,8 +894,9 @@ void InstanceFinalizer(const v8::WeakCallbackInfo<void>& data) {
// the next GC cycle, so we need to manually break some links (such as
// the weak references from {WasmMemoryObject::instances}.
if (instance->has_memory_object()) {
WasmMemoryObject::RemoveInstance(isolate, handle(instance->memory_object()),
handle(instance));
WasmMemoryObject::RemoveInstance(isolate,
handle(instance->memory_object(), isolate),
handle(instance, isolate));
}
// We want to maintain a link from the {WasmModuleObject} to the first link

View File

@ -565,7 +565,7 @@ bool NativeModuleDeserializer::ReadCode(uint32_t fn_index, Reader* reader) {
Address NativeModuleDeserializer::GetBuiltinTrampolineFromTag(uint32_t tag) {
int builtin_id = static_cast<int>(tag);
v8::internal::Code* builtin = isolate_->builtins()->builtin(builtin_id);
return native_module_->GetLocalAddressFor(handle(builtin));
return native_module_->GetLocalAddressFor(handle(builtin, isolate_));
}
MaybeHandle<WasmModuleObject> DeserializeNativeModule(

View File

@ -138,9 +138,8 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
Handle<SharedFunctionInfo> shared(function->shared());
Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, function->GetIsolate(), shared,
function);
Zone zone(isolate->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, isolate, shared, function);
if (flags_ & OptimizedCompilationInfo::kInliningEnabled) {
info.MarkAsInliningEnabled();
@ -151,8 +150,7 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
CHECK(info.shared_info()->HasBytecodeArray());
JSFunction::EnsureFeedbackVector(function);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, function->GetIsolate());
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, isolate);
CHECK(!code.is_null());
info.dependencies()->Commit(code);
info.context()->native_context()->AddOptimizedCode(*code);
@ -164,12 +162,10 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
// and replace the JSFunction's code with the result.
Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
Handle<SharedFunctionInfo> shared(function->shared());
Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, function->GetIsolate(), shared,
function);
Zone zone(isolate->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, isolate, shared, function);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&info, function->GetIsolate(), graph);
Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, isolate, graph);
CHECK(!code.is_null());
function->set_code(*code);
return function;

View File

@ -117,18 +117,18 @@ class BytecodeGraphTester {
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function));
CHECK(function->shared()->HasBytecodeArray());
Zone zone(function->GetIsolate()->allocator(), ZONE_NAME);
Zone zone(isolate_->allocator(), ZONE_NAME);
Handle<SharedFunctionInfo> shared(function->shared());
OptimizedCompilationInfo compilation_info(&zone, function->GetIsolate(),
shared, function);
OptimizedCompilationInfo compilation_info(&zone, isolate_, shared,
function);
// Compiler relies on canonicalized handles, let's create
// a canonicalized scope and migrate existing handles there.
CanonicalHandleScope canonical(isolate_);
compilation_info.ReopenHandlesInNewHandleScope();
Handle<Code> code = Pipeline::GenerateCodeForTesting(
&compilation_info, function->GetIsolate());
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&compilation_info, isolate_);
function->set_code(*code);
return function;

View File

@ -183,7 +183,7 @@ TEST(TracingInEphemerons) {
ConstructTraceableJSApiObject(context, first_field, nullptr);
CHECK(!api_object.IsEmpty());
Handle<JSObject> js_key =
handle(JSObject::cast(*v8::Utils::OpenHandle(*key)));
handle(JSObject::cast(*v8::Utils::OpenHandle(*key)), i_isolate);
Handle<JSReceiver> js_api_object = v8::Utils::OpenHandle(*api_object);
int32_t hash = js_key->GetOrCreateHash(i_isolate)->value();
JSWeakCollection::Set(weak_map, js_key, js_api_object, hash);

View File

@ -5119,7 +5119,7 @@ HEAP_TEST(Regress589413) {
byte_array->set(j, 0x31);
}
// Add the array in root set.
handle(byte_array);
handle(byte_array, isolate);
}
// Make sure the byte arrays will be promoted on the next GC.
CcTest::CollectGarbage(NEW_SPACE);
@ -5135,7 +5135,7 @@ HEAP_TEST(Regress589413) {
arrays.push_back(array);
pages.insert(Page::FromAddress(array->address()));
// Add the array in root set.
handle(array);
handle(array, isolate);
}
// Expand and full one complete page with fixed arrays.
heap->set_force_oom(false);
@ -5143,7 +5143,7 @@ HEAP_TEST(Regress589413) {
arrays.push_back(array);
pages.insert(Page::FromAddress(array->address()));
// Add the array in root set.
handle(array);
handle(array, isolate);
// Do not expand anymore.
heap->set_force_oom(true);
}

View File

@ -171,7 +171,7 @@ Handle<BytecodeArray> OptimizedBytecodeSourcePositionTester::MakeBytecode(
.ToLocalChecked());
Handle<JSFunction> function =
Handle<JSFunction>::cast(v8::Utils::OpenHandle(*api_function));
return handle(function->shared()->GetBytecodeArray());
return handle(function->shared()->GetBytecodeArray(), isolate_);
}
void OptimizedBytecodeSourcePositionTester::SetOptimizationFlags(

View File

@ -730,7 +730,7 @@ TEST(PreParserScopeAnalysis) {
v8::Local<v8::Value> v = CompileRun(program.start());
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared(), isolate);
if (inners[inner_ix].bailout == Bailout::BAILOUT_IF_OUTER_SLOPPY &&
!outers[outer_ix].strict_outer) {

View File

@ -396,9 +396,10 @@ TEST(ToString) {
test_cases->set(4, *tostring_test);
for (int i = 0; i < 5; ++i) {
Handle<FixedArray> test = handle(FixedArray::cast(test_cases->get(i)));
Handle<FixedArray> test =
handle(FixedArray::cast(test_cases->get(i)), isolate);
Handle<Object> obj = handle(test->get(0), isolate);
Handle<String> expected = handle(String::cast(test->get(1)));
Handle<String> expected = handle(String::cast(test->get(1)), isolate);
Handle<Object> result = ft.Call(obj).ToHandleChecked();
CHECK(result->IsString());
CHECK(String::Equals(Handle<String>::cast(result), expected));
@ -2549,8 +2550,8 @@ TEST(NewPromiseCapability) {
JSFunction::cast(result->resolve())->shared());
Handle<JSFunction> callbacks[] = {
handle(JSFunction::cast(result->resolve())),
handle(JSFunction::cast(result->reject()))};
handle(JSFunction::cast(result->resolve()), isolate),
handle(JSFunction::cast(result->reject()), isolate)};
for (auto&& callback : callbacks) {
Handle<Context> context(Context::cast(callback->context()));

View File

@ -51,7 +51,7 @@ bool EQUALS(Handle<T> left, Handle<M> right) {
template <typename T, typename M>
bool EQUALS(Handle<T> left, M right) {
return EQUALS(left, handle(right));
return EQUALS(left, handle(right, right->GetIsolate()));
}
@ -324,7 +324,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_SMI_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::ToInt(array->length()));
previous_map = handle(array->map());
previous_map = handle(array->map(), isolate);
// add a couple of elements again
name = MakeString("0");
@ -347,7 +347,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::ToInt(array->length()));
previous_map = handle(array->map());
previous_map = handle(array->map(), isolate);
// We don't transition back to FAST_SMI even if we remove the string
name = MakeString("0");
@ -397,7 +397,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::ToInt(array->length()));
previous_map = handle(array->map());
previous_map = handle(array->map(), isolate);
// add a couple of elements, elements_kind stays HOLEY
name = MakeString("0");
@ -437,7 +437,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(PACKED_DOUBLE_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(1, Smi::ToInt(array->length()));
previous_map = handle(array->map());
previous_map = handle(array->map(), isolate);
// `array[1] = value_smi` doesn't alter the |elements_kind|
name = MakeString("1");
@ -454,7 +454,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_DOUBLE_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::ToInt(array->length()));
previous_map = handle(array->map());
previous_map = handle(array->map(), isolate);
// filling the hole `array[0] = value_smi` again doesn't transition back
name = MakeString("0");
@ -473,7 +473,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
CHECK_NE(array->map(), *previous_map);
CHECK_EQ(HOLEY_ELEMENTS, array->map()->elements_kind());
CHECK_EQ(2, Smi::ToInt(array->length()));
previous_map = handle(array->map());
previous_map = handle(array->map(), isolate);
// Adding a double doesn't change the map
name = MakeString("0");

View File

@ -400,7 +400,7 @@ class Expectations {
Map* target = TransitionsAccessor(isolate_, map)
.SearchTransition(*name, kData, attributes);
CHECK_NOT_NULL(target);
return handle(target);
return handle(target, isolate_);
}
Handle<Map> AddAccessorConstant(Handle<Map> map,
@ -2156,7 +2156,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
Map* target = TransitionsAccessor(isolate, map2)
.SearchTransition(*name, kData, NONE);
CHECK_NOT_NULL(target);
map2 = handle(target);
map2 = handle(target, isolate);
}
map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE,

View File

@ -3041,7 +3041,8 @@ TEST(InnerAssignment) {
v8::Local<v8::Value> v = CompileRun(program.start());
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
i::Handle<i::SharedFunctionInfo> shared =
i::handle(f->shared(), isolate);
info =
std::unique_ptr<i::ParseInfo>(new i::ParseInfo(isolate, shared));
CHECK(i::parsing::ParseFunction(info.get(), shared, isolate));
@ -3156,7 +3157,7 @@ TEST(MaybeAssignedParameters) {
v8::Local<v8::Value> v = CompileRun(program.start());
i::Handle<i::Object> o = v8::Utils::OpenHandle(*v);
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared());
i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared(), isolate);
info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(isolate, shared));
info->set_allow_lazy_parsing(allow_lazy);
CHECK(i::parsing::ParseFunction(info.get(), shared, isolate));

View File

@ -31,7 +31,7 @@ class BlockingCompilationJob : public OptimizedCompilationJob {
State::kReadyToExecute),
shared_(function->shared()),
zone_(isolate->allocator(), ZONE_NAME),
info_(&zone_, function->GetIsolate(), shared_, function),
info_(&zone_, isolate, shared_, function),
blocking_(false),
semaphore_(0) {}
~BlockingCompilationJob() override = default;