[GetIsolate] More low-hanging fruit

Access Isolate* and Heap* wherever already available.

Roughly:
GetIsolate(): -20
GetHeap(): -22
Handle<>(HeapObject): -315
handle(HeapObject): -21

Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I2da36ed1909d849812a1cb6bf94cb735eedca45b
Reviewed-on: https://chromium-review.googlesource.com/1111707
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53987}
This commit is contained in:
Leszek Swirski 2018-06-23 10:05:50 +01:00 committed by Commit Bot
parent 096927c123
commit 83ac43275e
105 changed files with 594 additions and 497 deletions

View File

@ -554,9 +554,11 @@ void Accessors::ScriptEvalFromScriptGetter(
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
Handle<Object> result = isolate->factory()->undefined_value();
if (script->has_eval_from_shared()) {
Handle<SharedFunctionInfo> eval_from_shared(script->eval_from_shared());
Handle<SharedFunctionInfo> eval_from_shared(script->eval_from_shared(),
isolate);
if (eval_from_shared->script()->IsScript()) {
Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()));
Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()),
isolate);
result = Script::GetWrapper(eval_from_script);
}
}
@ -615,7 +617,7 @@ void Accessors::ScriptEvalFromFunctionNameGetter(
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
Handle<Object> result = isolate->factory()->undefined_value();
if (script->has_eval_from_shared()) {
Handle<SharedFunctionInfo> shared(script->eval_from_shared());
Handle<SharedFunctionInfo> shared(script->eval_from_shared(), isolate);
// Find the name of the function calling eval.
result = Handle<Object>(shared->Name(), isolate);
}

View File

@ -122,7 +122,7 @@ MaybeHandle<Object> DefineDataProperty(Isolate* isolate,
void DisableAccessChecks(Isolate* isolate, Handle<JSObject> object) {
Handle<Map> old_map(object->map());
Handle<Map> old_map(object->map(), isolate);
// Copy map so it won't interfere constructor's initial map.
Handle<Map> new_map = Map::Copy(isolate, old_map, "DisableAccessChecks");
new_map->set_is_access_check_needed(false);
@ -131,7 +131,7 @@ void DisableAccessChecks(Isolate* isolate, Handle<JSObject> object) {
void EnableAccessChecks(Isolate* isolate, Handle<JSObject> object) {
Handle<Map> old_map(object->map());
Handle<Map> old_map(object->map(), isolate);
// Copy map so it won't interfere constructor's initial map.
Handle<Map> new_map = Map::Copy(isolate, old_map, "EnableAccessChecks");
new_map->set_is_access_check_needed(true);
@ -202,7 +202,7 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
Handle<FixedArray> array =
isolate->factory()->NewFixedArray(max_number_of_properties);
for (Handle<TemplateInfoT> temp(*data); *temp != nullptr;
for (Handle<TemplateInfoT> temp(*data, isolate); *temp != nullptr;
temp = handle(temp->GetParent(isolate), isolate)) {
// Accumulate accessors.
Object* maybe_properties = temp->property_accessors();
@ -214,7 +214,7 @@ MaybeHandle<JSObject> ConfigureInstance(Isolate* isolate, Handle<JSObject> obj,
// Install accumulated accessors.
for (int i = 0; i < valid_descriptors; i++) {
Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i)));
Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i)), isolate);
Handle<Name> name(Name::cast(accessor->name()), isolate);
JSObject::SetAccessor(obj, name, accessor,
accessor->initial_property_attributes())
@ -544,8 +544,8 @@ MaybeHandle<JSFunction> ApiNatives::InstantiateFunction(
}
MaybeHandle<JSObject> ApiNatives::InstantiateObject(
Handle<ObjectTemplateInfo> data, Handle<JSReceiver> new_target) {
Isolate* isolate = data->GetIsolate();
Isolate* isolate, Handle<ObjectTemplateInfo> data,
Handle<JSReceiver> new_target) {
InvokeScope invoke_scope(isolate);
return ::v8::internal::InstantiateObject(isolate, data, new_target, false,
false);
@ -557,7 +557,7 @@ MaybeHandle<JSObject> ApiNatives::InstantiateRemoteObject(
InvokeScope invoke_scope(isolate);
Handle<FunctionTemplateInfo> constructor(
FunctionTemplateInfo::cast(data->constructor()));
FunctionTemplateInfo::cast(data->constructor()), isolate);
Handle<Map> object_map = isolate->factory()->NewMap(
JS_SPECIAL_API_OBJECT_TYPE,
JSObject::kHeaderSize + data->embedder_field_count() * kPointerSize,
@ -663,7 +663,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
bool immutable_proto = false;
if (!obj->instance_template()->IsUndefined(isolate)) {
Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>(
ObjectTemplateInfo::cast(obj->instance_template()));
ObjectTemplateInfo::cast(obj->instance_template()), isolate);
embedder_field_count = instance_template->embedder_field_count();
immutable_proto = instance_template->immutable_proto();
}

View File

@ -26,7 +26,7 @@ class ApiNatives {
MaybeHandle<Name> maybe_name = MaybeHandle<Name>());
V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateObject(
Handle<ObjectTemplateInfo> data,
Isolate* isolate, Handle<ObjectTemplateInfo> data,
Handle<JSReceiver> new_target = Handle<JSReceiver>());
V8_WARN_UNUSED_RESULT static MaybeHandle<JSObject> InstantiateRemoteObject(

View File

@ -5282,7 +5282,7 @@ Local<Value> Function::GetDebugName() const {
}
auto func = i::Handle<i::JSFunction>::cast(self);
i::Handle<i::String> name = i::JSFunction::GetDebugName(func);
return Utils::ToLocal(i::Handle<i::Object>(*name, name->GetIsolate()));
return Utils::ToLocal(i::Handle<i::Object>(*name, self->GetIsolate()));
}
@ -6453,9 +6453,10 @@ i::Object** Context::GetDataFromSnapshotOnce(size_t index) {
MaybeLocal<v8::Object> ObjectTemplate::NewInstance(Local<Context> context) {
PREPARE_FOR_EXECUTION(context, ObjectTemplate, NewInstance, Object);
auto self = Utils::OpenHandle(this);
i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
Local<Object> result;
has_pending_exception =
!ToLocal<Object>(i::ApiNatives::InstantiateObject(self), &result);
has_pending_exception = !ToLocal<Object>(
i::ApiNatives::InstantiateObject(i_isolate, self), &result);
RETURN_ON_FAILED_EXECUTION(Object);
RETURN_ESCAPED(result);
}
@ -7747,7 +7748,8 @@ Local<ArrayBuffer> v8::ArrayBufferView::Buffer() {
i::Handle<i::JSDataView> data_view(i::JSDataView::cast(*obj),
obj->GetIsolate());
DCHECK(data_view->buffer()->IsJSArrayBuffer());
buffer = i::handle(i::JSArrayBuffer::cast(data_view->buffer()));
buffer = i::handle(i::JSArrayBuffer::cast(data_view->buffer()),
data_view->GetIsolate());
} else {
DCHECK(obj->IsJSTypedArray());
buffer = i::JSTypedArray::cast(*obj)->GetBuffer();
@ -9720,7 +9722,7 @@ MaybeLocal<debug::Script> debug::GeneratorObject::Script() {
Local<Function> debug::GeneratorObject::Function() {
i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
return Utils::ToLocal(handle(obj->function()));
return Utils::ToLocal(handle(obj->function(), obj->GetIsolate()));
}
debug::Location debug::GeneratorObject::SuspendedLocation() {
@ -9844,7 +9846,7 @@ int debug::GetDebuggingId(v8::Local<v8::Function> function) {
i::SharedFunctionInfo* shared = fun->shared();
int id = shared->debugging_id();
if (id == i::SharedFunctionInfo::kNoDebuggingId) {
id = shared->GetHeap()->NextDebuggingId();
id = callable->GetHeap()->NextDebuggingId();
shared->set_debugging_id(id);
}
DCHECK_NE(i::SharedFunctionInfo::kNoDebuggingId, id);

View File

@ -338,10 +338,10 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
base::ElapsedTimer instantiate_timer;
instantiate_timer.Start();
Handle<HeapNumber> uses_bitset(
HeapNumber::cast(wasm_data->get(kWasmDataUsesBitSet)));
HeapNumber::cast(wasm_data->get(kWasmDataUsesBitSet)), isolate);
Handle<WasmModuleObject> module(
WasmModuleObject::cast(wasm_data->get(kWasmDataCompiledModule)));
Handle<Script> script(Script::cast(shared->script()));
WasmModuleObject::cast(wasm_data->get(kWasmDataCompiledModule)), isolate);
Handle<Script> script(Script::cast(shared->script()), isolate);
// TODO(mstarzinger): The position currently points to the module definition
// but should instead point to the instantiation site (more intuitive).
int position = shared->StartPosition();

View File

@ -5423,7 +5423,7 @@ bool Genesis::ConfigureApiObject(Handle<JSObject> object,
->IsTemplateFor(object->map()));;
MaybeHandle<JSObject> maybe_obj =
ApiNatives::InstantiateObject(object_template);
ApiNatives::InstantiateObject(object->GetIsolate(), object_template);
Handle<JSObject> obj;
if (!maybe_obj.ToHandle(&obj)) {
DCHECK(isolate()->has_pending_exception());

View File

@ -64,7 +64,7 @@ V8_WARN_UNUSED_RESULT MaybeHandle<Object> HandleApiCallHelper(
ObjectTemplateInfo::cast(fun_data->instance_template()), isolate);
ASSIGN_RETURN_ON_EXCEPTION(
isolate, js_receiver,
ApiNatives::InstantiateObject(instance_template,
ApiNatives::InstantiateObject(isolate, instance_template,
Handle<JSReceiver>::cast(new_target)),
Object);
args[0] = *js_receiver;

View File

@ -364,7 +364,7 @@ class ArrayConcatVisitor {
// Fall-through to dictionary mode.
}
DCHECK(!fast_elements());
Handle<NumberDictionary> dict(NumberDictionary::cast(*storage_));
Handle<NumberDictionary> dict(NumberDictionary::cast(*storage_), isolate_);
// The object holding this backing store has just been allocated, so
// it cannot yet be used as a prototype.
Handle<JSObject> not_a_prototype_holder;
@ -582,7 +582,7 @@ void CollectElementIndices(Isolate* isolate, Handle<JSObject> object,
break;
}
Handle<FixedDoubleArray> elements(
FixedDoubleArray::cast(object->elements()));
FixedDoubleArray::cast(object->elements()), isolate);
uint32_t length = static_cast<uint32_t>(elements->length());
if (range < length) length = range;
for (uint32_t i = 0; i < length; i++) {
@ -735,7 +735,7 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
case HOLEY_ELEMENTS: {
// Run through the elements FixedArray and use HasElement and GetElement
// to check the prototype for missing elements.
Handle<FixedArray> elements(FixedArray::cast(array->elements()));
Handle<FixedArray> elements(FixedArray::cast(array->elements()), isolate);
int fast_length = static_cast<int>(length);
DCHECK(fast_length <= elements->length());
FOR_WITH_HANDLE_SCOPE(isolate, int, j = 0, j, j < fast_length, j++, {
@ -768,7 +768,7 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
break;
}
Handle<FixedDoubleArray> elements(
FixedDoubleArray::cast(array->elements()));
FixedDoubleArray::cast(array->elements()), isolate);
int fast_length = static_cast<int>(length);
DCHECK(fast_length <= elements->length());
FOR_WITH_HANDLE_SCOPE(isolate, int, j = 0, j, j < fast_length, j++, {
@ -795,7 +795,7 @@ bool IterateElements(Isolate* isolate, Handle<JSReceiver> receiver,
}
case DICTIONARY_ELEMENTS: {
Handle<NumberDictionary> dict(array->element_dictionary());
Handle<NumberDictionary> dict(array->element_dictionary(), isolate);
std::vector<uint32_t> indices;
indices.reserve(dict->Capacity() / 2);

View File

@ -82,7 +82,8 @@ BUILTIN(ArrayBufferConstructor) {
// all cases, or we will expose uinitialized memory to user code.
BUILTIN(ArrayBufferConstructor_DoNotInitialize) {
HandleScope scope(isolate);
Handle<JSFunction> target(isolate->native_context()->array_buffer_fun());
Handle<JSFunction> target(isolate->native_context()->array_buffer_fun(),
isolate);
Handle<Object> length = args.atOrUndefined(isolate, 1);
return ConstructBuffer(isolate, target, target, length, false);
}

View File

@ -125,7 +125,7 @@ BUILTIN(RegExpLeftContextGetter) {
HandleScope scope(isolate);
Handle<RegExpMatchInfo> match_info = isolate->regexp_last_match_info();
const int start_index = match_info->Capture(0);
Handle<String> last_subject(match_info->LastSubject());
Handle<String> last_subject(match_info->LastSubject(), isolate);
return *isolate->factory()->NewSubString(last_subject, 0, start_index);
}
@ -133,7 +133,7 @@ BUILTIN(RegExpRightContextGetter) {
HandleScope scope(isolate);
Handle<RegExpMatchInfo> match_info = isolate->regexp_last_match_info();
const int start_index = match_info->Capture(1);
Handle<String> last_subject(match_info->LastSubject());
Handle<String> last_subject(match_info->LastSubject(), isolate);
const int len = last_subject->length();
return *isolate->factory()->NewSubString(last_subject, start_index, len);
}

View File

@ -95,7 +95,7 @@ BUILTIN(TypedArrayPrototypeCopyWithin) {
DCHECK_GE(len - count, 0);
Handle<FixedTypedArrayBase> elements(
FixedTypedArrayBase::cast(array->elements()));
FixedTypedArrayBase::cast(array->elements()), isolate);
size_t element_size = array->element_size();
to = to * element_size;
from = from * element_size;

View File

@ -95,7 +95,7 @@ void CodeStub::RecordCodeGeneration(Handle<Code> code) {
void CodeStub::DeleteStubFromCacheForTesting() {
Heap* heap = isolate_->heap();
Handle<SimpleNumberDictionary> dict(heap->code_stubs());
Handle<SimpleNumberDictionary> dict(heap->code_stubs(), isolate());
int entry = dict->FindEntry(GetKey());
DCHECK_NE(SimpleNumberDictionary::kNotFound, entry);
dict = SimpleNumberDictionary::DeleteEntry(dict, entry);

View File

@ -201,7 +201,7 @@ void OptimizingCompileDispatcher::InstallOptimizedFunctions() {
output_queue_.pop();
}
OptimizedCompilationInfo* info = job->compilation_info();
Handle<JSFunction> function(*info->closure());
Handle<JSFunction> function(*info->closure(), isolate_);
if (function->HasOptimizedCode()) {
if (FLAG_trace_concurrent_recompilation) {
PrintF(" ** Aborting compilation for ");

View File

@ -285,7 +285,7 @@ void OptimizedCompilationJob::RecordFunctionCompilation(
time_taken_to_finalize_.InMillisecondsF();
Handle<Script> script(
Script::cast(compilation_info()->shared_info()->script()));
Script::cast(compilation_info()->shared_info()->script()), isolate);
LogFunctionCompilation(tag, compilation_info()->shared_info(), script,
abstract_code, true, time_taken_ms, isolate);
}
@ -547,7 +547,7 @@ V8_WARN_UNUSED_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeCache(
RuntimeCallTimerScope runtimeTimer(
function->GetIsolate(),
RuntimeCallCounterId::kCompileGetFromOptimizedCodeMap);
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate());
DisallowHeapAllocation no_gc;
if (osr_offset.IsNone()) {
if (function->feedback_cell()->value()->IsFeedbackVector()) {
@ -560,7 +560,7 @@ V8_WARN_UNUSED_RESULT MaybeHandle<Code> GetCodeFromOptimizedCodeCache(
// Caching of optimized code enabled and optimized code found.
DCHECK(!code->marked_for_deoptimization());
DCHECK(function->shared()->is_compiled());
return Handle<Code>(code);
return Handle<Code>(code, feedback_vector->GetIsolate());
}
}
}
@ -592,8 +592,9 @@ void InsertCodeIntoOptimizedCodeCache(
// Cache optimized context-specific code.
Handle<JSFunction> function = compilation_info->closure();
Handle<SharedFunctionInfo> shared(function->shared());
Handle<Context> native_context(function->context()->native_context());
Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate());
Handle<Context> native_context(function->context()->native_context(),
function->GetIsolate());
if (compilation_info->osr_offset().IsNone()) {
Handle<FeedbackVector> vector =
handle(function->feedback_vector(), function->GetIsolate());
@ -754,7 +755,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
CanonicalHandleScope canonical(isolate);
// Reopen handles in the new CompilationHandleScope.
compilation_info->ReopenHandlesInNewHandleScope();
compilation_info->ReopenHandlesInNewHandleScope(isolate);
if (mode == ConcurrencyMode::kConcurrent) {
if (GetOptimizedCodeLater(job.get(), isolate)) {
@ -1091,7 +1092,8 @@ bool Compiler::Compile(Handle<SharedFunctionInfo> shared_info,
if (FLAG_preparser_scope_analysis) {
if (shared_info->HasPreParsedScopeData()) {
Handle<PreParsedScopeData> data(
PreParsedScopeData::cast(shared_info->preparsed_scope_data()));
PreParsedScopeData::cast(shared_info->preparsed_scope_data()),
isolate);
parse_info.consumed_preparsed_scope_data()->SetData(data);
// After we've compiled the function, we don't need data about its
// skippable functions any more.
@ -1241,7 +1243,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
int eval_scope_position, int eval_position, int line_offset,
int column_offset, Handle<Object> script_name,
ScriptOriginOptions options) {
Isolate* isolate = source->GetIsolate();
Isolate* isolate = context->GetIsolate();
int source_length = source->length();
isolate->counters()->total_eval_size()->Increment(source_length);
isolate->counters()->total_compile_size()->Increment(source_length);
@ -1398,7 +1400,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromString(
int eval_scope_position = 0;
int eval_position = kNoSourcePosition;
Handle<SharedFunctionInfo> outer_info(
native_context->empty_function()->shared());
native_context->empty_function()->shared(), isolate);
return Compiler::GetFunctionFromEval(
source, outer_info, native_context, LanguageMode::kSloppy, restriction,
parameters_end_pos, eval_scope_position, eval_position);
@ -1737,7 +1739,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
ScriptOriginOptions origin_options, ScriptData* cached_data,
v8::ScriptCompiler::CompileOptions compile_options,
v8::ScriptCompiler::NoCacheReason no_cache_reason) {
Isolate* isolate = source->GetIsolate();
Isolate* isolate = context->GetIsolate();
ScriptCompileTimerScope compile_timer(isolate, no_cache_reason);
if (compile_options == ScriptCompiler::kNoCompileOptions ||
@ -1934,7 +1936,7 @@ bool Compiler::FinalizeCompilationJob(UnoptimizedCompilationJob* raw_job,
void Compiler::PostInstantiation(Handle<JSFunction> function,
PretenureFlag pretenure) {
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), function->GetIsolate());
if (FLAG_always_opt && shared->allows_lazy_compilation() &&
!shared->optimization_disabled() && !shared->HasAsmWasmData() &&
@ -1963,8 +1965,9 @@ void Compiler::PostInstantiation(Handle<JSFunction> function,
if (shared->is_toplevel() || shared->is_wrapped()) {
// If it's a top-level script, report compilation to the debugger.
Handle<Script> script(handle(Script::cast(shared->script())));
script->GetIsolate()->debug()->OnAfterCompile(script);
Handle<Script> script(
handle(Script::cast(shared->script()), function->GetIsolate()));
function->GetIsolate()->debug()->OnAfterCompile(script);
}
}

View File

@ -669,7 +669,7 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
TransitionsAccessor(isolate(), map).SearchTransition(*name, kData, NONE);
if (transition == nullptr) return false;
Handle<Map> transition_map(transition);
Handle<Map> transition_map(transition, isolate());
int const number = transition_map->LastAdded();
PropertyDetails const details =
transition_map->instance_descriptors()->GetDetails(number);

View File

@ -1629,10 +1629,12 @@ Reduction JSCallReducer::ReduceArrayMap(Node* node,
&check_fail, &control);
}
Handle<Map> double_map(Map::cast(
native_context()->get(Context::ArrayMapIndex(HOLEY_DOUBLE_ELEMENTS))));
Handle<Map> double_map(Map::cast(native_context()->get(
Context::ArrayMapIndex(HOLEY_DOUBLE_ELEMENTS))),
isolate());
Handle<Map> fast_map(
Map::cast(native_context()->get(Context::ArrayMapIndex(HOLEY_ELEMENTS))));
Map::cast(native_context()->get(Context::ArrayMapIndex(HOLEY_ELEMENTS))),
isolate());
effect = graph()->NewNode(
simplified()->TransitionAndStoreElement(double_map, fast_map), a, k,
callback_value, effect, control);
@ -1712,7 +1714,8 @@ Reduction JSCallReducer::ReduceArrayFilter(Node* node,
dependencies()->AssumePropertyCell(factory()->array_species_protector());
Handle<Map> initial_map(
Map::cast(native_context()->GetInitialJSArrayMap(packed_kind)));
Map::cast(native_context()->GetInitialJSArrayMap(packed_kind)),
isolate());
Node* k = jsgraph()->ZeroConstant();
Node* to = jsgraph()->ZeroConstant();
@ -2842,7 +2845,7 @@ Reduction JSCallReducer::ReduceCallApiFunction(
Node* control = NodeProperties::GetControlInput(node);
Handle<FunctionTemplateInfo> function_template_info(
FunctionTemplateInfo::cast(shared->function_data()));
FunctionTemplateInfo::cast(shared->function_data()), isolate());
// CallApiCallbackStub expects the target in a register, so we count it out,
// and counts the receiver as an implicit argument, so we count the receiver

View File

@ -502,7 +502,7 @@ Reduction JSCreateLowering::ReduceJSCreateGeneratorObject(Node* node) {
// Allocate a register file.
DCHECK(js_function->shared()->HasBytecodeArray());
Handle<BytecodeArray> bytecode_array(
js_function->shared()->GetBytecodeArray());
js_function->shared()->GetBytecodeArray(), isolate());
int parameter_count_no_receiver = bytecode_array->parameter_count() - 1;
DCHECK_EQ(parameter_count_no_receiver,
js_function->shared()->internal_formal_parameter_count());
@ -1053,7 +1053,8 @@ Reduction JSCreateLowering::ReduceJSCreateClosure(Node* node) {
}
Handle<Map> function_map(
Map::cast(native_context()->get(shared->function_map_index())));
Map::cast(native_context()->get(shared->function_map_index())),
isolate());
DCHECK(!function_map->IsInobjectSlackTrackingInProgress());
DCHECK(!function_map->is_dictionary_map());
@ -1176,7 +1177,8 @@ Reduction JSCreateLowering::ReduceJSCreatePromise(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreatePromise, node->opcode());
Node* effect = NodeProperties::GetEffectInput(node);
Handle<Map> promise_map(native_context()->promise_function()->initial_map());
Handle<Map> promise_map(native_context()->promise_function()->initial_map(),
isolate());
AllocationBuilder a(jsgraph(), effect, graph()->start());
a.Allocate(promise_map->instance_size());

View File

@ -65,8 +65,9 @@ JSNativeContextSpecialization::JSNativeContextSpecialization(
jsgraph_(jsgraph),
js_heap_broker_(js_heap_broker),
flags_(flags),
global_object_(native_context->global_object()),
global_proxy_(JSGlobalProxy::cast(native_context->global_proxy())),
global_object_(native_context->global_object(), jsgraph->isolate()),
global_proxy_(JSGlobalProxy::cast(native_context->global_proxy()),
jsgraph->isolate()),
native_context_(native_context),
dependencies_(dependencies),
zone_(zone),
@ -389,7 +390,8 @@ Reduction JSNativeContextSpecialization::ReduceJSOrdinaryHasInstance(
// invocation of the instanceof operator again.
// ES6 section 7.3.19 OrdinaryHasInstance (C, O) step 2.
Handle<JSBoundFunction> function = Handle<JSBoundFunction>::cast(m.Value());
Handle<JSReceiver> bound_target_function(function->bound_target_function());
Handle<JSReceiver> bound_target_function(function->bound_target_function(),
isolate());
NodeProperties::ReplaceValueInput(node, object, 0);
NodeProperties::ReplaceValueInput(
node, jsgraph()->HeapConstant(bound_target_function), 1);

View File

@ -416,7 +416,8 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
Handle<JSFunction> original_constructor =
Handle<JSFunction>::cast(mnewtarget.Value());
if (original_constructor->has_initial_map()) {
Handle<Map> initial_map(original_constructor->initial_map());
Handle<Map> initial_map(original_constructor->initial_map(),
isolate);
if (initial_map->constructor_or_backpointer() ==
*mtarget.Value()) {
*maps_return = ZoneHandleSet<Map>(initial_map);

View File

@ -22,7 +22,7 @@ Handle<ScriptContextTable> ScriptContextTable::Extend(
CHECK(used >= 0 && length > 0 && used < length);
if (used + kFirstContextSlotIndex == length) {
CHECK(length < Smi::kMaxValue / 2);
Isolate* isolate = table->GetIsolate();
Isolate* isolate = script_context->GetIsolate();
Handle<FixedArray> copy =
isolate->factory()->CopyFixedArrayAndGrow(table, length);
copy->set_map(isolate->heap()->script_context_table_map());
@ -43,7 +43,7 @@ bool ScriptContextTable::Lookup(Handle<ScriptContextTable> table,
for (int i = 0; i < table->used(); i++) {
Handle<Context> context = GetContext(table, i);
DCHECK(context->IsScriptContext());
Handle<ScopeInfo> scope_info(context->scope_info());
Handle<ScopeInfo> scope_info(context->scope_info(), context->GetIsolate());
int slot_index = ScopeInfo::ContextSlotIndex(
scope_info, name, &result->mode, &result->init_flag,
&result->maybe_assigned_flag);
@ -212,7 +212,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
(context->IsWithContext() && ((flags & SKIP_WITH_CONTEXT) == 0)) ||
context->IsFunctionContext() || context->IsBlockContext()) &&
context->extension_receiver() != nullptr) {
Handle<JSReceiver> object(context->extension_receiver());
Handle<JSReceiver> object(context->extension_receiver(), isolate);
if (context->IsNativeContext()) {
if (FLAG_trace_contexts) {
@ -220,7 +220,8 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
}
// Try other script contexts.
Handle<ScriptContextTable> script_contexts(
context->global_object()->native_context()->script_context_table());
context->global_object()->native_context()->script_context_table(),
isolate);
ScriptContextTable::LookupResult r;
if (ScriptContextTable::Lookup(script_contexts, name, &r)) {
if (FLAG_trace_contexts) {
@ -290,7 +291,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
context->IsModuleContext() || context->IsCatchContext()) {
// Use serialized scope information of functions and blocks to search
// for the context index.
Handle<ScopeInfo> scope_info(context->scope_info());
Handle<ScopeInfo> scope_info(context->scope_info(), isolate);
VariableMode mode;
InitializationFlag flag;
MaybeAssignedFlag maybe_assigned_flag;
@ -357,7 +358,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
// Check materialized locals.
Object* ext = context->get(EXTENSION_INDEX);
if (ext->IsJSReceiver()) {
Handle<JSReceiver> extension(JSReceiver::cast(ext));
Handle<JSReceiver> extension(JSReceiver::cast(ext), isolate);
LookupIterator it(extension, name, extension);
Maybe<bool> found = JSReceiver::HasProperty(&it);
if (found.FromMaybe(false)) {

View File

@ -556,10 +556,10 @@ void Deoptimizer::PrintFunctionName() {
}
Handle<JSFunction> Deoptimizer::function() const {
return Handle<JSFunction>(function_);
return Handle<JSFunction>(function_, isolate());
}
Handle<Code> Deoptimizer::compiled_code() const {
return Handle<Code>(compiled_code_);
return Handle<Code>(compiled_code_, isolate());
}
Deoptimizer::~Deoptimizer() {
@ -2179,7 +2179,8 @@ int MaterializedObjectStore::StackIdToIndex(Address fp) {
Handle<FixedArray> MaterializedObjectStore::GetStackEntries() {
return Handle<FixedArray>(isolate()->heap()->materialized_objects());
return Handle<FixedArray>(isolate()->heap()->materialized_objects(),
isolate());
}
@ -3626,7 +3627,7 @@ void TranslatedState::EnsurePropertiesAllocatedAndMarked(
properties_slot->set_storage(object_storage);
// Set markers for the double properties.
Handle<DescriptorArray> descriptors(map->instance_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate());
int field_count = map->NumberOfOwnDescriptors();
for (int i = 0; i < field_count; i++) {
FieldIndex index = FieldIndex::ForDescriptor(*map, i);
@ -3659,7 +3660,7 @@ void TranslatedState::EnsureJSObjectAllocated(TranslatedValue* slot,
Handle<ByteArray> object_storage = AllocateStorageFor(slot);
// Now we handle the interesting (JSObject) case.
Handle<DescriptorArray> descriptors(map->instance_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate());
int field_count = map->NumberOfOwnDescriptors();
// Set markers for the double properties.

View File

@ -141,9 +141,8 @@ void CopyObjectToObjectElements(Isolate* isolate, FixedArrayBase* from_base,
int start = to_start + copy_size;
int length = to_base->length() - start;
if (length > 0) {
Heap* heap = from_base->GetHeap();
MemsetPointer(FixedArray::cast(to_base)->data_start() + start,
heap->the_hole_value(), length);
isolate->heap()->the_hole_value(), length);
}
}
}
@ -180,9 +179,8 @@ static void CopyDictionaryToObjectElements(
int start = to_start + copy_size;
int length = to_base->length() - start;
if (length > 0) {
Heap* heap = from->GetHeap();
MemsetPointer(FixedArray::cast(to_base)->data_start() + start,
heap->the_hole_value(), length);
isolate->heap()->the_hole_value(), length);
}
}
}
@ -230,9 +228,8 @@ static void CopyDoubleToObjectElements(Isolate* isolate,
int start = to_start;
int length = to_base->length() - start;
if (length > 0) {
Heap* heap = from_base->GetHeap();
MemsetPointer(FixedArray::cast(to_base)->data_start() + start,
heap->the_hole_value(), length);
isolate->heap()->the_hole_value(), length);
}
}
}
@ -2017,7 +2014,7 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
// has too few used values, normalize it.
const int kMinLengthForSparsenessCheck = 64;
if (backing_store->length() < kMinLengthForSparsenessCheck) return;
if (backing_store->GetHeap()->InNewSpace(*backing_store)) return;
if (isolate->heap()->InNewSpace(*backing_store)) return;
uint32_t length = 0;
if (obj->IsJSArray()) {
JSArray::cast(*obj)->length()->ToArrayLength(&length);

View File

@ -1132,7 +1132,7 @@ std::vector<Handle<String>> FeedbackNexus::GetTypesForSourcePositions(
}
DCHECK(types->ValueAt(entry)->IsArrayList());
Handle<ArrayList> position_specific_types =
Handle<ArrayList>(ArrayList::cast(types->ValueAt(entry)));
Handle<ArrayList>(ArrayList::cast(types->ValueAt(entry)), isolate);
for (int i = 0; i < position_specific_types->Length(); i++) {
Object* t = position_specific_types->Get(i);
types_for_position.push_back(Handle<String>(String::cast(t), isolate));
@ -1157,7 +1157,7 @@ Handle<JSObject> ConvertToJSObject(Isolate* isolate,
int value_index = index + SimpleNumberDictionary::kEntryValueIndex;
Handle<ArrayList> position_specific_types(
ArrayList::cast(feedback->get(value_index)));
ArrayList::cast(feedback->get(value_index)), isolate);
int position = Smi::ToInt(key);
JSObject::AddDataElement(

View File

@ -1052,7 +1052,8 @@ void JavaScriptFrame::GetFunctions(
std::vector<SharedFunctionInfo*> raw_functions;
GetFunctions(&raw_functions);
for (const auto& raw_function : raw_functions) {
functions->push_back(Handle<SharedFunctionInfo>(raw_function));
functions->push_back(
Handle<SharedFunctionInfo>(raw_function, function()->GetIsolate()));
}
}
@ -1326,7 +1327,8 @@ int FrameSummary::WasmFrameSummary::SourcePosition() const {
}
Handle<Script> FrameSummary::WasmFrameSummary::script() const {
return handle(wasm_instance()->module_object()->script());
return handle(wasm_instance()->module_object()->script(),
wasm_instance()->GetIsolate());
}
Handle<String> FrameSummary::WasmFrameSummary::FunctionName() const {

View File

@ -2954,7 +2954,7 @@ size_t FreeListCategory::SumFreeList() {
size_t sum = 0;
FreeSpace* cur = top();
while (cur != nullptr) {
DCHECK(cur->map() == cur->GetHeap()->root(Heap::kFreeSpaceMapRootIndex));
DCHECK(cur->map() == page()->heap()->root(Heap::kFreeSpaceMapRootIndex));
sum += cur->relaxed_read_size();
cur = cur->next();
}

View File

@ -48,8 +48,9 @@ Handle<JSObject> CallOptimization::LookupHolderOfExpectedType(
return Handle<JSObject>::null();
}
if (object_map->has_hidden_prototype()) {
Handle<JSObject> prototype(JSObject::cast(object_map->prototype()));
object_map = handle(prototype->map());
JSObject* raw_prototype = JSObject::cast(object_map->prototype());
Handle<JSObject> prototype(raw_prototype, raw_prototype->GetIsolate());
object_map = handle(prototype->map(), prototype->GetIsolate());
if (expected_receiver_type_->IsTemplateFor(*object_map)) {
*holder_lookup = kHolderFound;
return prototype;
@ -64,7 +65,7 @@ bool CallOptimization::IsCompatibleReceiver(Handle<Object> receiver,
Handle<JSObject> holder) const {
DCHECK(is_simple_api_call());
if (!receiver->IsHeapObject()) return false;
Handle<Map> map(HeapObject::cast(*receiver)->map());
Handle<Map> map(HeapObject::cast(*receiver)->map(), holder->GetIsolate());
return IsCompatibleReceiverMap(map, holder);
}

View File

@ -200,7 +200,8 @@ MaybeObjectHandle StoreHandler::StoreTransition(Isolate* isolate,
#ifdef DEBUG
if (!is_dictionary_map) {
int descriptor = transition_map->LastAdded();
Handle<DescriptorArray> descriptors(transition_map->instance_descriptors());
Handle<DescriptorArray> descriptors(transition_map->instance_descriptors(),
isolate);
PropertyDetails details = descriptors->GetDetails(descriptor);
if (descriptors->GetKey(descriptor)->IsPrivate()) {
DCHECK_EQ(DONT_ENUM, details.attributes());

View File

@ -207,7 +207,7 @@ JSFunction* IC::GetHostFunction() const {
return frame->function();
}
static void LookupForRead(LookupIterator* it) {
static void LookupForRead(Isolate* isolate, LookupIterator* it) {
for (; it->IsFound(); it->Next()) {
switch (it->state()) {
case LookupIterator::NOT_FOUND:
@ -218,8 +218,7 @@ static void LookupForRead(LookupIterator* it) {
case LookupIterator::INTERCEPTOR: {
// If there is a getter, return; otherwise loop to perform the lookup.
Handle<JSObject> holder = it->GetHolder<JSObject>();
if (!holder->GetNamedInterceptor()->getter()->IsUndefined(
it->isolate())) {
if (!holder->GetNamedInterceptor()->getter()->IsUndefined(isolate)) {
return;
}
break;
@ -256,7 +255,7 @@ bool IC::ShouldRecomputeHandler(Handle<String> name) {
if (!receiver_map()->IsJSObjectMap()) return false;
Map* first_map = FirstTargetMap();
if (first_map == nullptr) return false;
Handle<Map> old_map(first_map);
Handle<Map> old_map(first_map, isolate());
if (old_map->is_deprecated()) return true;
return IsMoreGeneralElementsKindTransition(old_map->elements_kind(),
receiver_map()->elements_kind());
@ -444,7 +443,7 @@ MaybeHandle<Object> LoadIC::Load(Handle<Object> object, Handle<Name> name) {
}
// Named lookup in the object.
LookupIterator it(object, name);
LookupForRead(&it);
LookupForRead(isolate(), &it);
if (name->IsPrivate()) {
if (name->IsPrivateField() && !it.IsFound()) {
@ -485,7 +484,7 @@ MaybeHandle<Object> LoadGlobalIC::Load(Handle<Name> name) {
// Look up in script context table.
Handle<String> str_name = Handle<String>::cast(name);
Handle<ScriptContextTable> script_contexts(
global->native_context()->script_context_table());
global->native_context()->script_context_table(), isolate());
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
@ -852,7 +851,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
isolate(), holder_lookup == CallOptimization::kHolderIsReceiver);
Handle<Context> context(
call_optimization.GetAccessorContext(holder->map()));
call_optimization.GetAccessorContext(holder->map()), isolate());
Handle<WeakCell> context_cell =
isolate()->factory()->NewWeakCell(context);
Handle<WeakCell> data_cell = isolate()->factory()->NewWeakCell(
@ -1183,7 +1182,8 @@ bool IsOutOfBoundsAccess(Handle<Object> receiver, uint32_t index) {
return index >= length;
}
KeyedAccessLoadMode GetLoadMode(Handle<Object> receiver, uint32_t index) {
KeyedAccessLoadMode GetLoadMode(Isolate* isolate, Handle<Object> receiver,
uint32_t index) {
if (IsOutOfBoundsAccess(receiver, index)) {
if (receiver->IsJSTypedArray()) {
// For JSTypedArray we never lookup elements in the prototype chain.
@ -1191,7 +1191,6 @@ KeyedAccessLoadMode GetLoadMode(Handle<Object> receiver, uint32_t index) {
}
// For other {receiver}s we need to check the "no elements" protector.
Isolate* isolate = Handle<HeapObject>::cast(receiver)->GetIsolate();
if (isolate->IsNoElementsProtectorIntact()) {
if (receiver->IsString()) {
// ToObject(receiver) will have the initial String.prototype.
@ -1242,7 +1241,7 @@ MaybeHandle<Object> KeyedLoadIC::Load(Handle<Object> object,
LoadIC::Load(object, Handle<Name>::cast(key)),
Object);
} else if (ConvertKeyToIndex(object, key, &index)) {
KeyedAccessLoadMode load_mode = GetLoadMode(object, index);
KeyedAccessLoadMode load_mode = GetLoadMode(isolate(), object, index);
UpdateLoadElement(Handle<HeapObject>::cast(object), load_mode);
if (is_vector_set()) {
TraceIC("LoadIC", key);
@ -1286,9 +1285,9 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
InterceptorInfo* info = holder->GetNamedInterceptor();
if (it->HolderIsReceiverOrHiddenPrototype()) {
return !info->non_masking() && receiver.is_identical_to(holder) &&
!info->setter()->IsUndefined(it->isolate());
} else if (!info->getter()->IsUndefined(it->isolate()) ||
!info->query()->IsUndefined(it->isolate())) {
!info->setter()->IsUndefined(isolate());
} else if (!info->getter()->IsUndefined(isolate()) ||
!info->query()->IsUndefined(isolate())) {
return false;
}
break;
@ -1313,7 +1312,7 @@ bool StoreIC::LookupForWrite(LookupIterator* it, Handle<Object> value,
// Receiver != holder.
if (receiver->IsJSGlobalProxy()) {
PrototypeIterator iter(it->isolate(), receiver);
PrototypeIterator iter(isolate(), receiver);
return it->GetHolder<Object>().is_identical_to(
PrototypeIterator::GetCurrent(iter));
}
@ -1343,7 +1342,7 @@ MaybeHandle<Object> StoreGlobalIC::Store(Handle<Name> name,
Handle<String> str_name = Handle<String>::cast(name);
Handle<JSGlobalObject> global = isolate()->global_object();
Handle<ScriptContextTable> script_contexts(
global->native_context()->script_context_table());
global->native_context()->script_context_table(), isolate());
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
@ -1581,7 +1580,7 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
holder_lookup == CallOptimization::kHolderIsReceiver);
Handle<Context> context(
call_optimization.GetAccessorContext(holder->map()));
call_optimization.GetAccessorContext(holder->map()), isolate());
Handle<WeakCell> context_cell =
isolate()->factory()->NewWeakCell(context);
Handle<WeakCell> data_cell = isolate()->factory()->NewWeakCell(
@ -1914,7 +1913,7 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
if (receiver_map->is_stable()) {
receiver_map->NotifyLeafMapLayoutChange();
}
transition = handle(tmap, tmap->GetIsolate());
transition = handle(tmap, isolate());
}
}
@ -2104,12 +2103,12 @@ MaybeHandle<Object> KeyedStoreIC::Store(Handle<Object> object,
}
namespace {
void StoreOwnElement(Handle<JSArray> array, Handle<Object> index,
Handle<Object> value) {
void StoreOwnElement(Isolate* isolate, Handle<JSArray> array,
Handle<Object> index, Handle<Object> value) {
DCHECK(index->IsNumber());
bool success = false;
LookupIterator it = LookupIterator::PropertyOrElement(
array->GetIsolate(), array, index, &success, LookupIterator::OWN);
isolate, array, index, &success, LookupIterator::OWN);
DCHECK(success);
CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, NONE,
@ -2124,7 +2123,7 @@ void StoreInArrayLiteralIC::Store(Handle<JSArray> array, Handle<Object> index,
DCHECK(index->IsNumber());
if (!FLAG_use_ic || MigrateDeprecated(array)) {
StoreOwnElement(array, index, value);
StoreOwnElement(isolate(), array, index, value);
TraceIC("StoreInArrayLiteralIC", index);
return;
}
@ -2140,7 +2139,7 @@ void StoreInArrayLiteralIC::Store(Handle<JSArray> array, Handle<Object> index,
Handle<Map> old_array_map(array->map(), isolate());
bool array_was_cow = array->elements()->IsCowArray();
StoreOwnElement(array, index, value);
StoreOwnElement(isolate(), array, index, value);
if (index->IsSmi()) {
DCHECK(!old_array_map->is_abandoned_prototype_map());
@ -2217,7 +2216,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
Handle<Context> native_context = isolate->native_context();
Handle<ScriptContextTable> script_contexts(
native_context->script_context_table());
native_context->script_context_table(), isolate);
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
@ -2333,7 +2332,7 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalIC_Slow) {
Handle<JSGlobalObject> global = isolate->global_object();
Handle<Context> native_context = isolate->native_context();
Handle<ScriptContextTable> script_contexts(
native_context->script_context_table());
native_context->script_context_table(), isolate);
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, name, &lookup_result)) {
@ -2417,7 +2416,7 @@ RUNTIME_FUNCTION(Runtime_StoreInArrayLiteralIC_Slow) {
Handle<Object> value = args.at(0);
Handle<Object> array = args.at(1);
Handle<Object> index = args.at(2);
StoreOwnElement(Handle<JSArray>::cast(array), index, value);
StoreOwnElement(isolate, Handle<JSArray>::cast(array), index, value);
return *value;
}
@ -2440,7 +2439,7 @@ RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) {
}
if (IsStoreInArrayLiteralICKind(kind)) {
StoreOwnElement(Handle<JSArray>::cast(object), key, value);
StoreOwnElement(isolate, Handle<JSArray>::cast(object), key, value);
return *value;
} else {
DCHECK(IsKeyedStoreICKind(kind) || IsStoreICKind(kind));
@ -2470,7 +2469,8 @@ RUNTIME_FUNCTION(Runtime_StoreCallbackProperty) {
Handle<AccessorInfo> info(
callback_or_cell->IsWeakCell()
? AccessorInfo::cast(WeakCell::cast(*callback_or_cell)->value())
: AccessorInfo::cast(*callback_or_cell));
: AccessorInfo::cast(*callback_or_cell),
isolate);
DCHECK(info->IsCompatibleReceiver(*receiver));

View File

@ -779,7 +779,7 @@ class CaptureStackTraceHelper {
int entry = cache->FindEntry(code_offset);
if (entry != NumberDictionary::kNotFound) {
Handle<StackFrameInfo> frame(
StackFrameInfo::cast(cache->ValueAt(entry)));
StackFrameInfo::cast(cache->ValueAt(entry)), isolate_);
return frame;
}
}
@ -1586,7 +1586,7 @@ Isolate::CatchType Isolate::PredictExceptionCatcher() {
} break;
case StackFrame::STUB: {
Handle<Code> code(frame->LookupCode());
Handle<Code> code(frame->LookupCode(), this);
if (!code->IsCode() || code->kind() != Code::BUILTIN ||
!code->handler_table_offset() || !code->is_turbofanned()) {
break;
@ -1597,7 +1597,7 @@ Isolate::CatchType Isolate::PredictExceptionCatcher() {
} break;
case StackFrame::JAVA_SCRIPT_BUILTIN_CONTINUATION_WITH_CATCH: {
Handle<Code> code(frame->LookupCode());
Handle<Code> code(frame->LookupCode(), this);
CatchType prediction = ToCatchType(code->GetBuiltinCatchPrediction());
if (prediction != NOT_CAUGHT) return prediction;
} break;
@ -1702,8 +1702,7 @@ bool Isolate::ComputeLocation(MessageLocation* target) {
}
if (summary.IsJavaScript()) {
shared =
handle(summary.AsJavaScript().function()->shared(), frame->isolate());
shared = handle(summary.AsJavaScript().function()->shared(), this);
}
*target = MessageLocation(Handle<Script>::cast(script), pos, pos + 1, shared);
return true;
@ -1730,7 +1729,7 @@ bool Isolate::ComputeLocationFromException(MessageLocation* target,
Handle<JSObject>::cast(exception), script_symbol);
if (!script->IsScript()) return false;
Handle<Script> cast_script(Script::cast(*script));
Handle<Script> cast_script(Script::cast(*script), this);
*target = MessageLocation(cast_script, start_pos_value, end_pos_value);
return true;
}
@ -1745,12 +1744,13 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
if (!property->IsJSArray()) return false;
Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property);
Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements()));
Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements()),
this);
const int frame_count = elements->FrameCount();
for (int i = 0; i < frame_count; i++) {
if (elements->IsWasmFrame(i) || elements->IsAsmJsWasmFrame(i)) {
Handle<WasmInstanceObject> instance(elements->WasmInstance(i));
Handle<WasmInstanceObject> instance(elements->WasmInstance(i), this);
uint32_t func_index =
static_cast<uint32_t>(elements->WasmFunctionIndex(i)->value());
int code_offset = elements->Offset(i)->value();
@ -1768,7 +1768,7 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
int pos = WasmModuleObject::GetSourcePosition(
handle(instance->module_object(), this), func_index, byte_offset,
is_at_number_conversion);
Handle<Script> script(instance->module_object()->script());
Handle<Script> script(instance->module_object()->script(), this);
*target = MessageLocation(script, pos, pos + 1);
return true;
@ -1784,7 +1784,7 @@ bool Isolate::ComputeLocationFromStackTrace(MessageLocation* target,
const int code_offset = elements->Offset(i)->value();
const int pos = abstract_code->SourcePosition(code_offset);
Handle<Script> casted_script(Script::cast(script));
Handle<Script> casted_script(Script::cast(script), this);
*target = MessageLocation(casted_script, pos, pos + 1);
return true;
}
@ -3674,7 +3674,7 @@ Handle<Symbol> Isolate::SymbolFor(Heap::RootListIndex dictionary_index,
UNREACHABLE();
}
} else {
symbol = Handle<Symbol>(Symbol::cast(dictionary->ValueAt(entry)));
symbol = Handle<Symbol>(Symbol::cast(dictionary->ValueAt(entry)), this);
}
return symbol;
}
@ -4144,7 +4144,7 @@ bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const {
SaveContext::SaveContext(Isolate* isolate)
: isolate_(isolate), prev_(isolate->save_context()) {
if (isolate->context() != nullptr) {
context_ = Handle<Context>(isolate->context());
context_ = Handle<Context>(isolate->context(), isolate);
}
isolate->set_save_context(this);

View File

@ -365,7 +365,7 @@ Handle<Object> JsonParser<seq_one_byte>::ParseJsonObject() {
HandleScope scope(isolate());
Handle<JSObject> json_object =
factory()->NewJSObject(object_constructor(), pretenure_);
Handle<Map> map(json_object->map());
Handle<Map> map(json_object->map(), isolate());
int descriptor = 0;
VectorSegment<ZoneVector<Handle<Object>>> properties(&properties_);
DCHECK_EQ(c0_, '{');

View File

@ -528,7 +528,7 @@ JsonStringifier::Result JsonStringifier::SerializeJSObject(
Handle<JSObject> js_obj = Handle<JSObject>::cast(object);
DCHECK(!js_obj->HasIndexedInterceptor());
DCHECK(!js_obj->HasNamedInterceptor());
Handle<Map> map(js_obj->map());
Handle<Map> map(js_obj->map(), isolate_);
builder_.AppendCharacter('{');
Indent();
bool comma = false;

View File

@ -2085,10 +2085,11 @@ void ExistingCodeLogger::LogCompiledFunctions() {
// GetScriptLineNumber call.
for (int i = 0; i < compiled_funcs_count; ++i) {
if (sfis[i]->function_data()->IsInterpreterData()) {
LogExistingFunction(sfis[i],
Handle<AbstractCode>(AbstractCode::cast(
sfis[i]->InterpreterTrampoline())),
CodeEventListener::INTERPRETED_FUNCTION_TAG);
LogExistingFunction(
sfis[i],
Handle<AbstractCode>(
AbstractCode::cast(sfis[i]->InterpreterTrampoline()), isolate_),
CodeEventListener::INTERPRETED_FUNCTION_TAG);
}
if (code_objects[i].is_identical_to(BUILTIN_CODE(isolate_, CompileLazy)))
continue;
@ -2140,12 +2141,12 @@ void ExistingCodeLogger::LogExistingFunction(
Handle<SharedFunctionInfo> shared, Handle<AbstractCode> code,
CodeEventListener::LogEventsAndTags tag) {
if (shared->script()->IsScript()) {
Handle<Script> script(Script::cast(shared->script()));
Handle<Script> script(Script::cast(shared->script()), isolate_);
int line_num = Script::GetLineNumber(script, shared->StartPosition()) + 1;
int column_num =
Script::GetColumnNumber(script, shared->StartPosition()) + 1;
if (script->name()->IsString()) {
Handle<String> script_name(String::cast(script->name()));
Handle<String> script_name(String::cast(script->name()), isolate_);
if (line_num > 0) {
CALL_CODE_EVENT_HANDLER(
CodeCreateEvent(Logger::ToNativeByScript(tag, *script), *code,

View File

@ -403,8 +403,9 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
if (holder_obj->IsJSGlobalObject()) {
Handle<GlobalDictionary> dictionary(
JSGlobalObject::cast(*holder_obj)->global_dictionary());
Handle<PropertyCell> cell(dictionary->CellAt(dictionary_entry()));
JSGlobalObject::cast(*holder_obj)->global_dictionary(), isolate());
Handle<PropertyCell> cell(dictionary->CellAt(dictionary_entry()),
isolate());
property_details_ = cell->property_details();
PropertyCell::PrepareForValue(dictionary, dictionary_entry(), value,
property_details_);
@ -460,7 +461,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
if (IsElement()) {
DCHECK(!holder_obj->HasFixedTypedArrayElements());
DCHECK(attributes != NONE || !holder_obj->HasFastElements());
Handle<FixedArrayBase> elements(holder_obj->elements());
Handle<FixedArrayBase> elements(holder_obj->elements(), isolate());
holder_obj->GetElementsAccessor()->Reconfigure(holder_obj, elements,
number_, value, attributes);
ReloadPropertyInformation<true>();
@ -488,14 +489,15 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
}
if (holder_obj->IsJSGlobalObject()) {
Handle<GlobalDictionary> dictionary(
JSGlobalObject::cast(*holder_obj)->global_dictionary());
JSGlobalObject::cast(*holder_obj)->global_dictionary(), isolate());
Handle<PropertyCell> cell = PropertyCell::PrepareForValue(
dictionary, dictionary_entry(), value, details);
cell->set_value(*value);
property_details_ = cell->property_details();
} else {
Handle<NameDictionary> dictionary(holder_obj->property_dictionary());
Handle<NameDictionary> dictionary(holder_obj->property_dictionary(),
isolate());
PropertyDetails original_details =
dictionary->DetailsAt(dictionary_entry());
int enumeration_index = original_details.dictionary_index();

View File

@ -192,7 +192,7 @@ Object* EvalFromFunctionName(Isolate* isolate, Handle<Script> script) {
if (!script->has_eval_from_shared())
return isolate->heap()->undefined_value();
Handle<SharedFunctionInfo> shared(script->eval_from_shared());
Handle<SharedFunctionInfo> shared(script->eval_from_shared(), isolate);
// Find the name of the function calling eval.
if (shared->Name()->BooleanValue(isolate)) {
return shared->Name();
@ -205,7 +205,8 @@ Object* EvalFromScript(Isolate* isolate, Handle<Script> script) {
if (!script->has_eval_from_shared())
return isolate->heap()->undefined_value();
Handle<SharedFunctionInfo> eval_from_shared(script->eval_from_shared());
Handle<SharedFunctionInfo> eval_from_shared(script->eval_from_shared(),
isolate);
return eval_from_shared->script()->IsScript()
? eval_from_shared->script()
: isolate->heap()->undefined_value();
@ -944,7 +945,8 @@ MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate,
Handle<JSArray> raw_stack_array = Handle<JSArray>::cast(raw_stack);
DCHECK(raw_stack_array->elements()->IsFixedArray());
Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements()));
Handle<FrameArray> elems(FrameArray::cast(raw_stack_array->elements()),
isolate);
// If there's a user-specified "prepareStackFrames" function, call it on the
// frames and use its result.

View File

@ -586,7 +586,7 @@ void Map::DictionaryMapVerify(Isolate* isolate) {
MapVerify(isolate);
CHECK(is_dictionary_map());
CHECK_EQ(kInvalidEnumCacheSentinel, EnumLength());
CHECK_EQ(GetHeap()->empty_descriptor_array(), instance_descriptors());
CHECK_EQ(isolate->heap()->empty_descriptor_array(), instance_descriptors());
CHECK_EQ(0, UnusedPropertyFields());
CHECK_EQ(Map::GetVisitorId(this), visitor_id());
}
@ -616,7 +616,7 @@ void WeakArrayList::WeakArrayListVerify(Isolate* isolate) {
void PropertyArray::PropertyArrayVerify(Isolate* isolate) {
if (length() == 0) {
CHECK_EQ(this, this->GetHeap()->empty_property_array());
CHECK_EQ(this, isolate->heap()->empty_property_array());
return;
}
// There are no empty PropertyArrays.
@ -644,7 +644,7 @@ void FixedDoubleArray::FixedDoubleArrayVerify(Isolate* isolate) {
void FeedbackMetadata::FeedbackMetadataVerify(Isolate* isolate) {
if (slot_count() == 0) {
CHECK_EQ(GetHeap()->empty_feedback_metadata(), this);
CHECK_EQ(isolate->heap()->empty_feedback_metadata(), this);
} else {
FeedbackMetadataIterator iter(this);
while (iter.HasNext()) {
@ -660,7 +660,7 @@ void DescriptorArray::DescriptorArrayVerify(Isolate* isolate) {
WeakFixedArrayVerify(isolate);
int nof_descriptors = number_of_descriptors();
if (number_of_descriptors_storage() == 0) {
Heap* heap = GetHeap();
Heap* heap = isolate->heap();
CHECK_EQ(heap->empty_descriptor_array(), this);
CHECK_EQ(2, length());
CHECK_EQ(0, nof_descriptors);
@ -856,9 +856,9 @@ void JSMessageObject::JSMessageObjectVerify(Isolate* isolate) {
void String::StringVerify(Isolate* isolate) {
CHECK(IsString());
CHECK(length() >= 0 && length() <= Smi::kMaxValue);
CHECK_IMPLIES(length() == 0, this == GetHeap()->empty_string());
CHECK_IMPLIES(length() == 0, this == isolate->heap()->empty_string());
if (IsInternalizedString()) {
CHECK(!GetHeap()->InNewSpace(this));
CHECK(!isolate->heap()->InNewSpace(this));
}
if (IsConsString()) {
ConsString::cast(this)->ConsStringVerify(isolate);
@ -871,7 +871,7 @@ void String::StringVerify(Isolate* isolate) {
void ConsString::ConsStringVerify(Isolate* isolate) {
CHECK(this->first()->IsString());
CHECK(this->second() == GetHeap()->empty_string() ||
CHECK(this->second() == isolate->heap()->empty_string() ||
this->second()->IsString());
CHECK_GE(this->length(), ConsString::kMinLength);
CHECK(this->length() == this->first()->length() + this->second()->length());
@ -935,7 +935,7 @@ void SharedFunctionInfo::SharedFunctionInfoVerify(Isolate* isolate) {
value->IsScopeInfo());
if (value->IsScopeInfo()) {
CHECK_LT(0, ScopeInfo::cast(value)->length());
CHECK_NE(value, GetHeap()->empty_scope_info());
CHECK_NE(value, isolate->heap()->empty_scope_info());
}
CHECK(HasWasmExportedFunctionData() || IsApiFunction() ||
@ -1000,7 +1000,7 @@ void JSGlobalObject::JSGlobalObjectVerify(Isolate* isolate) {
void Oddball::OddballVerify(Isolate* isolate) {
CHECK(IsOddball());
Heap* heap = GetHeap();
Heap* heap = isolate->heap();
VerifyHeapPointer(to_string());
Object* number = to_number();
if (number->IsHeapObject()) {
@ -1527,7 +1527,7 @@ void PrototypeInfo::PrototypeInfoVerify(Isolate* isolate) {
void Tuple2::Tuple2Verify(Isolate* isolate) {
CHECK(IsTuple2());
Heap* heap = GetHeap();
Heap* heap = isolate->heap();
if (this == heap->empty_enum_cache()) {
CHECK_EQ(heap->empty_fixed_array(), EnumCache::cast(this)->keys());
CHECK_EQ(heap->empty_fixed_array(), EnumCache::cast(this)->indices());
@ -1652,9 +1652,11 @@ void AccessCheckInfo::AccessCheckInfoVerify(Isolate* isolate) {
void CallHandlerInfo::CallHandlerInfoVerify(Isolate* isolate) {
CHECK(IsCallHandlerInfo());
CHECK(map() == GetHeap()->side_effect_call_handler_info_map() ||
map() == GetHeap()->side_effect_free_call_handler_info_map() ||
map() == GetHeap()->next_call_side_effect_free_call_handler_info_map());
CHECK(
map() == isolate->heap()->side_effect_call_handler_info_map() ||
map() == isolate->heap()->side_effect_free_call_handler_info_map() ||
map() ==
isolate->heap()->next_call_side_effect_free_call_handler_info_map());
VerifyPointer(callback());
VerifyPointer(js_callback());
VerifyPointer(data());

View File

@ -2017,7 +2017,8 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object,
if (object->IsJSGlobalObject()) {
Handle<JSGlobalObject> global_obj = Handle<JSGlobalObject>::cast(object);
Handle<GlobalDictionary> dictionary(global_obj->global_dictionary());
Handle<GlobalDictionary> dictionary(global_obj->global_dictionary(),
isolate);
int entry = dictionary->FindEntry(isolate, name, hash);
if (entry == GlobalDictionary::kNotFound) {
@ -2038,7 +2039,7 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object,
cell->set_value(*value);
}
} else {
Handle<NameDictionary> dictionary(object->property_dictionary());
Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
int entry = dictionary->FindEntry(name);
if (entry == NameDictionary::kNotFound) {
@ -2915,7 +2916,8 @@ MaybeHandle<JSFunction> Map::GetConstructorFunction(
int const constructor_function_index = map->GetConstructorFunctionIndex();
if (constructor_function_index != kNoConstructorFunctionIndex) {
return handle(
JSFunction::cast(native_context->get(constructor_function_index)));
JSFunction::cast(native_context->get(constructor_function_index)),
native_context->GetIsolate());
}
}
return MaybeHandle<JSFunction>();
@ -3750,7 +3752,8 @@ Handle<Context> JSReceiver::GetCreationContext() {
}
return function->has_context()
? Handle<Context>(function->context()->native_context())
? Handle<Context>(function->context()->native_context(),
receiver->GetIsolate())
: Handle<Context>::null();
}
@ -3967,7 +3970,7 @@ namespace {
// store.
void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
Isolate* isolate = object->GetIsolate();
Handle<Map> old_map(object->map());
Handle<Map> old_map(object->map(), isolate);
// In case of a regular transition.
if (new_map->GetBackPointer() == *old_map) {
// If the map does not add named properties, simply set the map.
@ -4009,7 +4012,7 @@ void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
// This migration is a transition from a map that has run out of property
// space. Extend the backing store.
int grow_by = new_map->UnusedPropertyFields() + 1;
Handle<PropertyArray> old_storage(object->property_array());
Handle<PropertyArray> old_storage(object->property_array(), isolate);
Handle<PropertyArray> new_storage =
isolate->factory()->CopyPropertyArrayAndGrow(old_storage, grow_by);
@ -4055,8 +4058,10 @@ void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map) {
Handle<FixedArray> inobject_props =
isolate->factory()->NewFixedArray(inobject);
Handle<DescriptorArray> old_descriptors(old_map->instance_descriptors());
Handle<DescriptorArray> new_descriptors(new_map->instance_descriptors());
Handle<DescriptorArray> old_descriptors(old_map->instance_descriptors(),
isolate);
Handle<DescriptorArray> new_descriptors(new_map->instance_descriptors(),
isolate);
int old_nof = old_map->NumberOfOwnDescriptors();
int new_nof = new_map->NumberOfOwnDescriptors();
@ -4199,7 +4204,7 @@ void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map,
Isolate* isolate = object->GetIsolate();
HandleScope scope(isolate);
Handle<Map> map(object->map());
Handle<Map> map(object->map(), isolate);
// Allocate new content.
int real_size = map->NumberOfOwnDescriptors();
@ -4213,10 +4218,10 @@ void MigrateFastToSlow(Handle<JSObject> object, Handle<Map> new_map,
Handle<NameDictionary> dictionary =
NameDictionary::New(isolate, property_count);
Handle<DescriptorArray> descs(map->instance_descriptors());
Handle<DescriptorArray> descs(map->instance_descriptors(), isolate);
for (int i = 0; i < real_size; i++) {
PropertyDetails details = descs->GetDetails(i);
Handle<Name> key(descs->GetKey(i));
Handle<Name> key(descs->GetKey(i), isolate);
Handle<Object> value;
if (details.location() == kField) {
FieldIndex index = FieldIndex::ForDescriptor(*map, i);
@ -4319,8 +4324,8 @@ void JSObject::NotifyMapChange(Handle<Map> old_map, Handle<Map> new_map,
void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map,
int expected_additional_properties) {
if (object->map() == *new_map) return;
Handle<Map> old_map(object->map());
NotifyMapChange(old_map, new_map, new_map->GetIsolate());
Handle<Map> old_map(object->map(), object->GetIsolate());
NotifyMapChange(old_map, new_map, object->GetIsolate());
if (old_map->is_dictionary_map()) {
// For slow-to-fast migrations JSObject::MigrateSlowToFast()
@ -4342,7 +4347,7 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map,
old_map->set_owns_descriptors(false);
DCHECK(old_map->is_abandoned_prototype_map());
// Ensure that no transition was inserted for prototype migrations.
DCHECK_EQ(0, TransitionsAccessor(old_map->GetIsolate(), old_map)
DCHECK_EQ(0, TransitionsAccessor(object->GetIsolate(), old_map)
.NumberOfTransitions());
DCHECK(new_map->GetBackPointer()->IsUndefined());
DCHECK(object->map() != *old_map);
@ -4362,7 +4367,7 @@ void JSObject::MigrateToMap(Handle<JSObject> object, Handle<Map> new_map,
void JSObject::ForceSetPrototype(Handle<JSObject> object,
Handle<Object> proto) {
// object.__proto__ = proto;
Handle<Map> old_map = Handle<Map>(object->map());
Handle<Map> old_map = Handle<Map>(object->map(), object->GetIsolate());
Handle<Map> new_map =
Map::Copy(object->GetIsolate(), old_map, "ForceSetPrototype");
Map::SetPrototype(new_map, proto);
@ -4645,7 +4650,7 @@ void Map::GeneralizeField(Handle<Map> map, int modify_index,
}
PropertyDetails details = descriptors->GetDetails(modify_index);
Handle<Name> name(descriptors->GetKey(modify_index));
Handle<Name> name(descriptors->GetKey(modify_index), isolate);
MaybeObjectHandle wrapped_type(WrapFieldType(new_field_type));
field_owner->UpdateFieldType(modify_index, name, new_constness,
@ -4689,7 +4694,7 @@ Handle<Map> Map::GeneralizeAllFields(Handle<Map> map) {
Isolate* isolate = map->GetIsolate();
Handle<FieldType> any_type = FieldType::Any(isolate);
Handle<DescriptorArray> descriptors(map->instance_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
for (int i = 0; i < map->NumberOfOwnDescriptors(); ++i) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.location() == kField) {
@ -5222,7 +5227,7 @@ void Map::EnsureDescriptorSlack(Isolate* isolate, Handle<Map> map, int slack) {
// Only supports adding slack to owned descriptors.
DCHECK(map->owns_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
int old_size = map->NumberOfOwnDescriptors();
if (slack <= descriptors->NumberOfSlackDescriptors()) return;
@ -5448,7 +5453,7 @@ bool Map::IsMapInArrayPrototypeChain() const {
Handle<WeakCell> Map::WeakCellForMap(Handle<Map> map) {
Isolate* isolate = map->GetIsolate();
if (map->weak_cell_cache()->IsWeakCell()) {
return Handle<WeakCell>(WeakCell::cast(map->weak_cell_cache()));
return Handle<WeakCell>(WeakCell::cast(map->weak_cell_cache()), isolate);
}
Handle<WeakCell> weak_cell = isolate->factory()->NewWeakCell(map);
map->set_weak_cell_cache(*weak_cell);
@ -5544,7 +5549,7 @@ Handle<Map> Map::TransitionElementsTo(Handle<Map> map,
// static
Handle<Map> Map::AsElementsKind(Isolate* isolate, Handle<Map> map,
ElementsKind kind) {
Handle<Map> closest_map(FindClosestElementsTransition(*map, kind));
Handle<Map> closest_map(FindClosestElementsTransition(*map, kind), isolate);
if (closest_map->elements_kind() == kind) {
return closest_map;
@ -5556,7 +5561,7 @@ Handle<Map> Map::AsElementsKind(Isolate* isolate, Handle<Map> map,
Handle<Map> JSObject::GetElementsTransitionMap(Handle<JSObject> object,
ElementsKind to_kind) {
Handle<Map> map(object->map());
Handle<Map> map(object->map(), object->GetIsolate());
return Map::TransitionElementsTo(map, to_kind);
}
@ -5803,7 +5808,8 @@ MaybeHandle<Context> JSProxy::GetFunctionRealm(Handle<JSProxy> proxy) {
THROW_NEW_ERROR(proxy->GetIsolate(),
NewTypeError(MessageTemplate::kProxyRevoked), Context);
}
Handle<JSReceiver> target(JSReceiver::cast(proxy->target()));
Handle<JSReceiver> target(JSReceiver::cast(proxy->target()),
proxy->GetIsolate());
return JSReceiver::GetFunctionRealm(target);
}
@ -5813,7 +5819,7 @@ MaybeHandle<Context> JSBoundFunction::GetFunctionRealm(
Handle<JSBoundFunction> function) {
DCHECK(function->map()->is_constructor());
return JSReceiver::GetFunctionRealm(
handle(function->bound_target_function()));
handle(function->bound_target_function(), function->GetIsolate()));
}
// static
@ -5899,7 +5905,7 @@ Maybe<int> JSFunction::GetLength(Isolate* isolate,
// static
Handle<Context> JSFunction::GetFunctionRealm(Handle<JSFunction> function) {
DCHECK(function->map()->is_constructor());
return handle(function->context()->native_context());
return handle(function->context()->native_context(), function->GetIsolate());
}
@ -5968,7 +5974,7 @@ void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) {
if (!FLAG_unbox_double_fields || external > 0) {
Isolate* isolate = object->GetIsolate();
Handle<DescriptorArray> descriptors(map->instance_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
Handle<FixedArray> storage;
if (!FLAG_unbox_double_fields) {
storage = isolate->factory()->NewFixedArray(inobject);
@ -6006,7 +6012,7 @@ void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) {
void JSObject::MigrateInstance(Handle<JSObject> object) {
Handle<Map> original_map(object->map());
Handle<Map> original_map(object->map(), object->GetIsolate());
Handle<Map> map = Map::Update(original_map);
map->set_is_migration_target(true);
MigrateToMap(object, map);
@ -6274,7 +6280,7 @@ void JSObject::NormalizeProperties(Handle<JSObject> object,
const char* reason) {
if (!object->HasFastProperties()) return;
Handle<Map> map(object->map());
Handle<Map> map(object->map(), object->GetIsolate());
Handle<Map> new_map = Map::Normalize(map, mode, reason);
MigrateToMap(object, new_map, expected_additional_properties);
@ -6288,7 +6294,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
DCHECK(!object->IsJSGlobalObject());
Isolate* isolate = object->GetIsolate();
Factory* factory = isolate->factory();
Handle<NameDictionary> dictionary(object->property_dictionary());
Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
// Make sure we preserve dictionary representation if there are too many
// descriptors.
@ -6678,7 +6684,7 @@ void JSReceiver::DeleteNormalizedProperty(Handle<JSReceiver> object,
if (object->IsJSGlobalObject()) {
// If we have a global object, invalidate the cell and swap in a new one.
Handle<GlobalDictionary> dictionary(
JSGlobalObject::cast(*object)->global_dictionary());
JSGlobalObject::cast(*object)->global_dictionary(), isolate);
DCHECK_NE(GlobalDictionary::kNotFound, entry);
auto cell = PropertyCell::InvalidateEntry(dictionary, entry);
@ -6686,7 +6692,7 @@ void JSReceiver::DeleteNormalizedProperty(Handle<JSReceiver> object,
cell->set_property_details(
PropertyDetails::Empty(PropertyCellType::kUninitialized));
} else {
Handle<NameDictionary> dictionary(object->property_dictionary());
Handle<NameDictionary> dictionary(object->property_dictionary(), isolate);
DCHECK_NE(NameDictionary::kNotFound, entry);
dictionary = NameDictionary::DeleteEntry(dictionary, entry);
@ -6791,7 +6797,7 @@ Maybe<bool> JSReceiver::DeletePropertyOrElement(Handle<JSReceiver> object,
Handle<Name> name,
LanguageMode language_mode) {
LookupIterator it = LookupIterator::PropertyOrElement(
name->GetIsolate(), object, name, object, LookupIterator::OWN);
object->GetIsolate(), object, name, object, LookupIterator::OWN);
return DeleteProperty(&it, language_mode);
}
@ -7666,7 +7672,7 @@ Maybe<bool> JSProxy::SetPrivateSymbol(Isolate* isolate, Handle<JSProxy> proxy,
return Just(true);
}
Handle<NameDictionary> dict(proxy->property_dictionary());
Handle<NameDictionary> dict(proxy->property_dictionary(), isolate);
PropertyDetails details(kData, DONT_ENUM, PropertyCellType::kNoCell);
Handle<NameDictionary> result =
NameDictionary::Add(dict, private_name, value, details);
@ -8787,7 +8793,7 @@ V8_WARN_UNUSED_RESULT Maybe<bool> FastGetOwnValuesOrEntries(
if (!map->IsJSObjectMap()) return Just(false);
if (!map->OnlyHasSimpleProperties()) return Just(false);
Handle<JSObject> object(JSObject::cast(*receiver));
Handle<JSObject> object(JSObject::cast(*receiver), isolate);
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
int number_of_own_descriptors = map->NumberOfOwnDescriptors();
@ -9329,7 +9335,7 @@ Handle<Map> Map::ShareDescriptor(Isolate* isolate, Handle<Map> map,
} else {
int slack = SlackForArraySize(old_size, kMaxNumberOfDescriptors);
EnsureDescriptorSlack(isolate, map, slack);
descriptors = handle(map->instance_descriptors());
descriptors = handle(map->instance_descriptors(), isolate);
}
}
@ -9572,8 +9578,9 @@ Handle<Map> Map::AsLanguageMode(Handle<Map> initial_map,
if (is_sloppy(shared_info->language_mode())) return initial_map;
Isolate* isolate = initial_map->GetIsolate();
Handle<Map> function_map(Map::cast(
isolate->native_context()->get(shared_info->function_map_index())));
Handle<Map> function_map(Map::cast(isolate->native_context()->get(
shared_info->function_map_index())),
isolate);
STATIC_ASSERT(LanguageModeSize == 2);
DCHECK_EQ(LanguageMode::kStrict, shared_info->language_mode());
@ -9617,7 +9624,7 @@ Handle<Map> Map::CopyForTransition(Isolate* isolate, Handle<Map> map,
} else {
// In case the map did not own its own descriptors, a split is forced by
// copying the map; creating a new descriptor array cell.
Handle<DescriptorArray> descriptors(map->instance_descriptors());
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
int number_of_own_descriptors = map->NumberOfOwnDescriptors();
Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
isolate, descriptors, number_of_own_descriptors);
@ -9774,7 +9781,7 @@ Handle<Map> Map::TransitionToDataProperty(Isolate* isolate, Handle<Map> map,
Map* maybe_transition = TransitionsAccessor(isolate, map)
.SearchTransition(*name, kData, attributes);
if (maybe_transition != nullptr) {
Handle<Map> transition(maybe_transition);
Handle<Map> transition(maybe_transition, isolate);
int descriptor = transition->LastAdded();
DCHECK_EQ(attributes, transition->instance_descriptors()
@ -9999,7 +10006,7 @@ Handle<Map> Map::CopyAddDescriptor(Isolate* isolate, Handle<Map> map,
Handle<Map> Map::CopyInsertDescriptor(Isolate* isolate, Handle<Map> map,
Descriptor* descriptor,
TransitionFlag flag) {
Handle<DescriptorArray> old_descriptors(map->instance_descriptors());
Handle<DescriptorArray> old_descriptors(map->instance_descriptors(), isolate);
// We replace the key if it is already present.
int index =
@ -12433,7 +12440,7 @@ void JSObject::MakePrototypesFast(Handle<Object> receiver,
// If the map is already marked as should be fast, we're done. Its
// prototypes will have been marked already as well.
if (current_map->should_be_fast_prototype_map()) return;
Handle<Map> map(current_map);
Handle<Map> map(current_map, isolate);
Map::SetShouldBeFastPrototypeMap(map, true, isolate);
JSObject::OptimizeAsPrototype(current_obj);
}
@ -12455,7 +12462,8 @@ void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype");
}
} else {
Handle<Map> new_map = Map::Copy(object->GetIsolate(), handle(object->map()),
Handle<Map> new_map = Map::Copy(object->GetIsolate(),
handle(object->map(), object->GetIsolate()),
"CopyAsPrototype");
JSObject::MigrateToMap(object, new_map);
object->map()->set_is_prototype_map(true);
@ -12771,8 +12779,7 @@ 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,
maybe_elements_transition->GetIsolate());
new_map = handle(maybe_elements_transition, native_context->GetIsolate());
} else {
new_map =
Map::CopyAsElementsKind(native_context->GetIsolate(), current_map,
@ -12863,7 +12870,8 @@ void JSFunction::SetPrototype(Handle<JSFunction> function,
new_map->set_has_non_instance_prototype(true);
FunctionKind kind = function->shared()->kind();
Handle<Context> native_context(function->context()->native_context());
Handle<Context> native_context(function->context()->native_context(),
isolate);
construct_prototype = Handle<JSReceiver>(
IsGeneratorFunction(kind)
@ -12887,8 +12895,8 @@ void JSFunction::SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
function->set_prototype_or_initial_map(*map);
map->SetConstructor(*function);
if (FLAG_trace_maps) {
LOG(map->GetIsolate(), MapEvent("InitialMap", nullptr, *map, "",
function->shared()->DebugName()));
LOG(function->GetIsolate(), MapEvent("InitialMap", nullptr, *map, "",
function->shared()->DebugName()));
}
}
@ -13130,7 +13138,8 @@ MaybeHandle<Map> JSFunction::GetDerivedMap(Isolate* isolate,
constructor, isolate->factory()->native_context_index_symbol());
int index = maybe_index->IsSmi() ? Smi::ToInt(*maybe_index)
: Context::OBJECT_FUNCTION_INDEX;
Handle<JSFunction> realm_constructor(JSFunction::cast(context->get(index)));
Handle<JSFunction> realm_constructor(JSFunction::cast(context->get(index)),
isolate);
prototype = handle(realm_constructor->prototype(), isolate);
}
@ -13275,11 +13284,11 @@ Handle<String> JSFunction::ToString(Handle<JSFunction> function) {
if (shared_info->is_wrapped()) {
builder.AppendCharacter('(');
Handle<FixedArray> args(
Script::cast(shared_info->script())->wrapped_arguments());
Script::cast(shared_info->script())->wrapped_arguments(), isolate);
int argc = args->length();
for (int i = 0; i < argc; i++) {
if (i > 0) builder.AppendCString(", ");
builder.AppendString(Handle<String>(String::cast(args->get(i))));
builder.AppendString(Handle<String>(String::cast(args->get(i)), isolate));
}
builder.AppendCString(") {\n");
}
@ -13513,7 +13522,7 @@ Handle<JSObject> Script::GetWrapper(Handle<Script> script) {
Isolate* isolate = script->GetIsolate();
if (!script->wrapper()->IsUndefined(isolate)) {
DCHECK(script->wrapper()->IsWeakCell());
Handle<WeakCell> cell(WeakCell::cast(script->wrapper()));
Handle<WeakCell> cell(WeakCell::cast(script->wrapper()), isolate);
if (!cell->cleared()) {
// Return a handle for the existing script wrapper from the cache.
return handle(JSObject::cast(cell->value()), isolate);
@ -13757,7 +13766,8 @@ Handle<Object> SharedFunctionInfo::GetSourceCode(
Handle<SharedFunctionInfo> shared) {
Isolate* isolate = shared->GetIsolate();
if (!shared->HasSourceCode()) return isolate->factory()->undefined_value();
Handle<String> source(String::cast(Script::cast(shared->script())->source()));
Handle<String> source(String::cast(Script::cast(shared->script())->source()),
isolate);
return isolate->factory()->NewSubString(source, shared->StartPosition(),
shared->EndPosition());
}
@ -13768,7 +13778,7 @@ Handle<Object> SharedFunctionInfo::GetSourceCodeHarmony(
Isolate* isolate = shared->GetIsolate();
if (!shared->HasSourceCode()) return isolate->factory()->undefined_value();
Handle<String> script_source(
String::cast(Script::cast(shared->script())->source()));
String::cast(Script::cast(shared->script())->source()), isolate);
int start_pos = shared->function_token_position();
if (start_pos == kNoSourcePosition) start_pos = shared->StartPosition();
Handle<String> source = isolate->factory()->NewSubString(
@ -13780,11 +13790,12 @@ Handle<Object> SharedFunctionInfo::GetSourceCodeHarmony(
builder.AppendCString("function ");
builder.AppendString(Handle<String>(shared->Name(), isolate));
builder.AppendCString("(");
Handle<FixedArray> args(Script::cast(shared->script())->wrapped_arguments());
Handle<FixedArray> args(Script::cast(shared->script())->wrapped_arguments(),
isolate);
int argc = args->length();
for (int i = 0; i < argc; i++) {
if (i > 0) builder.AppendCString(", ");
builder.AppendString(Handle<String>(String::cast(args->get(i))));
builder.AppendString(Handle<String>(String::cast(args->get(i)), isolate));
}
builder.AppendCString(") {\n");
builder.AppendString(source);
@ -13846,7 +13857,7 @@ bool JSFunction::CalculateInstanceSizeForDerivedClass(
Handle<JSFunction> func(Handle<JSFunction>::cast(current));
// The super constructor should be compiled for the number of expected
// properties to be available.
Handle<SharedFunctionInfo> shared(func->shared());
Handle<SharedFunctionInfo> shared(func->shared(), isolate);
if (shared->is_compiled() ||
Compiler::Compile(func, Compiler::CLEAR_EXCEPTION)) {
DCHECK(shared->is_compiled());
@ -15304,7 +15315,7 @@ Maybe<bool> JSObject::SetPrototype(Handle<JSObject> object,
all_extensible = all_extensible && real_receiver->map()->is_extensible();
}
}
Handle<Map> map(real_receiver->map());
Handle<Map> map(real_receiver->map(), isolate);
// Nothing to do if prototype is already set.
if (map->prototype() == *value) return Just(true);
@ -15359,7 +15370,7 @@ Maybe<bool> JSObject::SetPrototype(Handle<JSObject> object,
// static
void JSObject::SetImmutableProto(Handle<JSObject> object) {
DCHECK(!object->IsAccessCheckNeeded()); // Never called from JS
Handle<Map> map(object->map());
Handle<Map> map(object->map(), object->GetIsolate());
// Nothing to do if prototype is already set.
if (map->is_immutable_proto()) return;
@ -15584,7 +15595,7 @@ PretenureFlag AllocationSite::GetPretenureMode() const {
bool AllocationSite::IsNested() {
DCHECK(FLAG_trace_track_allocation_sites);
Object* current = GetHeap()->allocation_sites_list();
Object* current = boilerplate()->GetHeap()->allocation_sites_list();
while (current->IsAllocationSite()) {
AllocationSite* current_site = AllocationSite::cast(current);
if (current_site->nested_site() == this) {
@ -15723,7 +15734,7 @@ void JSObject::TransitionElementsKind(Handle<JSObject> object,
Handle<Map> new_map = GetElementsTransitionMap(object, to_kind);
MigrateToMap(object, new_map);
if (FLAG_trace_elements_transitions) {
Handle<FixedArrayBase> elms(object->elements());
Handle<FixedArrayBase> elms(object->elements(), object->GetIsolate());
PrintElementsTransition(stdout, object, from_kind, elms, to_kind, elms);
}
} else {
@ -15863,7 +15874,7 @@ MaybeHandle<Object> JSObject::GetPropertyWithInterceptor(LookupIterator* it,
Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object,
Handle<Name> name) {
LookupIterator it = LookupIterator::PropertyOrElement(
name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
object->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
return HasProperty(&it);
}
@ -15880,7 +15891,7 @@ Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object,
Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object,
Handle<Name> name) {
LookupIterator it = LookupIterator::PropertyOrElement(
name->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
object->GetIsolate(), object, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it);
return maybe_result.IsJust() ? Just(it.state() == LookupIterator::ACCESSOR)
: Nothing<bool>();
@ -16363,7 +16374,7 @@ MaybeHandle<String> EscapeRegExpSource(Isolate* isolate,
MaybeHandle<JSRegExp> JSRegExp::Initialize(Handle<JSRegExp> regexp,
Handle<String> source,
Handle<String> flags_string) {
Isolate* isolate = source->GetIsolate();
Isolate* isolate = regexp->GetIsolate();
bool success = false;
Flags flags = RegExpFlagsFromString(flags_string, &success);
if (!success) {
@ -16865,7 +16876,7 @@ void JSGlobalObject::InvalidatePropertyCell(Handle<JSGlobalObject> global,
JSObject::InvalidatePrototypeValidityCell(*global);
DCHECK(!global->HasFastProperties());
auto dictionary = handle(global->global_dictionary());
auto dictionary = handle(global->global_dictionary(), global->GetIsolate());
int entry = dictionary->FindEntry(name);
if (entry == GlobalDictionary::kNotFound) return;
PropertyCell::InvalidateEntry(dictionary, entry);
@ -17469,7 +17480,8 @@ FeedbackCell* SearchLiteralsMap(CompilationCacheTable* cache, int cache_entry,
MaybeHandle<SharedFunctionInfo> CompilationCacheTable::LookupScript(
Handle<String> src, Handle<Context> native_context,
LanguageMode language_mode) {
Handle<SharedFunctionInfo> shared(native_context->empty_function()->shared());
Handle<SharedFunctionInfo> shared(native_context->empty_function()->shared(),
native_context->GetIsolate());
StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
int entry = FindEntry(&key);
if (entry == kNotFound) return MaybeHandle<SharedFunctionInfo>();
@ -17477,7 +17489,7 @@ MaybeHandle<SharedFunctionInfo> CompilationCacheTable::LookupScript(
if (!get(index)->IsFixedArray()) return MaybeHandle<SharedFunctionInfo>();
Object* obj = get(index + 1);
if (obj->IsSharedFunctionInfo()) {
return handle(SharedFunctionInfo::cast(obj));
return handle(SharedFunctionInfo::cast(obj), native_context->GetIsolate());
}
return MaybeHandle<SharedFunctionInfo>();
}
@ -17529,8 +17541,9 @@ Handle<CompilationCacheTable> CompilationCacheTable::PutScript(
Handle<CompilationCacheTable> cache, Handle<String> src,
Handle<Context> native_context, LanguageMode language_mode,
Handle<SharedFunctionInfo> value) {
Isolate* isolate = cache->GetIsolate();
Handle<SharedFunctionInfo> shared(native_context->empty_function()->shared());
Isolate* isolate = native_context->GetIsolate();
Handle<SharedFunctionInfo> shared(native_context->empty_function()->shared(),
isolate);
StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
Handle<Object> k = key.AsHandle(isolate);
cache = EnsureCapacity(cache, 1);
@ -17546,7 +17559,7 @@ Handle<CompilationCacheTable> CompilationCacheTable::PutEval(
Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> value,
Handle<Context> native_context, Handle<FeedbackCell> feedback_cell,
int position) {
Isolate* isolate = cache->GetIsolate();
Isolate* isolate = native_context->GetIsolate();
StringSharedKey key(src, outer_info, value->language_mode(), position);
{
Handle<Object> k = key.AsHandle(isolate);
@ -18168,7 +18181,7 @@ void JSSet::Initialize(Handle<JSSet> set, Isolate* isolate) {
}
void JSSet::Clear(Isolate* isolate, Handle<JSSet> set) {
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()), isolate);
table = OrderedHashSet::Clear(isolate, table);
set->set_table(*table);
}
@ -18180,7 +18193,7 @@ void JSMap::Initialize(Handle<JSMap> map, Isolate* isolate) {
}
void JSMap::Clear(Isolate* isolate, Handle<JSMap> map) {
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()), isolate);
table = OrderedHashMap::Clear(isolate, table);
map->set_table(*table);
}
@ -18198,8 +18211,9 @@ void JSWeakCollection::Set(Handle<JSWeakCollection> weak_collection,
int32_t hash) {
DCHECK(key->IsJSReceiver() || key->IsSymbol());
Handle<EphemeronHashTable> table(
EphemeronHashTable::cast(weak_collection->table()));
DCHECK(table->IsKey(table->GetIsolate(), *key));
EphemeronHashTable::cast(weak_collection->table()),
weak_collection->GetIsolate());
DCHECK(table->IsKey(weak_collection->GetIsolate(), *key));
Handle<EphemeronHashTable> new_table =
EphemeronHashTable::Put(table, key, value, hash);
weak_collection->set_table(*new_table);
@ -18214,8 +18228,9 @@ bool JSWeakCollection::Delete(Handle<JSWeakCollection> weak_collection,
Handle<Object> key, int32_t hash) {
DCHECK(key->IsJSReceiver() || key->IsSymbol());
Handle<EphemeronHashTable> table(
EphemeronHashTable::cast(weak_collection->table()));
DCHECK(table->IsKey(table->GetIsolate(), *key));
EphemeronHashTable::cast(weak_collection->table()),
weak_collection->GetIsolate());
DCHECK(table->IsKey(weak_collection->GetIsolate(), *key));
bool was_present = false;
Handle<EphemeronHashTable> new_table =
EphemeronHashTable::Remove(table, key, &was_present, hash);
@ -18230,7 +18245,8 @@ bool JSWeakCollection::Delete(Handle<JSWeakCollection> weak_collection,
Handle<JSArray> JSWeakCollection::GetEntries(Handle<JSWeakCollection> holder,
int max_entries) {
Isolate* isolate = holder->GetIsolate();
Handle<EphemeronHashTable> table(EphemeronHashTable::cast(holder->table()));
Handle<EphemeronHashTable> table(EphemeronHashTable::cast(holder->table()),
isolate);
if (max_entries == 0 || max_entries > table->NumberOfElements()) {
max_entries = table->NumberOfElements();
}
@ -18621,7 +18637,7 @@ Handle<JSArrayBuffer> JSTypedArray::MaterializeArrayBuffer(
DCHECK(IsFixedTypedArrayElementsKind(typed_array->GetElementsKind()));
Handle<FixedTypedArrayBase> fixed_typed_array(
FixedTypedArrayBase::cast(typed_array->elements()));
FixedTypedArrayBase::cast(typed_array->elements()), isolate);
Handle<JSArrayBuffer> buffer(JSArrayBuffer::cast(typed_array->buffer()),
isolate);
@ -18669,7 +18685,7 @@ Handle<PropertyCell> PropertyCell::InvalidateEntry(
Handle<GlobalDictionary> dictionary, int entry) {
Isolate* isolate = dictionary->GetIsolate();
// Swap with a copy.
Handle<PropertyCell> cell(dictionary->CellAt(entry));
Handle<PropertyCell> cell(dictionary->CellAt(entry), isolate);
Handle<Name> name(cell->name(), isolate);
Handle<PropertyCell> new_cell = isolate->factory()->NewPropertyCell(name);
new_cell->set_value(cell->value());
@ -18754,7 +18770,7 @@ Handle<PropertyCell> PropertyCell::PrepareForValue(
PropertyDetails details) {
Isolate* isolate = dictionary->GetIsolate();
DCHECK(!value->IsTheHole(isolate));
Handle<PropertyCell> cell(dictionary->CellAt(entry));
Handle<PropertyCell> cell(dictionary->CellAt(entry), isolate);
const PropertyDetails original_details = cell->property_details();
// Data accesses could be cached in ics or optimized code.
bool invalidate =

View File

@ -217,8 +217,8 @@ void BreakPointInfo::ClearBreakPoint(Isolate* isolate,
}
// If there are multiple break points shrink the array
DCHECK(break_point_info->break_points()->IsFixedArray());
Handle<FixedArray> old_array =
Handle<FixedArray>(FixedArray::cast(break_point_info->break_points()));
Handle<FixedArray> old_array = Handle<FixedArray>(
FixedArray::cast(break_point_info->break_points()), isolate);
Handle<FixedArray> new_array =
isolate->factory()->NewFixedArray(old_array->length() - 1);
int found_count = 0;
@ -254,8 +254,8 @@ void BreakPointInfo::SetBreakPoint(Isolate* isolate,
return;
}
// If there was more than one break point before extend array.
Handle<FixedArray> old_array =
Handle<FixedArray>(FixedArray::cast(break_point_info->break_points()));
Handle<FixedArray> old_array = Handle<FixedArray>(
FixedArray::cast(break_point_info->break_points()), isolate);
Handle<FixedArray> new_array =
isolate->factory()->NewFixedArray(old_array->length() + 1);
for (int i = 0; i < old_array->length(); i++) {

View File

@ -72,7 +72,7 @@ Handle<Derived> OrderedHashTable<Derived, entrysize>::Clear(
Handle<Derived> new_table =
Allocate(isolate, kMinCapacity,
table->GetHeap()->InNewSpace(*table) ? NOT_TENURED : TENURED);
isolate->heap()->InNewSpace(*table) ? NOT_TENURED : TENURED);
table->SetNextTable(*new_table);
table->SetNumberOfDeletedElements(kClearedTableSentinel);

View File

@ -106,12 +106,12 @@ void OptimizedCompilationInfo::set_deferred_handles(
deferred_handles_.reset(deferred_handles);
}
void OptimizedCompilationInfo::ReopenHandlesInNewHandleScope() {
void OptimizedCompilationInfo::ReopenHandlesInNewHandleScope(Isolate* isolate) {
if (!shared_info_.is_null()) {
shared_info_ = Handle<SharedFunctionInfo>(*shared_info_);
shared_info_ = Handle<SharedFunctionInfo>(*shared_info_, isolate);
}
if (!closure_.is_null()) {
closure_ = Handle<JSFunction>(*closure_);
closure_ = Handle<JSFunction>(*closure_, isolate);
}
}

View File

@ -214,7 +214,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final {
return deferred_handles_;
}
void ReopenHandlesInNewHandleScope();
void ReopenHandlesInNewHandleScope(Isolate* isolate);
void AbortOptimization(BailoutReason reason) {
DCHECK_NE(reason, BailoutReason::kNoReason);

View File

@ -209,7 +209,8 @@ Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) {
// Can't break -- kFilterUnreachable requires full heap traversal.
}
}
return object != nullptr ? Handle<HeapObject>(object) : Handle<HeapObject>();
return object != nullptr ? Handle<HeapObject>(object, isolate())
: Handle<HeapObject>();
}

View File

@ -1900,7 +1900,8 @@ class GlobalObjectsEnumerator : public RootVisitor {
if (!proxy->IsJSGlobalProxy()) continue;
Object* global = proxy->map()->prototype();
if (!global->IsJSGlobalObject()) continue;
objects_.push_back(Handle<JSGlobalObject>(JSGlobalObject::cast(global)));
objects_.push_back(Handle<JSGlobalObject>(JSGlobalObject::cast(global),
proxy->GetIsolate()));
}
}
int count() const { return static_cast<int>(objects_.size()); }

View File

@ -57,7 +57,7 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
// TODO(jkummerow): support dictionary properties?
if (map->is_dictionary_map()) return false;
Handle<DescriptorArray> descs =
Handle<DescriptorArray>(map->instance_descriptors());
Handle<DescriptorArray>(map->instance_descriptors(), isolate);
for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
PropertyDetails details = descs->GetDetails(i);
Name* key = descs->GetKey(i);

View File

@ -179,7 +179,7 @@ MaybeHandle<Object> RegExpImpl::Compile(Isolate* isolate, Handle<JSRegExp> re,
DCHECK(re->data()->IsFixedArray());
// Compilation succeeded so the data is set on the regexp
// and we can store it in the cache.
Handle<FixedArray> data(FixedArray::cast(re->data()));
Handle<FixedArray> data(FixedArray::cast(re->data()), isolate);
compilation_cache->PutRegExp(pattern, flags, data);
return re;
@ -324,7 +324,7 @@ bool RegExpImpl::CompileIrregexp(Isolate* isolate, Handle<JSRegExp> re,
JSRegExp::Flags flags = re->GetFlags();
Handle<String> pattern(re->Pattern());
Handle<String> pattern(re->Pattern(), isolate);
pattern = String::Flatten(isolate, pattern);
RegExpCompileData compile_data;
FlatStringReader reader(isolate, pattern);

View File

@ -166,8 +166,8 @@ int NativeRegExpMacroAssembler::CheckStackGuardState(
int return_value = 0;
// Prepare for possible GC.
HandleScope handles(isolate);
Handle<Code> code_handle(re_code);
Handle<String> subject_handle(*subject);
Handle<Code> code_handle(re_code, isolate);
Handle<String> subject_handle(*subject, isolate);
bool is_one_byte = subject_handle->IsOneByteRepresentationUnderneath();
StackLimitCheck check(isolate);

View File

@ -30,7 +30,7 @@ Handle<String> RegExpUtils::GenericCaptureGetter(
}
if (ok != nullptr) *ok = true;
Handle<String> last_subject(match_info->LastSubject());
Handle<String> last_subject(match_info->LastSubject(), isolate);
return isolate->factory()->NewSubString(last_subject, match_start, match_end);
}

View File

@ -179,7 +179,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle<JSReceiver> receiver,
if (object->HasDictionaryElements()) {
// Convert to fast elements containing only the existing properties.
// Ordering is irrelevant, since we are going to sort anyway.
Handle<NumberDictionary> dict(object->element_dictionary());
Handle<NumberDictionary> dict(object->element_dictionary(), isolate);
if (object->IsJSArray() || dict->requires_slow_elements() ||
dict->max_number_key() >= limit) {
return RemoveArrayHolesGeneric(isolate, receiver, limit);
@ -208,7 +208,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle<JSReceiver> receiver,
// Collect holes at the end, undefined before that and the rest at the
// start, and return the number of non-hole, non-undefined values.
Handle<FixedArrayBase> elements_base(object->elements());
Handle<FixedArrayBase> elements_base(object->elements(), isolate);
uint32_t elements_length = static_cast<uint32_t>(elements_base->length());
if (limit > elements_length) {
limit = elements_length;
@ -401,7 +401,7 @@ RUNTIME_FUNCTION(Runtime_MoveArrayContents) {
JSObject::ValidateElements(*from);
JSObject::ValidateElements(*to);
Handle<FixedArrayBase> new_elements(from->elements());
Handle<FixedArrayBase> new_elements(from->elements(), isolate);
ElementsKind from_kind = from->GetElementsKind();
Handle<Map> new_map = JSObject::GetElementsTransitionMap(to, from_kind);
JSObject::SetMapAndElements(to, new_map, new_elements);

View File

@ -23,7 +23,7 @@ RUNTIME_FUNCTION(Runtime_SetGrow) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()));
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate);
table = OrderedHashSet::EnsureGrowable(isolate, table);
holder->set_table(*table);
return isolate->heap()->undefined_value();
@ -34,7 +34,7 @@ RUNTIME_FUNCTION(Runtime_SetShrink) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()));
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate);
table = OrderedHashSet::Shrink(isolate, table);
holder->set_table(*table);
return isolate->heap()->undefined_value();
@ -54,7 +54,7 @@ RUNTIME_FUNCTION(Runtime_MapShrink) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate);
table = OrderedHashMap::Shrink(isolate, table);
holder->set_table(*table);
return isolate->heap()->undefined_value();
@ -64,7 +64,7 @@ RUNTIME_FUNCTION(Runtime_MapGrow) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()));
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate);
table = OrderedHashMap::EnsureGrowable(isolate, table);
holder->set_table(*table);
return isolate->heap()->undefined_value();
@ -100,7 +100,7 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
DCHECK(key->IsJSReceiver());
DCHECK(EphemeronHashTableShape::IsLive(isolate, *key));
Handle<EphemeronHashTable> table(
EphemeronHashTable::cast(weak_collection->table()));
EphemeronHashTable::cast(weak_collection->table()), isolate);
// Should only be called when shrinking the table is necessary. See
// HashTable::Shrink().
DCHECK(table->NumberOfElements() - 1 <= (table->Capacity() >> 2) &&
@ -132,7 +132,7 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
DCHECK(key->IsJSReceiver());
DCHECK(EphemeronHashTableShape::IsLive(isolate, *key));
Handle<EphemeronHashTable> table(
EphemeronHashTable::cast(weak_collection->table()));
EphemeronHashTable::cast(weak_collection->table()), isolate);
// Should only be called when rehashing or resizing the table is necessary.
// See EphemeronHashTable::Put() and HashTable::HasSufficientCapacityToAdd().
DCHECK((table->NumberOfDeletedElements() << 1) > table->NumberOfElements() ||

View File

@ -66,7 +66,7 @@ RUNTIME_FUNCTION(Runtime_FunctionFirstExecution) {
DCHECK_EQ(function->feedback_vector()->optimization_marker(),
OptimizationMarker::kLogFirstExecution);
DCHECK(FLAG_log_function_events);
Handle<SharedFunctionInfo> sfi(function->shared());
Handle<SharedFunctionInfo> sfi(function->shared(), isolate);
LOG(isolate, FunctionEvent("first-execution", Script::cast(sfi->script()), -1,
0, sfi->StartPosition(), sfi->EndPosition(),
sfi->DebugName()));
@ -121,8 +121,8 @@ RUNTIME_FUNCTION(Runtime_InstantiateAsmJs) {
memory = args.at<JSArrayBuffer>(3);
}
if (function->shared()->HasAsmWasmData()) {
Handle<SharedFunctionInfo> shared(function->shared());
Handle<FixedArray> data(shared->asm_wasm_data());
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
Handle<FixedArray> data(shared->asm_wasm_data(), isolate);
MaybeHandle<Object> result = AsmJs::InstantiateAsmWasm(
isolate, shared, data, stdlib, foreign, memory);
if (!result.is_null()) {
@ -203,7 +203,7 @@ BailoutId DetermineEntryAndDisarmOSRForInterpreter(JavaScriptFrame* frame) {
// the one installed on the function (e.g. patched by debugger). This however
// is fine because we guarantee the layout to be in sync, hence any BailoutId
// representing the entry point will be valid for any copy of the bytecode.
Handle<BytecodeArray> bytecode(iframe->GetBytecodeArray());
Handle<BytecodeArray> bytecode(iframe->GetBytecodeArray(), iframe->isolate());
DCHECK(frame->LookupCode()->is_interpreter_trampoline_builtin());
DCHECK(frame->function()->shared()->HasBytecodeArray());

View File

@ -385,7 +385,7 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
CHECK(isolate->debug()->is_active());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
Handle<SharedFunctionInfo> shared(fun->shared());
Handle<SharedFunctionInfo> shared(fun->shared(), isolate);
// Find the number of break points
Handle<Object> break_locations =
Debug::GetSourceBreakLocations(isolate, shared);

View File

@ -64,7 +64,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetSourceCode) {
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
if (function->IsJSFunction()) {
Handle<SharedFunctionInfo> shared(
Handle<JSFunction>::cast(function)->shared());
Handle<JSFunction>::cast(function)->shared(), isolate);
return *SharedFunctionInfo::GetSourceCode(shared);
}
return isolate->heap()->undefined_value();
@ -97,8 +97,8 @@ RUNTIME_FUNCTION(Runtime_SetCode) {
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, source, 1);
Handle<SharedFunctionInfo> target_shared(target->shared());
Handle<SharedFunctionInfo> source_shared(source->shared());
Handle<SharedFunctionInfo> target_shared(target->shared(), isolate);
Handle<SharedFunctionInfo> source_shared(source->shared(), isolate);
if (!source->is_compiled() &&
!Compiler::Compile(source, Compiler::KEEP_EXCEPTION)) {
@ -132,7 +132,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) {
// Set the code of the target function.
target->set_code(source_shared->GetCode());
Handle<Context> context(source->context());
Handle<Context> context(source->context(), isolate);
target->set_context(*context);
// Make sure we get a fresh copy of the feedback vector to avoid cross

View File

@ -49,13 +49,13 @@ RUNTIME_FUNCTION(Runtime_InstallToContext) {
CHECK(array->HasFastElements());
CHECK(isolate->bootstrapper()->IsActive());
Handle<Context> native_context = isolate->native_context();
Handle<FixedArray> fixed_array(FixedArray::cast(array->elements()));
Handle<FixedArray> fixed_array(FixedArray::cast(array->elements()), isolate);
int length = Smi::ToInt(array->length());
for (int i = 0; i < length; i += 2) {
CHECK(fixed_array->get(i)->IsString());
Handle<String> name(String::cast(fixed_array->get(i)));
Handle<String> name(String::cast(fixed_array->get(i)), isolate);
CHECK(fixed_array->get(i + 1)->IsJSObject());
Handle<JSObject> object(JSObject::cast(fixed_array->get(i + 1)));
Handle<JSObject> object(JSObject::cast(fixed_array->get(i + 1)), isolate);
int index = Context::ImportedFieldIndexForName(name);
if (index == Context::kNotFound) {
index = Context::IntrinsicIndexForName(name);
@ -330,7 +330,7 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
std::vector<FrameSummary> frames;
it.frame()->Summarize(&frames);
auto& summary = frames.back().AsJavaScript();
Handle<SharedFunctionInfo> shared(summary.function()->shared());
Handle<SharedFunctionInfo> shared(summary.function()->shared(), isolate);
Handle<Object> script(shared->script(), isolate);
int pos = summary.abstract_code()->SourcePosition(summary.code_offset());
if (script->IsScript() &&

View File

@ -228,7 +228,7 @@ RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
Handle<JSFunction> constructor(
isolate->native_context()->intl_date_time_format_function());
isolate->native_context()->intl_date_time_format_function(), isolate);
Handle<JSObject> local_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, local_object,
@ -287,7 +287,7 @@ RUNTIME_FUNCTION(Runtime_CreateNumberFormat) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
Handle<JSFunction> constructor(
isolate->native_context()->intl_number_format_function());
isolate->native_context()->intl_number_format_function(), isolate);
Handle<JSObject> local_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, local_object,
@ -359,7 +359,7 @@ RUNTIME_FUNCTION(Runtime_CreateCollator) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
Handle<JSFunction> constructor(
isolate->native_context()->intl_collator_function());
isolate->native_context()->intl_collator_function(), isolate);
Handle<JSObject> collator_holder;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, collator_holder,
@ -419,7 +419,7 @@ RUNTIME_FUNCTION(Runtime_CreatePluralRules) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
Handle<JSFunction> constructor(
isolate->native_context()->intl_plural_rules_function());
isolate->native_context()->intl_plural_rules_function(), isolate);
Handle<JSObject> local_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, local_object,
@ -495,7 +495,7 @@ RUNTIME_FUNCTION(Runtime_CreateBreakIterator) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, resolved, 2);
Handle<JSFunction> constructor(
isolate->native_context()->intl_v8_break_iterator_function());
isolate->native_context()->intl_v8_break_iterator_function(), isolate);
Handle<JSObject> local_object;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, local_object,

View File

@ -106,7 +106,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
// Deep copy own properties. Arrays only have 1 property "length".
if (!copy->IsJSArray()) {
if (copy->HasFastProperties()) {
Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors());
Handle<DescriptorArray> descriptors(copy->map()->instance_descriptors(),
isolate);
int limit = copy->map()->NumberOfOwnDescriptors();
for (int i = 0; i < limit; i++) {
DCHECK_EQ(kField, descriptors->GetDetails(i).location());
@ -128,7 +129,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
}
}
} else {
Handle<NameDictionary> dict(copy->property_dictionary());
Handle<NameDictionary> dict(copy->property_dictionary(), isolate);
for (int i = 0; i < dict->Capacity(); i++) {
Object* raw = dict->ValueAt(i);
if (!raw->IsJSObject()) continue;
@ -148,7 +149,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
switch (copy->GetElementsKind()) {
case PACKED_ELEMENTS:
case HOLEY_ELEMENTS: {
Handle<FixedArray> elements(FixedArray::cast(copy->elements()));
Handle<FixedArray> elements(FixedArray::cast(copy->elements()), isolate);
if (elements->map() == isolate->heap()->fixed_cow_array_map()) {
#ifdef DEBUG
for (int i = 0; i < elements->length(); i++) {
@ -168,7 +169,8 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
break;
}
case DICTIONARY_ELEMENTS: {
Handle<NumberDictionary> element_dictionary(copy->element_dictionary());
Handle<NumberDictionary> element_dictionary(copy->element_dictionary(),
isolate);
int capacity = element_dictionary->Capacity();
for (int i = 0; i < capacity; i++) {
Object* raw = element_dictionary->ValueAt(i);
@ -395,8 +397,8 @@ struct ArrayBoilerplate {
ElementsKind constant_elements_kind =
static_cast<ElementsKind>(elements->elements_kind());
Handle<FixedArrayBase> constant_elements_values(
elements->constant_values());
Handle<FixedArrayBase> constant_elements_values(elements->constant_values(),
isolate);
Handle<FixedArrayBase> copied_elements_values;
if (IsDoubleElementsKind(constant_elements_kind)) {
copied_elements_values = isolate->factory()->CopyFixedDoubleArray(
@ -427,7 +429,8 @@ struct ArrayBoilerplate {
// boilerplate description of a simple object or
// array literal.
Handle<FixedArray> compile_time_value(
FixedArray::cast(fixed_array_values->get(i)));
FixedArray::cast(fixed_array_values->get(i)),
for_with_handle_isolate);
Handle<Object> result = InnerCreateBoilerplate(
isolate, compile_time_value, pretenure_flag);
fixed_array_values_copy->set(i, *result);

View File

@ -85,7 +85,8 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) {
CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 2);
CHECK(original_script_value->value()->IsScript());
Handle<Script> original_script(Script::cast(original_script_value->value()));
Handle<Script> original_script(Script::cast(original_script_value->value()),
isolate);
Handle<Object> old_script = LiveEdit::ChangeScriptSource(
isolate, original_script, new_source, old_script_name);
@ -107,7 +108,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFixupScript) {
CONVERT_INT32_ARG_CHECKED(max_function_literal_id, 1);
CHECK(script_value->value()->IsScript());
Handle<Script> script(Script::cast(script_value->value()));
Handle<Script> script(Script::cast(script_value->value()), isolate);
LiveEdit::FixupScript(isolate, script, max_function_literal_id);
return isolate->heap()->undefined_value();

View File

@ -19,7 +19,7 @@ RUNTIME_FUNCTION(Runtime_DynamicImportCall) {
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, specifier, 1);
Handle<Script> script(Script::cast(function->shared()->script()));
Handle<Script> script(Script::cast(function->shared()->script()), isolate);
while (script->has_eval_from_shared()) {
script =
@ -35,14 +35,14 @@ RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_SMI_ARG_CHECKED(module_request, 0);
Handle<Module> module(isolate->context()->module());
Handle<Module> module(isolate->context()->module(), isolate);
return *Module::GetModuleNamespace(isolate, module, module_request);
}
RUNTIME_FUNCTION(Runtime_GetImportMetaObject) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
Handle<Module> module(isolate->context()->module());
Handle<Module> module(isolate->context()->module(), isolate);
return *isolate->RunHostInitializeImportMetaObjectCallback(module);
}

View File

@ -872,7 +872,7 @@ RUNTIME_FUNCTION(Runtime_StringSplit) {
DCHECK(result->HasObjectElements());
Handle<FixedArray> elements(FixedArray::cast(result->elements()));
Handle<FixedArray> elements(FixedArray::cast(result->elements()), isolate);
if (part_count == 1 && indices->at(0) == subject_length) {
elements->set(0, *subject);
@ -1108,7 +1108,8 @@ Handle<JSObject> ConstructNamedCaptureGroupsObject(
const int name_ix = i * 2;
const int index_ix = i * 2 + 1;
Handle<String> capture_name(String::cast(capture_map->get(name_ix)));
Handle<String> capture_name(String::cast(capture_map->get(name_ix)),
isolate);
const int capture_ix = Smi::ToInt(capture_map->get(index_ix));
DCHECK(1 <= capture_ix && capture_ix <= capture_count);
@ -1167,8 +1168,8 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
// Ensured in Runtime_RegExpExecMultiple.
DCHECK(result_array->HasObjectElements());
Handle<FixedArray> result_elements(
FixedArray::cast(result_array->elements()));
Handle<FixedArray> result_elements(FixedArray::cast(result_array->elements()),
isolate);
if (result_elements->length() < 16) {
result_elements = isolate->factory()->NewFixedArrayWithHoles(16);
}

View File

@ -50,7 +50,7 @@ Object* DeclareGlobal(
Handle<FeedbackVector> feedback_vector = Handle<FeedbackVector>(),
FeedbackSlot slot = FeedbackSlot::Invalid()) {
Handle<ScriptContextTable> script_contexts(
global->native_context()->script_context_table());
global->native_context()->script_context_table(), isolate);
ScriptContextTable::LookupResult lookup;
if (ScriptContextTable::Lookup(script_contexts, name, &lookup) &&
IsLexicalVariableMode(lookup.mode)) {
@ -135,7 +135,7 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations,
int flags, Handle<FeedbackVector> feedback_vector) {
HandleScope scope(isolate);
Handle<JSGlobalObject> global(isolate->global_object());
Handle<Context> context(isolate->context());
Handle<Context> context(isolate->context(), isolate);
// Traverse the name/value pairs and set the properties.
int length = declarations->length();
@ -413,7 +413,7 @@ Handle<JSObject> NewSloppyArguments(Isolate* isolate, Handle<JSFunction> callee,
// Store the context and the arguments array at the beginning of the
// parameter map.
Handle<Context> context(isolate->context());
Handle<Context> context(isolate->context(), isolate);
Handle<FixedArray> arguments =
isolate->factory()->NewFixedArray(argument_count, NOT_TENURED);
parameter_map->set(0, *context);
@ -630,7 +630,7 @@ static Object* FindNameClash(Isolate* isolate, Handle<ScopeInfo> scope_info,
Handle<JSGlobalObject> global_object,
Handle<ScriptContextTable> script_context) {
for (int var = 0; var < scope_info->ContextLocalCount(); var++) {
Handle<String> name(scope_info->ContextLocalName(var));
Handle<String> name(scope_info->ContextLocalName(var), isolate);
VariableMode mode = scope_info->ContextLocalMode(var);
ScriptContextTable::LookupResult lookup;
if (ScriptContextTable::Lookup(script_context, name, &lookup)) {
@ -672,9 +672,10 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) {
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 0);
Handle<Context> native_context(isolate->context(), isolate);
DCHECK(native_context->IsNativeContext());
Handle<JSGlobalObject> global_object(native_context->global_object());
Handle<JSGlobalObject> global_object(native_context->global_object(),
isolate);
Handle<ScriptContextTable> script_context_table(
native_context->script_context_table());
native_context->script_context_table(), isolate);
Object* name_clash_result =
FindNameClash(isolate, scope_info, global_object, script_context_table);
@ -707,7 +708,7 @@ RUNTIME_FUNCTION(Runtime_PushWithContext) {
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, extension_object, 0);
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
Handle<Context> current(isolate->context());
Handle<Context> current(isolate->context(), isolate);
Handle<Context> context =
isolate->factory()->NewWithContext(current, scope_info, extension_object);
isolate->set_context(*context);

View File

@ -350,7 +350,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderJoin) {
CHECK(array->HasObjectElements());
CHECK_GE(array_length, 0);
Handle<FixedArray> fixed_array(FixedArray::cast(array->elements()));
Handle<FixedArray> fixed_array(FixedArray::cast(array->elements()), isolate);
if (fixed_array->length() < array_length) {
array_length = fixed_array->length();
}

View File

@ -121,7 +121,7 @@ RUNTIME_FUNCTION(Runtime_TypedArraySortFast) {
if (length <= 1) return *array;
Handle<FixedTypedArrayBase> elements(
FixedTypedArrayBase::cast(array->elements()));
FixedTypedArrayBase::cast(array->elements()), isolate);
switch (array->type()) {
#define TYPED_ARRAY_SORT(Type, type, TYPE, ctype, size) \
case kExternal##Type##Array: { \

View File

@ -158,7 +158,7 @@ RUNTIME_FUNCTION(Runtime_WasmGetExceptionRuntimeId) {
isolate->set_context(GetNativeContextFromWasmInstanceOnStackTop(isolate));
Handle<Object> except_obj(isolate->get_wasm_caught_exception(), isolate);
if (!except_obj.is_null() && except_obj->IsJSReceiver()) {
Handle<JSReceiver> exception(JSReceiver::cast(*except_obj));
Handle<JSReceiver> exception(JSReceiver::cast(*except_obj), isolate);
Handle<Object> tag;
if (JSReceiver::GetProperty(isolate, exception,
isolate->factory()->InternalizeUtf8String(
@ -180,7 +180,7 @@ RUNTIME_FUNCTION(Runtime_WasmExceptionGetElement) {
DCHECK_EQ(1, args.length());
Handle<Object> except_obj(isolate->get_wasm_caught_exception(), isolate);
if (!except_obj.is_null() && except_obj->IsJSReceiver()) {
Handle<JSReceiver> exception(JSReceiver::cast(*except_obj));
Handle<JSReceiver> exception(JSReceiver::cast(*except_obj), isolate);
Handle<Object> values_obj;
if (JSReceiver::GetProperty(isolate, exception,
isolate->factory()->InternalizeUtf8String(
@ -208,7 +208,7 @@ RUNTIME_FUNCTION(Runtime_WasmExceptionSetElement) {
isolate->set_context(GetNativeContextFromWasmInstanceOnStackTop(isolate));
Handle<Object> except_obj(isolate->get_wasm_caught_exception(), isolate);
if (!except_obj.is_null() && except_obj->IsJSReceiver()) {
Handle<JSReceiver> exception(JSReceiver::cast(*except_obj));
Handle<JSReceiver> exception(JSReceiver::cast(*except_obj), isolate);
Handle<Object> values_obj;
if (JSReceiver::GetProperty(isolate, exception,
isolate->factory()->InternalizeUtf8String(
@ -234,7 +234,8 @@ RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) {
HandleScope scope(isolate);
CONVERT_NUMBER_CHECKED(int32_t, func_index, Int32, args[0]);
CONVERT_ARG_HANDLE_CHECKED(Object, arg_buffer_obj, 1);
Handle<WasmInstanceObject> instance(GetWasmInstanceOnStackTop(isolate));
Handle<WasmInstanceObject> instance(GetWasmInstanceOnStackTop(isolate),
isolate);
// The arg buffer is the raw pointer to the caller's stack. It looks like a
// Smi (lowest bit not set, as checked by IsSmi), but is no valid Smi. We just

View File

@ -736,7 +736,7 @@ void ValueSerializer::WriteJSRegExp(JSRegExp* regexp) {
Maybe<bool> ValueSerializer::WriteJSMap(Handle<JSMap> map) {
// First copy the key-value pairs, since getters could mutate them.
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()));
Handle<OrderedHashMap> table(OrderedHashMap::cast(map->table()), isolate_);
int length = table->NumberOfElements() * 2;
Handle<FixedArray> entries = isolate_->factory()->NewFixedArray(length);
{
@ -767,7 +767,7 @@ Maybe<bool> ValueSerializer::WriteJSMap(Handle<JSMap> map) {
Maybe<bool> ValueSerializer::WriteJSSet(Handle<JSSet> set) {
// First copy the element pointers, since getters could mutate them.
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()));
Handle<OrderedHashSet> table(OrderedHashSet::cast(set->table()), isolate_);
int length = table->NumberOfElements();
Handle<FixedArray> entries = isolate_->factory()->NewFixedArray(length);
{

View File

@ -2278,7 +2278,7 @@ AsyncCompileJob::AsyncCompileJob(
foreground_task_runner_ = platform->GetForegroundTaskRunner(v8_isolate);
// The handle for the context must be deferred.
DeferredHandleScope deferred(isolate);
context_ = Handle<Context>(*context);
context_ = Handle<Context>(*context, isolate);
deferred_handles_.push_back(deferred.Detach());
}

View File

@ -459,7 +459,8 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
memcpy(reloc_info.get(), code->relocation_start(), code->relocation_size());
}
std::unique_ptr<byte[]> source_pos;
Handle<ByteArray> source_pos_table(code->SourcePositionTable());
Handle<ByteArray> source_pos_table(code->SourcePositionTable(),
code->GetIsolate());
if (source_pos_table->length() > 0) {
source_pos.reset(new byte[source_pos_table->length()]);
source_pos_table->copy_out(0, source_pos.get(), source_pos_table->length());

View File

@ -642,7 +642,8 @@ void WasmDebugInfo::PrepareStep(StepAction step_action) {
bool WasmDebugInfo::RunInterpreter(Address frame_pointer, int func_index,
Address arg_buffer) {
DCHECK_LE(0, func_index);
Handle<WasmInstanceObject> instance(wasm_instance());
Handle<WasmInstanceObject> instance(wasm_instance(),
wasm_instance()->GetIsolate());
return GetInterpreterHandle(this)->Execute(
instance, frame_pointer, static_cast<uint32_t>(func_index), arg_buffer);
}

View File

@ -2343,7 +2343,8 @@ class ThreadImpl {
MemoryIndexImmediate<Decoder::kNoValidate> imm(&decoder,
code->at(pc));
uint32_t delta_pages = Pop().to<uint32_t>();
Handle<WasmMemoryObject> memory(instance_object_->memory_object());
Handle<WasmMemoryObject> memory(instance_object_->memory_object(),
instance_object_->GetIsolate());
Isolate* isolate = memory->GetIsolate();
int32_t result = WasmMemoryObject::Grow(isolate, memory, delta_pages);
Push(WasmValue(result));

View File

@ -994,7 +994,7 @@ void WebAssemblyInstanceGetExports(
HandleScope scope(isolate);
ScheduledErrorThrower thrower(i_isolate, "WebAssembly.Instance.exports()");
EXTRACT_THIS(receiver, WasmInstanceObject);
i::Handle<i::JSObject> exports_object(receiver->exports_object());
i::Handle<i::JSObject> exports_object(receiver->exports_object(), i_isolate);
args.GetReturnValue().Set(Utils::ToLocal(exports_object));
}
@ -1121,7 +1121,7 @@ void WebAssemblyMemoryGrow(const v8::FunctionCallbackInfo<v8::Value>& args) {
max_size64 > static_cast<int64_t>(i::FLAG_wasm_max_mem_pages)) {
max_size64 = i::FLAG_wasm_max_mem_pages;
}
i::Handle<i::JSArrayBuffer> old_buffer(receiver->array_buffer());
i::Handle<i::JSArrayBuffer> old_buffer(receiver->array_buffer(), i_isolate);
if (!old_buffer->is_growable()) {
thrower.RangeError("This memory cannot be grown");
return;
@ -1155,7 +1155,8 @@ void WebAssemblyMemoryGetBuffer(
i::Handle<i::Object> buffer_obj(receiver->array_buffer(), i_isolate);
DCHECK(buffer_obj->IsJSArrayBuffer());
i::Handle<i::JSArrayBuffer> buffer(i::JSArrayBuffer::cast(*buffer_obj));
i::Handle<i::JSArrayBuffer> buffer(i::JSArrayBuffer::cast(*buffer_obj),
i_isolate);
if (buffer->is_shared()) {
// TODO(gdeepti): More needed here for when cached buffer, and current
// buffer are out of sync, handle that here when bounds checks, and Grow
@ -1374,7 +1375,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_module_constructor(*module_constructor);
JSFunction::EnsureHasInitialMap(module_constructor);
Handle<JSObject> module_proto(
JSObject::cast(module_constructor->instance_prototype()));
JSObject::cast(module_constructor->instance_prototype()), isolate);
i::Handle<i::Map> module_map =
isolate->factory()->NewMap(i::WASM_MODULE_TYPE, WasmModuleObject::kSize);
JSFunction::SetInitialMap(module_constructor, module_map, module_proto);
@ -1393,7 +1394,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_instance_constructor(*instance_constructor);
JSFunction::EnsureHasInitialMap(instance_constructor);
Handle<JSObject> instance_proto(
JSObject::cast(instance_constructor->instance_prototype()));
JSObject::cast(instance_constructor->instance_prototype()), isolate);
i::Handle<i::Map> instance_map = isolate->factory()->NewMap(
i::WASM_INSTANCE_TYPE, WasmInstanceObject::kSize);
JSFunction::SetInitialMap(instance_constructor, instance_map, instance_proto);
@ -1409,7 +1410,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_table_constructor(*table_constructor);
JSFunction::EnsureHasInitialMap(table_constructor);
Handle<JSObject> table_proto(
JSObject::cast(table_constructor->instance_prototype()));
JSObject::cast(table_constructor->instance_prototype()), isolate);
i::Handle<i::Map> table_map =
isolate->factory()->NewMap(i::WASM_TABLE_TYPE, WasmTableObject::kSize);
JSFunction::SetInitialMap(table_constructor, table_map, table_proto);
@ -1426,7 +1427,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_memory_constructor(*memory_constructor);
JSFunction::EnsureHasInitialMap(memory_constructor);
Handle<JSObject> memory_proto(
JSObject::cast(memory_constructor->instance_prototype()));
JSObject::cast(memory_constructor->instance_prototype()), isolate);
i::Handle<i::Map> memory_map =
isolate->factory()->NewMap(i::WASM_MEMORY_TYPE, WasmMemoryObject::kSize);
JSFunction::SetInitialMap(memory_constructor, memory_map, memory_proto);
@ -1442,7 +1443,7 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
context->set_wasm_global_constructor(*global_constructor);
JSFunction::EnsureHasInitialMap(global_constructor);
Handle<JSObject> global_proto(
JSObject::cast(global_constructor->instance_prototype()));
JSObject::cast(global_constructor->instance_prototype()), isolate);
i::Handle<i::Map> global_map = isolate->factory()->NewMap(
i::WASM_GLOBAL_TYPE, WasmGlobalObject::kSize);
JSFunction::SetInitialMap(global_constructor, global_map, global_proto);
@ -1457,17 +1458,17 @@ void WasmJs::Install(Isolate* isolate, bool exposed_on_global_object) {
// Setup errors
attributes = static_cast<PropertyAttributes>(DONT_ENUM);
Handle<JSFunction> compile_error(
isolate->native_context()->wasm_compile_error_function());
isolate->native_context()->wasm_compile_error_function(), isolate);
JSObject::AddProperty(isolate, webassembly,
isolate->factory()->CompileError_string(),
compile_error, attributes);
Handle<JSFunction> link_error(
isolate->native_context()->wasm_link_error_function());
isolate->native_context()->wasm_link_error_function(), isolate);
JSObject::AddProperty(isolate, webassembly,
isolate->factory()->LinkError_string(), link_error,
attributes);
Handle<JSFunction> runtime_error(
isolate->native_context()->wasm_runtime_error_function());
isolate->native_context()->wasm_runtime_error_function(), isolate);
JSObject::AddProperty(isolate, webassembly,
isolate->factory()->RuntimeError_string(),
runtime_error, attributes);

View File

@ -235,7 +235,8 @@ class CompiledModuleInstancesIterator
v8::base::iterator_range<CompiledModuleInstancesIterator>
iterate_compiled_module_instance_chain(Isolate* isolate,
Handle<WasmModuleObject> module_object) {
Handle<WasmCompiledModule> compiled_module(module_object->compiled_module());
Handle<WasmCompiledModule> compiled_module(module_object->compiled_module(),
isolate);
return {CompiledModuleInstancesIterator(isolate, compiled_module, false),
CompiledModuleInstancesIterator(isolate, compiled_module, true)};
}
@ -290,7 +291,7 @@ Handle<WasmModuleObject> WasmModuleObject::New(
// Now create the {WasmModuleObject}.
Handle<JSFunction> module_cons(
isolate->native_context()->wasm_module_constructor());
isolate->native_context()->wasm_module_constructor(), isolate);
auto module_object = Handle<WasmModuleObject>::cast(
isolate->factory()->NewJSObject(module_cons));
module_object->set_compiled_module(*compiled_module);
@ -826,7 +827,7 @@ Handle<WasmTableObject> WasmTableObject::New(Isolate* isolate, uint32_t initial,
int64_t maximum,
Handle<FixedArray>* js_functions) {
Handle<JSFunction> table_ctor(
isolate->native_context()->wasm_table_constructor());
isolate->native_context()->wasm_table_constructor(), isolate);
auto table_obj = Handle<WasmTableObject>::cast(
isolate->factory()->NewJSObject(table_ctor));
@ -848,7 +849,7 @@ void WasmTableObject::AddDispatchTable(Isolate* isolate,
Handle<WasmTableObject> table_obj,
Handle<WasmInstanceObject> instance,
int table_index) {
Handle<FixedArray> dispatch_tables(table_obj->dispatch_tables());
Handle<FixedArray> dispatch_tables(table_obj->dispatch_tables(), isolate);
int old_length = dispatch_tables->length();
DCHECK_EQ(0, old_length % kDispatchTableNumElements);
@ -871,7 +872,7 @@ void WasmTableObject::AddDispatchTable(Isolate* isolate,
void WasmTableObject::Grow(Isolate* isolate, uint32_t count) {
if (count == 0) return; // Degenerate case: nothing to do.
Handle<FixedArray> dispatch_tables(this->dispatch_tables());
Handle<FixedArray> dispatch_tables(this->dispatch_tables(), isolate);
DCHECK_EQ(0, dispatch_tables->length() % kDispatchTableNumElements);
uint32_t old_size = functions()->length();
@ -904,7 +905,8 @@ void WasmTableObject::Set(Isolate* isolate, Handle<WasmTableObject> table,
// TODO(titzer): Change this to MaybeHandle<WasmExportedFunction>
DCHECK(WasmExportedFunction::IsWasmExportedFunction(*function));
auto exported_function = Handle<WasmExportedFunction>::cast(function);
Handle<WasmInstanceObject> other_instance(exported_function->instance());
Handle<WasmInstanceObject> other_instance(exported_function->instance(),
isolate);
int func_index = exported_function->function_index();
auto* wasm_function = &other_instance->module()->functions[func_index];
DCHECK_NOT_NULL(wasm_function);
@ -1054,7 +1056,7 @@ Handle<WasmMemoryObject> WasmMemoryObject::New(
// that the memory will match the style of the compiled wasm module.
// See issue v8:7143
Handle<JSFunction> memory_ctor(
isolate->native_context()->wasm_memory_constructor());
isolate->native_context()->wasm_memory_constructor(), isolate);
auto memory_obj = Handle<WasmMemoryObject>::cast(
isolate->factory()->NewJSObject(memory_ctor, TENURED));
@ -1130,7 +1132,7 @@ void WasmMemoryObject::RemoveInstance(Isolate* isolate,
int32_t WasmMemoryObject::Grow(Isolate* isolate,
Handle<WasmMemoryObject> memory_object,
uint32_t pages) {
Handle<JSArrayBuffer> old_buffer(memory_object->array_buffer());
Handle<JSArrayBuffer> old_buffer(memory_object->array_buffer(), isolate);
if (!old_buffer->is_growable()) return -1;
uint32_t old_size = 0;
CHECK(old_buffer->byte_length()->ToUint32(&old_size));
@ -1167,7 +1169,7 @@ MaybeHandle<WasmGlobalObject> WasmGlobalObject::New(
Isolate* isolate, MaybeHandle<JSArrayBuffer> maybe_buffer,
wasm::ValueType type, int32_t offset, bool is_mutable) {
Handle<JSFunction> global_ctor(
isolate->native_context()->wasm_global_constructor());
isolate->native_context()->wasm_global_constructor(), isolate);
auto global_obj = Handle<WasmGlobalObject>::cast(
isolate->factory()->NewJSObject(global_ctor));
@ -1296,7 +1298,9 @@ WasmModule* WasmInstanceObject::module() { return module_object()->module(); }
Handle<WasmDebugInfo> WasmInstanceObject::GetOrCreateDebugInfo(
Handle<WasmInstanceObject> instance) {
if (instance->has_debug_info()) return handle(instance->debug_info());
if (instance->has_debug_info()) {
return handle(instance->debug_info(), instance->GetIsolate());
}
Handle<WasmDebugInfo> new_info = WasmDebugInfo::New(instance);
DCHECK(instance->has_debug_info());
return new_info;
@ -1306,7 +1310,7 @@ Handle<WasmInstanceObject> WasmInstanceObject::New(
Isolate* isolate, Handle<WasmModuleObject> module_object,
Handle<WasmCompiledModule> compiled_module) {
Handle<JSFunction> instance_cons(
isolate->native_context()->wasm_instance_constructor());
isolate->native_context()->wasm_instance_constructor(), isolate);
Handle<JSObject> instance_object =
isolate->factory()->NewJSObject(instance_cons, TENURED);
@ -1417,7 +1421,7 @@ void InstanceFinalizer(const v8::WeakCallbackInfo<void>& data) {
// Free raw C++ memory associated with the instance.
GetNativeAllocations(instance)->free();
compiled_module->RemoveFromChain();
compiled_module->RemoveFromChain(isolate);
GlobalHandles::Destroy(reinterpret_cast<Object**>(p));
TRACE("}\n");
@ -1527,9 +1531,8 @@ void WasmCompiledModule::InsertInChain(WasmModuleObject* module) {
original->set_prev_instance(this);
}
void WasmCompiledModule::RemoveFromChain() {
void WasmCompiledModule::RemoveFromChain(Isolate* isolate) {
DisallowHeapAllocation no_gc;
Isolate* isolate = GetIsolate();
Object* next = raw_next_instance();
Object* prev = raw_prev_instance();

View File

@ -578,7 +578,7 @@ class WasmCompiledModule : public Struct {
bool has_instance() const;
void InsertInChain(WasmModuleObject*);
void RemoveFromChain();
void RemoveFromChain(Isolate* isolate);
DECL_ACCESSORS(raw_next_instance, Object);
DECL_ACCESSORS(raw_prev_instance, Object);

View File

@ -133,11 +133,12 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
FunctionTester f(graph, param_count);
p = *f.function;
}
return Handle<JSFunction>(p); // allocated in outer handle scope.
return Handle<JSFunction>(
p, p->GetIsolate()); // allocated in outer handle scope.
}
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
Zone zone(isolate->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, isolate, shared, function);
@ -161,7 +162,7 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
// Compile the given machine graph instead of the source of the function
// and replace the JSFunction's code with the result.
Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) {
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), isolate);
Zone zone(isolate->allocator(), ZONE_NAME);
OptimizedCompilationInfo info(&zone, isolate, shared, function);

View File

@ -181,7 +181,7 @@ TEST(ReduceJSLoadContext1) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()));
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
@ -251,7 +251,7 @@ TEST(ReduceJSLoadContext2) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()));
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
@ -342,7 +342,8 @@ TEST(ReduceJSLoadContext3) {
Node* start = t.graph()->NewNode(t.common()->Start(2));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()));
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()),
handle_zone_scope.main_isolate());
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
@ -468,7 +469,7 @@ TEST(ReduceJSStoreContext1) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()));
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
@ -512,7 +513,7 @@ TEST(ReduceJSStoreContext2) {
Node* start = t.graph()->NewNode(t.common()->Start(0));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()));
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()), t.main_isolate());
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);
@ -577,7 +578,8 @@ TEST(ReduceJSStoreContext3) {
Node* start = t.graph()->NewNode(t.common()->Start(2));
t.graph()->SetStart(start);
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()));
Handle<ScopeInfo> empty(ScopeInfo::Empty(t.main_isolate()),
handle_zone_scope.main_isolate());
const i::compiler::Operator* create_function_context =
t.javascript()->CreateFunctionContext(empty, 42, FUNCTION_SCOPE);

View File

@ -47,7 +47,7 @@ static Handle<JSFunction> Compile(const char* source) {
TEST(TestLinkageCreate) {
HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + b");
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), handles.main_isolate());
OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(),
shared, function);
auto call_descriptor = Linkage::ComputeIncoming(info.zone(), &info);
@ -64,7 +64,8 @@ TEST(TestLinkageJSFunctionIncoming) {
Handle<JSFunction> function =
Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast(CompileRun(sources[i]))));
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(),
handles.main_isolate());
OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(),
shared, function);
auto call_descriptor = Linkage::ComputeIncoming(info.zone(), &info);
@ -81,7 +82,7 @@ TEST(TestLinkageJSFunctionIncoming) {
TEST(TestLinkageJSCall) {
HandleAndZoneScope handles;
Handle<JSFunction> function = Compile("a + c");
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), handles.main_isolate());
OptimizedCompilationInfo info(handles.main_zone(), function->GetIsolate(),
shared, function);

View File

@ -118,14 +118,14 @@ class BytecodeGraphTester {
CHECK(function->shared()->HasBytecodeArray());
Zone zone(isolate_->allocator(), ZONE_NAME);
Handle<SharedFunctionInfo> shared(function->shared());
Handle<SharedFunctionInfo> shared(function->shared(), isolate_);
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();
compilation_info.ReopenHandlesInNewHandleScope(isolate_);
Handle<Code> code =
Pipeline::GenerateCodeForTesting(&compilation_info, isolate_)

View File

@ -166,7 +166,8 @@ TEST(RuntimeCallInline) {
TEST(EvalCall) {
FunctionTester T("(function(a,b) { return eval(a); })");
Handle<JSObject> g(T.function->context()->global_object()->global_proxy());
Handle<JSObject> g(T.function->context()->global_object()->global_proxy(),
T.isolate);
T.CheckCall(T.Val(23), T.Val("17 + 6"), T.undefined());
T.CheckCall(T.Val("'Y'; a"), T.Val("'Y'; a"), T.Val("b-val"));
@ -190,7 +191,8 @@ TEST(ReceiverPatching) {
// patches an undefined receiver to the global receiver. If this starts to
// fail once we fix the calling protocol, just remove this test.
FunctionTester T("(function(a) { return this; })");
Handle<JSObject> g(T.function->context()->global_object()->global_proxy());
Handle<JSObject> g(T.function->context()->global_object()->global_proxy(),
T.isolate);
T.CheckCall(g, T.undefined());
}

View File

@ -46,14 +46,16 @@ class StubTester {
graph_(zone_),
common_(zone_),
tester_(InitializeFunctionTester(
Handle<Code>(isolate->builtins()->builtin(name))),
Handle<Code>(isolate->builtins()->builtin(name), isolate)),
GetParameterCountWithContext()) {}
template <typename... Args>
Handle<Object> Call(Args... args) {
DCHECK_EQ(interface_descriptor_.GetParameterCount(), sizeof...(args));
MaybeHandle<Object> result =
tester_.Call(args..., Handle<HeapObject>(tester_.function->context()))
tester_
.Call(args...,
Handle<HeapObject>(tester_.function->context(), ft().isolate))
.ToHandleChecked();
return result.ToHandleChecked();
}

View File

@ -139,8 +139,9 @@ TEST(StressJS) {
factory->NewJSObject(function);
// Patch the map to have an accessor for "get".
Handle<Map> map(function->initial_map());
Handle<DescriptorArray> instance_descriptors(map->instance_descriptors());
Handle<Map> map(function->initial_map(), isolate);
Handle<DescriptorArray> instance_descriptors(map->instance_descriptors(),
isolate);
CHECK_EQ(0, instance_descriptors->number_of_descriptors());
PropertyAttributes attrs = NONE;
@ -148,7 +149,7 @@ TEST(StressJS) {
Map::EnsureDescriptorSlack(isolate, map, 1);
Descriptor d = Descriptor::AccessorConstant(
Handle<Name>(Name::cast(foreign->name())), foreign, attrs);
Handle<Name>(Name::cast(foreign->name()), isolate), foreign, attrs);
map->AppendDescriptor(&d);
// Add the Foo constructor the global object.

View File

@ -220,7 +220,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) {
bool in_place = true;
Handle<FixedArray> current = root_array;
while (current->get(0) != heap->undefined_value()) {
current = Handle<FixedArray>(FixedArray::cast(current->get(0)));
current =
Handle<FixedArray>(FixedArray::cast(current->get(0)), isolate);
CHECK(current->IsFixedArray());
if (Page::FromAddress(current->address()) != to_be_aborted_page) {
in_place = false;
@ -314,7 +315,8 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
bool in_place = true;
Handle<FixedArray> current = root_array;
while (current->get(0) != heap->undefined_value()) {
current = Handle<FixedArray>(FixedArray::cast(current->get(0)));
current =
Handle<FixedArray>(FixedArray::cast(current->get(0)), isolate);
CHECK(!heap->InNewSpace(*current));
CHECK(current->IsFixedArray());
if (Page::FromAddress(current->address()) != to_be_aborted_page) {

View File

@ -90,12 +90,14 @@ static void VerifyStoredPrototypeMap(Isolate* isolate,
int stored_ctor_context_index) {
Handle<Context> context = isolate->native_context();
Handle<Map> this_map(Map::cast(context->get(stored_map_context_index)));
Handle<Map> this_map(Map::cast(context->get(stored_map_context_index)),
isolate);
Handle<JSFunction> fun(
JSFunction::cast(context->get(stored_ctor_context_index)));
Handle<JSObject> proto(JSObject::cast(fun->initial_map()->prototype()));
Handle<Map> that_map(proto->map());
JSFunction::cast(context->get(stored_ctor_context_index)), isolate);
Handle<JSObject> proto(JSObject::cast(fun->initial_map()->prototype()),
isolate);
Handle<Map> that_map(proto->map(), isolate);
CHECK(proto->HasFastProperties());
CHECK_EQ(*this_map, *that_map);
@ -309,8 +311,8 @@ TEST(HeapObjects) {
CHECK_EQ(10, s->length());
Handle<String> object_string = Handle<String>::cast(factory->Object_string());
Handle<JSGlobalObject> global(
CcTest::i_isolate()->context()->global_object());
Handle<JSGlobalObject> global(CcTest::i_isolate()->context()->global_object(),
isolate);
CHECK(Just(true) == JSReceiver::HasOwnProperty(global, object_string));
// Check ToString for oddballs
@ -349,8 +351,8 @@ TEST(GarbageCollection) {
// Check GC.
CcTest::CollectGarbage(NEW_SPACE);
Handle<JSGlobalObject> global(
CcTest::i_isolate()->context()->global_object());
Handle<JSGlobalObject> global(CcTest::i_isolate()->context()->global_object(),
isolate);
Handle<String> name = factory->InternalizeUtf8String("theFunction");
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<String> prop_namex = factory->InternalizeUtf8String("theSlotx");
@ -954,7 +956,8 @@ TEST(ObjectProperties) {
Factory* factory = isolate->factory();
v8::HandleScope sc(CcTest::isolate());
Handle<String> object_string(String::cast(CcTest::heap()->Object_string()));
Handle<String> object_string(String::cast(CcTest::heap()->Object_string()),
isolate);
Handle<Object> object = Object::GetProperty(
CcTest::i_isolate()->global_object(), object_string).ToHandleChecked();
Handle<JSFunction> constructor = Handle<JSFunction>::cast(object);
@ -1034,7 +1037,7 @@ TEST(JSObjectMaps) {
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<JSObject> obj = factory->NewJSObject(function);
Handle<Map> initial_map(function->initial_map());
Handle<Map> initial_map(function->initial_map(), isolate);
// Set a propery
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
@ -1107,7 +1110,8 @@ TEST(JSObjectCopy) {
Factory* factory = isolate->factory();
v8::HandleScope sc(CcTest::isolate());
Handle<String> object_string(String::cast(CcTest::heap()->Object_string()));
Handle<String> object_string(String::cast(CcTest::heap()->Object_string()),
isolate);
Handle<Object> object = Object::GetProperty(
CcTest::i_isolate()->global_object(), object_string).ToHandleChecked();
Handle<JSFunction> constructor = Handle<JSFunction>::cast(object);
@ -1254,7 +1258,8 @@ TEST(Iteration) {
delete[] str;
// Add a Map object to look for.
objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map());
objs[next_objs_index++] =
Handle<Map>(HeapObject::cast(*objs[0])->map(), isolate);
CHECK_EQ(objs_count, next_objs_index);
CHECK_EQ(objs_count, ObjectsFoundInHeap(CcTest::heap(), objs, objs_count));
@ -3057,7 +3062,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), f->GetIsolate());
FeedbackVectorHelper feedback_helper(feedback_vector);
int expected_slots = 2;
@ -3077,7 +3082,8 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) {
static void CheckVectorIC(Handle<JSFunction> f, int slot_index,
InlineCacheState desired_state) {
Handle<FeedbackVector> vector = Handle<FeedbackVector>(f->feedback_vector());
Handle<FeedbackVector> vector =
Handle<FeedbackVector>(f->feedback_vector(), f->GetIsolate());
FeedbackVectorHelper helper(vector);
FeedbackSlot slot = helper.slot(slot_index);
FeedbackNexus nexus(vector, slot);
@ -3099,7 +3105,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast(
CcTest::global()->Get(ctx, v8_str("f")).ToLocalChecked())));
Handle<FeedbackVector> vector(f->feedback_vector());
Handle<FeedbackVector> vector(f->feedback_vector(), f->GetIsolate());
CHECK(vector->Get(FeedbackSlot(0))->IsWeakOrClearedHeapObject());
heap::SimulateIncrementalMarking(CcTest::heap());
@ -3727,7 +3733,7 @@ TEST(CellsInOptimizedCodeAreWeak) {
*v8::Local<v8::Function>::Cast(CcTest::global()
->Get(context.local(), v8_str("bar"))
.ToLocalChecked())));
code = scope.CloseAndEscape(Handle<Code>(bar->code()));
code = scope.CloseAndEscape(Handle<Code>(bar->code(), isolate));
}
// Now make sure that a gc should get rid of the function
@ -3769,7 +3775,7 @@ TEST(ObjectsInOptimizedCodeAreWeak) {
*v8::Local<v8::Function>::Cast(CcTest::global()
->Get(context.local(), v8_str("bar"))
.ToLocalChecked())));
code = scope.CloseAndEscape(Handle<Code>(bar->code()));
code = scope.CloseAndEscape(Handle<Code>(bar->code(), isolate));
}
// Now make sure that a gc should get rid of the function
@ -3830,7 +3836,7 @@ TEST(NewSpaceObjectsInOptimizedCode) {
heap->Verify();
#endif
CHECK(!bar->code()->marked_for_deoptimization());
code = scope.CloseAndEscape(Handle<Code>(bar->code()));
code = scope.CloseAndEscape(Handle<Code>(bar->code(), isolate));
}
// Now make sure that a gc should get rid of the function
@ -3890,7 +3896,7 @@ TEST(NextCodeLinkIsWeak) {
CHECK_EQ(immortal->code()->next_code_link(), mortal->code());
code_chain_length_before = GetCodeChainLength(immortal->code());
// Keep the immortal code and let the mortal code die.
code = scope.CloseAndEscape(Handle<Code>(immortal->code()));
code = scope.CloseAndEscape(Handle<Code>(immortal->code(), isolate));
CompileRun("mortal = null; immortal = null;");
}
CcTest::CollectAllAvailableGarbage();
@ -3916,8 +3922,8 @@ TEST(NextCodeLinkInCodeDataContainerIsCleared) {
Handle<JSFunction> mortal2 =
OptimizeDummyFunction(CcTest::isolate(), "mortal2");
CHECK_EQ(mortal2->code()->next_code_link(), mortal1->code());
code_data_container = scope.CloseAndEscape(
Handle<CodeDataContainer>(mortal2->code()->code_data_container()));
code_data_container = scope.CloseAndEscape(Handle<CodeDataContainer>(
mortal2->code()->code_data_container(), isolate));
CompileRun("mortal1 = null; mortal2 = null;");
}
CcTest::CollectAllAvailableGarbage();
@ -4606,7 +4612,8 @@ TEST(Regress3631) {
// Incrementally mark the backing store.
Handle<JSReceiver> obj =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj));
Handle<JSWeakCollection> weak_map(reinterpret_cast<JSWeakCollection*>(*obj),
isolate);
HeapObject* weak_map_table = HeapObject::cast(weak_map->table());
IncrementalMarking::MarkingState* marking_state = marking->marking_state();
while (!marking_state->IsBlack(weak_map_table) && !marking->IsStopped()) {
@ -4631,8 +4638,8 @@ TEST(Regress442710) {
Factory* factory = isolate->factory();
HandleScope sc(isolate);
Handle<JSGlobalObject> global(
CcTest::i_isolate()->context()->global_object());
Handle<JSGlobalObject> global(CcTest::i_isolate()->context()->global_object(),
isolate);
Handle<JSArray> array = factory->NewJSArray(2);
Handle<String> name = factory->InternalizeUtf8String("testArray");
@ -5291,7 +5298,7 @@ TEST(Regress598319) {
// bar, meaning that we will miss marking it.
v8::HandleScope scope(CcTest::isolate());
Handle<JSArray> js_array = isolate->factory()->NewJSArrayWithElements(
Handle<FixedArray>(arr.get()));
Handle<FixedArray>(arr.get(), isolate));
js_array->GetElementsAccessor()->Shift(js_array);
}
break;

View File

@ -137,7 +137,7 @@ HEAP_TEST(MarkCompactCollector) {
Factory* factory = isolate->factory();
v8::HandleScope sc(CcTest::isolate());
Handle<JSGlobalObject> global(isolate->context()->global_object());
Handle<JSGlobalObject> global(isolate->context()->global_object(), isolate);
// call mark-compact when heap is empty
CcTest::CollectGarbage(OLD_SPACE);

View File

@ -434,7 +434,7 @@ TEST(WeakArrayListBasic) {
Heap* heap = isolate->heap();
HandleScope outer_scope(isolate);
Handle<WeakArrayList> array(heap->empty_weak_array_list());
Handle<WeakArrayList> array(heap->empty_weak_array_list(), isolate);
CHECK(array->IsWeakArrayList());
CHECK(!array->IsFixedArray());
CHECK(!array->IsWeakFixedArray());

View File

@ -30,8 +30,8 @@ void GetTopLevelFunctionInfo(
// Get the v8::internal::Script object from the API v8::Script.
// The API object 'wraps' the compiled top-level function, not the i::Script.
Handle<JSFunction> toplevel_fn = v8::Utils::OpenHandle(*script);
Handle<Script> i_script =
handle(Script::cast(toplevel_fn->shared()->script()));
Handle<Script> i_script = handle(
Script::cast(toplevel_fn->shared()->script()), toplevel_fn->GetIsolate());
SharedFunctionInfo::ScriptIterator iterator(i_script);
while (SharedFunctionInfo* shared = iterator.Next()) {

View File

@ -740,7 +740,7 @@ TEST(PreParserScopeAnalysis) {
CHECK(shared->HasPreParsedScopeData());
i::Handle<i::PreParsedScopeData> produced_data_on_heap(
i::PreParsedScopeData::cast(shared->preparsed_scope_data()));
i::PreParsedScopeData::cast(shared->preparsed_scope_data()), isolate);
// Parse the lazy function using the scope data.
i::ParseInfo using_scope_data(isolate, shared);

View File

@ -1334,7 +1334,8 @@ THREADED_TEST(InterceptorLoadGlobalICGlobalWithInterceptor) {
v8::Utils::OpenHandle<Object, i::JSReceiver>(context->Global());
CHECK(global_proxy->IsJSGlobalProxy());
i::Handle<i::JSGlobalObject> global(
i::JSGlobalObject::cast(global_proxy->map()->prototype()));
i::JSGlobalObject::cast(global_proxy->map()->prototype()),
global_proxy->GetIsolate());
CHECK(global->map()->has_named_interceptor());
v8::Local<Value> value = CompileRun(
@ -1397,7 +1398,8 @@ THREADED_TEST(InterceptorLoadICGlobalWithInterceptor) {
v8::Utils::OpenHandle<Object, i::JSReceiver>(context->Global());
CHECK(global_proxy->IsJSGlobalProxy());
i::Handle<i::JSGlobalObject> global(
i::JSGlobalObject::cast(global_proxy->map()->prototype()));
i::JSGlobalObject::cast(global_proxy->map()->prototype()),
global_proxy->GetIsolate());
CHECK(global->map()->has_named_interceptor());
ExpectInt32(
@ -2944,7 +2946,8 @@ void SloppyArgsIndexedPropertyEnumerator(
// Have to populate the handle manually, as it's not Cast-able.
i::Handle<i::JSReceiver> o =
v8::Utils::OpenHandle<Object, i::JSReceiver>(result);
i::Handle<i::JSArray> array(reinterpret_cast<i::JSArray*>(*o));
i::Handle<i::JSArray> array(reinterpret_cast<i::JSArray*>(*o),
o->GetIsolate());
info.GetReturnValue().Set(v8::Utils::ToLocal(array));
}

View File

@ -16680,8 +16680,9 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context,
CHECK(result->BooleanValue(context).FromJust());
}
i::Handle<ExternalArrayClass> array(ExternalArrayClass::cast(
i::Handle<i::JSObject>::cast(jsobj)->elements()));
i::Handle<ExternalArrayClass> array(
ExternalArrayClass::cast(i::Handle<i::JSObject>::cast(jsobj)->elements()),
isolate);
for (int i = 0; i < element_count; i++) {
array->set(i, static_cast<ElementType>(i));
}
@ -16771,7 +16772,7 @@ static void FixedTypedArrayTestHelper(i::ExternalArrayType array_type,
i::Handle<i::JSTypedArray> jsobj =
factory->NewJSTypedArray(elements_kind, kElementCount);
i::Handle<FixedTypedArrayClass> fixed_array(
FixedTypedArrayClass::cast(jsobj->elements()));
FixedTypedArrayClass::cast(jsobj->elements()), isolate);
CHECK_EQ(FixedTypedArrayClass::kInstanceType,
fixed_array->map()->instance_type());
CHECK_EQ(kElementCount, fixed_array->length());
@ -17489,7 +17490,7 @@ TEST(ErrorLevelWarning) {
i::Handle<i::SharedFunctionInfo> obj = i::Handle<i::SharedFunctionInfo>::cast(
v8::Utils::OpenHandle(*lscript->GetUnboundScript()));
CHECK(obj->script()->IsScript());
i::Handle<i::Script> script(i::Script::cast(obj->script()));
i::Handle<i::Script> script(i::Script::cast(obj->script()), i_isolate);
int levels[] = {
v8::Isolate::kMessageLog, v8::Isolate::kMessageInfo,

View File

@ -15,8 +15,8 @@ TEST(ArrayList) {
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope scope(isolate);
Handle<ArrayList> array(
ArrayList::cast(isolate->heap()->empty_fixed_array()));
Handle<ArrayList> array(ArrayList::cast(isolate->heap()->empty_fixed_array()),
isolate);
CHECK_EQ(0, array->Length());
array = ArrayList::Add(array, handle(Smi::FromInt(100), isolate));
CHECK_EQ(1, array->Length());

View File

@ -906,7 +906,8 @@ TEST(TransitionLookup) {
CHECK(root_map->raw_transitions()->ToStrongHeapObject()->IsTransitionArray());
Handle<TransitionArray> transitions(
TransitionArray::cast(root_map->raw_transitions()->ToStrongHeapObject()));
TransitionArray::cast(root_map->raw_transitions()->ToStrongHeapObject()),
isolate);
DCHECK(transitions->IsSortedNoDuplicates(isolate));
// Ensure we didn't overflow transition array and therefore all the
@ -2554,7 +2555,7 @@ TEST(NewPromiseCapability) {
handle(JSFunction::cast(result->reject()), isolate)};
for (auto&& callback : callbacks) {
Handle<Context> context(Context::cast(callback->context()));
Handle<Context> context(Context::cast(callback->context()), isolate);
CHECK_EQ(isolate->native_context()->scope_info(), context->scope_info());
CHECK_EQ(isolate->heap()->the_hole_value(), context->extension());
CHECK_EQ(*isolate->native_context(), context->native_context());
@ -2597,7 +2598,7 @@ TEST(NewPromiseCapability) {
Handle<PromiseCapability>::cast(result_obj);
CHECK(result->promise()->IsJSObject());
Handle<JSObject> promise(JSObject::cast(result->promise()));
Handle<JSObject> promise(JSObject::cast(result->promise()), isolate);
CHECK_EQ(constructor_fn->prototype_or_initial_map(), promise->map());
CHECK(result->resolve()->IsJSFunction());
CHECK(result->reject()->IsJSFunction());
@ -2817,7 +2818,8 @@ TEST(LoadJSArrayElementsMap) {
ft.CallChecked<Map>(handle(Smi::FromInt(kind), isolate));
ElementsKind elements_kind = static_cast<ElementsKind>(kind);
Handle<Map> result(
isolate->native_context()->GetInitialJSArrayMap(elements_kind));
isolate->native_context()->GetInitialJSArrayMap(elements_kind),
isolate);
CHECK_EQ(*csa_result, *result);
}
}

View File

@ -53,7 +53,7 @@ static void SetGlobalProperty(const char* name, Object* value) {
Handle<Object> object(value, isolate);
Handle<String> internalized_name =
isolate->factory()->InternalizeUtf8String(name);
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Runtime::SetObjectProperty(isolate, global, internalized_name, object,
LanguageMode::kSloppy)
.Check();
@ -83,7 +83,7 @@ static double Inc(Isolate* isolate, int x) {
Handle<JSFunction> fun = Compile(buffer.start());
if (fun.is_null()) return -1;
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Execution::Call(isolate, fun, global, 0, nullptr).Check();
return GetGlobalProperty("result")->Number();
}
@ -102,7 +102,7 @@ static double Add(Isolate* isolate, int x, int y) {
SetGlobalProperty("x", Smi::FromInt(x));
SetGlobalProperty("y", Smi::FromInt(y));
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Execution::Call(isolate, fun, global, 0, nullptr).Check();
return GetGlobalProperty("result")->Number();
}
@ -120,7 +120,7 @@ static double Abs(Isolate* isolate, int x) {
if (fun.is_null()) return -1;
SetGlobalProperty("x", Smi::FromInt(x));
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Execution::Call(isolate, fun, global, 0, nullptr).Check();
return GetGlobalProperty("result")->Number();
}
@ -139,7 +139,7 @@ static double Sum(Isolate* isolate, int n) {
if (fun.is_null()) return -1;
SetGlobalProperty("n", Smi::FromInt(n));
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Execution::Call(isolate, fun, global, 0, nullptr).Check();
return GetGlobalProperty("result")->Number();
}
@ -159,7 +159,8 @@ TEST(Print) {
const char* source = "for (n = 0; n < 100; ++n) print(n, 1, 2);";
Handle<JSFunction> fun = Compile(source);
if (fun.is_null()) return;
Handle<JSObject> global(CcTest::i_isolate()->context()->global_object());
Handle<JSObject> global(CcTest::i_isolate()->context()->global_object(),
fun->GetIsolate());
Execution::Call(CcTest::i_isolate(), fun, global, 0, nullptr).Check();
}
@ -190,7 +191,8 @@ TEST(Stuff) {
Handle<JSFunction> fun = Compile(source);
CHECK(!fun.is_null());
Handle<JSObject> global(CcTest::i_isolate()->context()->global_object());
Handle<JSObject> global(CcTest::i_isolate()->context()->global_object(),
fun->GetIsolate());
Execution::Call(CcTest::i_isolate(), fun, global, 0, nullptr).Check();
CHECK_EQ(511.0, GetGlobalProperty("r")->Number());
}
@ -204,7 +206,7 @@ TEST(UncaughtThrow) {
Handle<JSFunction> fun = Compile(source);
CHECK(!fun.is_null());
Isolate* isolate = fun->GetIsolate();
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
CHECK(Execution::Call(isolate, fun, global, 0, nullptr).is_null());
CHECK_EQ(42.0, isolate->pending_exception()->Number());
}
@ -230,7 +232,7 @@ TEST(C2JSFrames) {
Isolate* isolate = fun0->GetIsolate();
// Run the generated code to populate the global object with 'foo'.
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Execution::Call(isolate, fun0, global, 0, nullptr).Check();
Handle<Object> fun1 =
@ -309,7 +311,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) {
CcTest::global()->Get(context, v8_str("f")).ToLocalChecked())));
// Verify that we gathered feedback.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), f->GetIsolate());
CHECK(!feedback_vector->is_empty());
FeedbackSlot slot_for_a(0);
MaybeObject* object = feedback_vector->Get(slot_for_a);

View File

@ -72,7 +72,7 @@ static v8::Local<v8::Function> CompileFunction(LocalContext* env,
static bool HasBreakInfo(v8::Local<v8::Function> fun) {
Handle<v8::internal::JSFunction> f =
Handle<v8::internal::JSFunction>::cast(v8::Utils::OpenHandle(*fun));
Handle<v8::internal::SharedFunctionInfo> shared(f->shared());
Handle<v8::internal::SharedFunctionInfo> shared(f->shared(), f->GetIsolate());
return shared->HasBreakInfo();
}
@ -2685,7 +2685,8 @@ TEST(PauseInScript) {
// Set breakpoint in the script.
i::Handle<i::Script> i_script(
i::Script::cast(v8::Utils::OpenHandle(*script)->shared()->script()));
i::Script::cast(v8::Utils::OpenHandle(*script)->shared()->script()),
isolate);
i::Handle<i::String> condition = isolate->factory()->empty_string();
int position = 0;
int id;
@ -3834,13 +3835,13 @@ TEST(BreakLocationIterator) {
"f");
Handle<i::Object> function_obj = v8::Utils::OpenHandle(*result);
Handle<i::JSFunction> function = Handle<i::JSFunction>::cast(function_obj);
Handle<i::SharedFunctionInfo> shared(function->shared());
Handle<i::SharedFunctionInfo> shared(function->shared(), i_isolate);
EnableDebugger(isolate);
CHECK(i_isolate->debug()->EnsureBreakInfo(shared));
i_isolate->debug()->PrepareFunctionForDebugExecution(shared);
Handle<i::DebugInfo> debug_info(shared->GetDebugInfo());
Handle<i::DebugInfo> debug_info(shared->GetDebugInfo(), i_isolate);
{
i::BreakIterator iterator(debug_info);

View File

@ -77,7 +77,7 @@ TEST(JSObjectAddingProperties) {
Handle<Object> value(Smi::FromInt(42), isolate);
Handle<JSObject> object = factory->NewJSObject(function);
Handle<Map> previous_map(object->map());
Handle<Map> previous_map(object->map(), isolate);
CHECK_EQ(HOLEY_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(isolate, object->property_array(), empty_property_array));
CHECK(EQUALS(isolate, object->elements(), empty_fixed_array));
@ -110,7 +110,7 @@ TEST(JSObjectInObjectAddingProperties) {
Handle<Object> value(Smi::FromInt(42), isolate);
Handle<JSObject> object = factory->NewJSObject(function);
Handle<Map> previous_map(object->map());
Handle<Map> previous_map(object->map(), isolate);
CHECK_EQ(HOLEY_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(isolate, object->property_array(), empty_property_array));
CHECK(EQUALS(isolate, object->elements(), empty_fixed_array));
@ -155,7 +155,7 @@ TEST(JSObjectAddingElements) {
Handle<Object> value(Smi::FromInt(42), isolate);
Handle<JSObject> object = factory->NewJSObject(function);
Handle<Map> previous_map(object->map());
Handle<Map> previous_map(object->map(), isolate);
CHECK_EQ(HOLEY_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(isolate, object->property_array(), empty_property_array));
CHECK(EQUALS(isolate, object->elements(), empty_fixed_array));
@ -208,7 +208,7 @@ TEST(JSArrayAddingProperties) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
Handle<Map> previous_map(array->map(), isolate);
CHECK_EQ(PACKED_SMI_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(isolate, array->property_array(), empty_property_array));
CHECK(EQUALS(isolate, array->elements(), empty_fixed_array));
@ -241,7 +241,7 @@ TEST(JSArrayAddingElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
Handle<Map> previous_map(array->map(), isolate);
CHECK_EQ(PACKED_SMI_ELEMENTS, previous_map->elements_kind());
CHECK(EQUALS(isolate, array->property_array(), empty_property_array));
CHECK(EQUALS(isolate, array->elements(), empty_fixed_array));
@ -301,7 +301,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastSmiElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
Handle<Map> previous_map(array->map(), isolate);
CHECK_EQ(PACKED_SMI_ELEMENTS, previous_map->elements_kind());
CHECK_EQ(0, Smi::ToInt(array->length()));
@ -374,7 +374,7 @@ TEST(JSArrayAddingElementsGeneralizingFastElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::PACKED_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
Handle<Map> previous_map(array->map(), isolate);
CHECK_EQ(PACKED_ELEMENTS, previous_map->elements_kind());
CHECK_EQ(0, Smi::ToInt(array->length()));
@ -424,7 +424,7 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
Handle<JSArray> array =
factory->NewJSArray(ElementsKind::PACKED_SMI_ELEMENTS, 0, 0);
Handle<Map> previous_map(array->map());
Handle<Map> previous_map(array->map(), isolate);
// `array[0] = value_double` changes |elements_kind| to PACKED_DOUBLE_ELEMENTS
name = MakeString("0");

View File

@ -514,7 +514,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
Handle<JSFunction> f = GetFunction("testprop");
// There should be one LOAD_IC, for the load of a.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), isolate);
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(2, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof);
@ -534,7 +534,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
// There should be 1 LOAD_GLOBAL_IC to load x (in both cases), 2 CALL_ICs
// to call x and a LOAD_IC to load blue.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), isolate);
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(5, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kCall);
@ -556,7 +556,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
// There should be 1 LOAD_GLOBAL_ICs for the load of a, and one
// KEYED_LOAD_IC for the load of x[0] in the return statement.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), isolate);
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(3, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof);
@ -577,7 +577,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
// There should be 1 LOAD_GLOBAL_ICs for the load of a, and one
// KEYED_LOAD_IC for the load of x[0] in the return statement.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), isolate);
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(3, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof);
@ -598,7 +598,7 @@ TEST(ReferenceContextAllocatesNoSlots) {
// There should be 1 LOAD_GLOBAL_IC for load of a and 2 LOAD_ICs, for load
// of x.old and x.young.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), isolate);
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(7, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLoadGlobalNotInsideTypeof);
@ -629,7 +629,7 @@ TEST(VectorStoreICBasic) {
"f(a);");
Handle<JSFunction> f = GetFunction("f");
// There should be one IC slot.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), f->GetIsolate());
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(1, helper.slot_count());
FeedbackSlot slot(0);
@ -653,7 +653,7 @@ TEST(StoreOwnIC) {
"f(3);");
Handle<JSFunction> f = GetFunction("f");
// There should be one IC slot.
Handle<FeedbackVector> feedback_vector(f->feedback_vector());
Handle<FeedbackVector> feedback_vector(f->feedback_vector(), f->GetIsolate());
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(2, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLiteral);

View File

@ -2362,7 +2362,7 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) {
.ToHandleChecked();
CHECK(!map->owns_descriptors());
Handle<Symbol> frozen_symbol(map->GetHeap()->frozen_symbol());
Handle<Symbol> frozen_symbol(isolate->heap()->frozen_symbol(), isolate);
expectations.SetElementsKind(DICTIONARY_ELEMENTS);
return Map::CopyForPreventExtensions(isolate, map, NONE, frozen_symbol,
"CopyForPreventExtensions");

View File

@ -60,14 +60,14 @@ static void CheckFunctionName(v8::Local<v8::Script> script,
Handle<SharedFunctionInfo> shared_function;
if (obj->IsSharedFunctionInfo()) {
shared_function =
Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(*obj));
Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(*obj), isolate);
} else {
shared_function =
Handle<SharedFunctionInfo>(JSFunction::cast(*obj)->shared());
Handle<SharedFunctionInfo>(JSFunction::cast(*obj)->shared(), isolate);
}
Handle<Script> i_script(Script::cast(shared_function->script()));
Handle<Script> i_script(Script::cast(shared_function->script()), isolate);
CHECK(i_script->source()->IsString());
Handle<String> script_src(String::cast(i_script->source()));
Handle<String> script_src(String::cast(i_script->source()), isolate);
// Find the position of a given func source substring in the source.
int func_pos;

View File

@ -2973,7 +2973,7 @@ TEST(EmbedderGraph) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
v8::Local<v8::Value> global_object =
v8::Utils::ToLocal(i::Handle<i::JSObject>(
(isolate->context()->native_context()->global_object())));
(isolate->context()->native_context()->global_object()), isolate));
global_object_pointer = &global_object;
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
heap_profiler->AddBuildEmbedderGraphCallback(BuildEmbedderGraph, nullptr);
@ -3038,7 +3038,7 @@ TEST(EmbedderGraphMultipleCallbacks) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
v8::Local<v8::Value> global_object =
v8::Utils::ToLocal(i::Handle<i::JSObject>(
(isolate->context()->native_context()->global_object())));
(isolate->context()->native_context()->global_object()), isolate));
global_object_pointer = &global_object;
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
GraphBuildingContext context;
@ -3115,7 +3115,7 @@ TEST(EmbedderGraphWithWrapperNode) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
v8::Local<v8::Value> global_object =
v8::Utils::ToLocal(i::Handle<i::JSObject>(
(isolate->context()->native_context()->global_object())));
(isolate->context()->native_context()->global_object()), isolate));
global_object_pointer = &global_object;
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
heap_profiler->AddBuildEmbedderGraphCallback(
@ -3172,7 +3172,7 @@ TEST(EmbedderGraphWithPrefix) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
v8::Local<v8::Value> global_object =
v8::Utils::ToLocal(i::Handle<i::JSObject>(
(isolate->context()->native_context()->global_object())));
(isolate->context()->native_context()->global_object()), isolate));
global_object_pointer = &global_object;
v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
heap_profiler->AddBuildEmbedderGraphCallback(BuildEmbedderGraphWithPrefix,
@ -3668,7 +3668,8 @@ TEST(WeakReference) {
i::Handle<i::Object> obj = v8::Utils::OpenHandle(*script);
i::Handle<i::SharedFunctionInfo> shared_function =
i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared());
i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared(),
i_isolate);
i::Handle<i::FeedbackVector> fv = factory->NewFeedbackVector(shared_function);
// Create a Code.

View File

@ -715,9 +715,9 @@ TEST(CanonicalHandleScope) {
CHECK_EQ(next_handle, isolate->handle_scope_data()->next);
// Deduplicate root list items.
Handle<String> empty_string(heap->empty_string());
Handle<Map> free_space_map(heap->free_space_map());
Handle<Symbol> uninitialized_symbol(heap->uninitialized_symbol());
Handle<String> empty_string(heap->empty_string(), isolate);
Handle<Map> free_space_map(heap->free_space_map(), isolate);
Handle<Symbol> uninitialized_symbol(heap->uninitialized_symbol(), isolate);
CHECK_EQ(isolate->factory()->empty_string().location(),
empty_string.location());
CHECK_EQ(isolate->factory()->free_space_map().location(),
@ -732,13 +732,13 @@ TEST(CanonicalHandleScope) {
Handle<String> string1 =
isolate->factory()->NewStringFromAsciiChecked("test");
next_handle = isolate->handle_scope_data()->next;
Handle<HeapNumber> number2(*number1);
Handle<String> string2(*string1);
Handle<HeapNumber> number2(*number1, isolate);
Handle<String> string2(*string1, isolate);
CHECK_EQ(number1.location(), number2.location());
CHECK_EQ(string1.location(), string2.location());
CcTest::CollectAllGarbage();
Handle<HeapNumber> number3(*number2);
Handle<String> string3(*string2);
Handle<HeapNumber> number3(*number2, isolate);
Handle<String> string3(*string2, isolate);
CHECK_EQ(number1.location(), number3.location());
CHECK_EQ(string1.location(), string3.location());
// Check that no new handles have been allocated.
@ -747,23 +747,23 @@ TEST(CanonicalHandleScope) {
// Inner handle scope do not create canonical handles.
{
HandleScope inner(isolate);
Handle<HeapNumber> number4(*number1);
Handle<String> string4(*string1);
Handle<HeapNumber> number4(*number1, isolate);
Handle<String> string4(*string1, isolate);
CHECK_NE(number1.location(), number4.location());
CHECK_NE(string1.location(), string4.location());
// Nested canonical scope does not conflict with outer canonical scope,
// but does not canonicalize across scopes.
CanonicalHandleScope inner_canonical(isolate);
Handle<HeapNumber> number5(*number4);
Handle<String> string5(*string4);
Handle<HeapNumber> number5(*number4, isolate);
Handle<String> string5(*string4, isolate);
CHECK_NE(number4.location(), number5.location());
CHECK_NE(string4.location(), string5.location());
CHECK_NE(number1.location(), number5.location());
CHECK_NE(string1.location(), string5.location());
Handle<HeapNumber> number6(*number1);
Handle<String> string6(*string1);
Handle<HeapNumber> number6(*number1, isolate);
Handle<String> string6(*string1, isolate);
CHECK_NE(number4.location(), number6.location());
CHECK_NE(string4.location(), string6.location());
CHECK_NE(number1.location(), number6.location());

View File

@ -44,7 +44,7 @@ Handle<T> GetLexical(const char* name) {
Handle<String> str_name = factory->InternalizeUtf8String(name);
Handle<ScriptContextTable> script_contexts(
isolate->native_context()->script_context_table());
isolate->native_context()->script_context_table(), isolate);
ScriptContextTable::LookupResult lookup_result;
if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
@ -137,7 +137,7 @@ TEST(JSObjectBasic) {
Handle<JSObject> obj = RunI<JSObject>(new_A_script);
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
// One instance created.
CHECK_EQ(Map::kSlackTrackingCounterStart - 1,
@ -198,7 +198,7 @@ TEST(JSObjectComplex) {
Handle<JSObject> obj5 = CompileRunI<JSObject>("new A(5);");
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
// Three instances created.
CHECK_EQ(Map::kSlackTrackingCounterStart - 3,
@ -283,7 +283,7 @@ TEST(JSGeneratorObjectBasic) {
Handle<JSObject> obj = RunI<JSObject>(new_A_script);
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
// One instance created.
CHECK_EQ(Map::kSlackTrackingCounterStart - 1,
@ -359,10 +359,10 @@ TEST(SubclassBasicNoBaseClassInstances) {
Handle<JSObject> obj = RunI<JSObject>(new_B_script);
CHECK(a_func->has_initial_map());
Handle<Map> a_initial_map(a_func->initial_map());
Handle<Map> a_initial_map(a_func->initial_map(), a_func->GetIsolate());
CHECK(b_func->has_initial_map());
Handle<Map> b_initial_map(b_func->initial_map());
Handle<Map> b_initial_map(b_func->initial_map(), a_func->GetIsolate());
// Zero instances of A created.
CHECK_EQ(Map::kSlackTrackingCounterStart,
@ -454,10 +454,10 @@ TEST(SubclassBasic) {
Handle<JSObject> b_obj = RunI<JSObject>(new_B_script);
CHECK(a_func->has_initial_map());
Handle<Map> a_initial_map(a_func->initial_map());
Handle<Map> a_initial_map(a_func->initial_map(), a_func->GetIsolate());
CHECK(b_func->has_initial_map());
Handle<Map> b_initial_map(b_func->initial_map());
Handle<Map> b_initial_map(b_func->initial_map(), a_func->GetIsolate());
// One instance of a base class created.
CHECK_EQ(Map::kSlackTrackingCounterStart - 1,
@ -577,7 +577,7 @@ static void TestClassHierarchy(const std::vector<int>& hierarchy_desc, int n) {
Handle<JSObject> obj = RunI<JSObject>(new_script);
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
// If the object is slow-mode already, bail out.
if (obj->map()->is_dictionary_map()) continue;
@ -687,7 +687,7 @@ TEST(InobjectPropetiesCountOverflowInSubclass) {
Handle<JSObject> obj = RunI<JSObject>(new_script);
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
// There must be no slack left.
CHECK_EQ(JSObject::kMaxInstanceSize, obj->map()->instance_size());
@ -871,7 +871,7 @@ TEST(SlowModeSubclass) {
Handle<JSObject> obj = RunI<JSObject>(new_script);
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
// Object should go dictionary mode.
CHECK_EQ(JSObject::kHeaderSize, obj->map()->instance_size());
@ -937,7 +937,7 @@ static void TestSubclassBuiltin(const char* subclass_name,
RunI<JSObject>(new_script);
CHECK(func->has_initial_map());
Handle<Map> initial_map(func->initial_map());
Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
CHECK_EQ(instance_type, initial_map->instance_type());

View File

@ -120,7 +120,8 @@ static void TestNaN(const char *code) {
v8::Local<v8::Object> result =
v8::Local<v8::Object>::Cast(script->Run(context).ToLocalChecked());
i::Handle<i::JSReceiver> o = v8::Utils::OpenHandle(*result);
i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o));
i::Handle<i::JSArray> array1(reinterpret_cast<i::JSArray*>(*o),
o->GetIsolate());
i::FixedDoubleArray* a = i::FixedDoubleArray::cast(array1->elements());
double value = a->get_scalar(0);
CHECK(std::isnan(value) &&

View File

@ -181,9 +181,11 @@ TEST(EnumCache) {
// Creating the EnumCache for {c} will create a new EnumCache on the shared
// DescriptorArray.
Handle<EnumCache> previous_enum_cache(
a->map()->instance_descriptors()->GetEnumCache());
Handle<FixedArray> previous_keys(previous_enum_cache->keys());
Handle<FixedArray> previous_indices(previous_enum_cache->indices());
a->map()->instance_descriptors()->GetEnumCache(), a->GetIsolate());
Handle<FixedArray> previous_keys(previous_enum_cache->keys(),
a->GetIsolate());
Handle<FixedArray> previous_indices(previous_enum_cache->indices(),
a->GetIsolate());
CompileRun("var s = 0; for (let key in c) { s += c[key] };");
{
CHECK_EQ(a->map()->EnumLength(), 1);
@ -217,9 +219,9 @@ TEST(EnumCache) {
// {b} can reuse the existing EnumCache, hence we only need to set the correct
// EnumLength on the map without modifying the cache itself.
previous_enum_cache =
handle(a->map()->instance_descriptors()->GetEnumCache());
previous_keys = handle(previous_enum_cache->keys());
previous_indices = handle(previous_enum_cache->indices());
handle(a->map()->instance_descriptors()->GetEnumCache(), a->GetIsolate());
previous_keys = handle(previous_enum_cache->keys(), a->GetIsolate());
previous_indices = handle(previous_enum_cache->indices(), a->GetIsolate());
CompileRun("var s = 0; for (let key in b) { s += b[key] };");
{
CHECK_EQ(a->map()->EnumLength(), 1);

View File

@ -1206,7 +1206,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
// Extract exception from the parser.
CHECK(isolate->has_pending_exception());
i::Handle<i::JSObject> exception_handle(
i::JSObject::cast(isolate->pending_exception()));
i::JSObject::cast(isolate->pending_exception()), isolate);
i::Handle<i::String> message_string = i::Handle<i::String>::cast(
i::JSReceiver::GetProperty(isolate, exception_handle, "message")
.ToHandleChecked());
@ -6194,7 +6194,7 @@ TEST(BasicImportExportParsing) {
info.set_module();
if (!i::parsing::ParseProgram(&info, isolate)) {
i::Handle<i::JSObject> exception_handle(
i::JSObject::cast(isolate->pending_exception()));
i::JSObject::cast(isolate->pending_exception()), isolate);
i::Handle<i::String> message_string = i::Handle<i::String>::cast(
i::JSReceiver::GetProperty(isolate, exception_handle, "message")
.ToHandleChecked());

View File

@ -340,7 +340,8 @@ UNINITIALIZED_TEST(StartupSerializerRootMapDependencies) {
// platforms. So, without special measures we're risking to serialize
// object, requiring alignment before FreeSpaceMap is fully serialized.
v8::internal::Handle<Map> map(
internal_isolate->heap()->one_byte_internalized_string_map());
internal_isolate->heap()->one_byte_internalized_string_map(),
internal_isolate);
Map::WeakCellForMap(map);
// Need to avoid DCHECKs inside SnapshotCreator.
snapshot_creator.SetDefaultContext(v8::Context::New(isolate));
@ -969,7 +970,7 @@ i::Handle<i::JSArrayBuffer> GetBufferFromTypedArray(
i::Handle<i::JSArrayBufferView> view = i::Handle<i::JSArrayBufferView>::cast(
v8::Utils::OpenHandle(*typed_array));
return i::handle(i::JSArrayBuffer::cast(view->buffer()));
return i::handle(i::JSArrayBuffer::cast(view->buffer()), view->GetIsolate());
}
TEST(CustomSnapshotDataBlobOnOrOffHeapTypedArray) {
@ -1388,7 +1389,7 @@ TEST(CodeSerializerOnePlusOne) {
Handle<JSFunction> copy_fun =
isolate->factory()->NewFunctionFromSharedFunctionInfo(
copy, isolate->native_context());
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Handle<Object> copy_result =
Execution::Call(isolate, copy_fun, global, 0, nullptr).ToHandleChecked();
CHECK_EQ(2, Handle<Smi>::cast(copy_result)->value());
@ -1446,7 +1447,7 @@ TEST(CodeSerializerInternalizedString) {
CHECK(!orig_source.is_identical_to(copy_source));
CHECK(orig_source->Equals(*copy_source));
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
i::ScriptData* script_data = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1505,7 +1506,7 @@ TEST(CodeSerializerLargeCodeObject) {
Handle<String> source_str =
isolate->factory()->NewStringFromOneByte(source).ToHandleChecked();
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1571,7 +1572,7 @@ TEST(CodeSerializerLargeCodeObjectWithIncrementalMarking) {
ec_page = Page::FromAddress(moving_object->address());
}
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1634,7 +1635,7 @@ TEST(CodeSerializerLargeStrings) {
f->NewStringFromOneByte(source_t).ToHandleChecked())
.ToHandleChecked();
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1702,7 +1703,7 @@ TEST(CodeSerializerThreeBigStrings) {
f->NewConsString(source_a_str, source_b_str).ToHandleChecked(),
source_c_str).ToHandleChecked();
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1820,7 +1821,7 @@ TEST(CodeSerializerExternalString) {
->NewStringFromUtf8(CStrVector(source))
.ToHandleChecked();
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1877,7 +1878,7 @@ TEST(CodeSerializerLargeExternalString) {
f->NewConsString(f->NewStringFromAsciiChecked(" = 42; "), name)
.ToHandleChecked()).ToHandleChecked();
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig = CompileScriptAndProduceCache(
@ -1926,7 +1927,7 @@ TEST(CodeSerializerExternalScriptName) {
CHECK(name->IsExternalOneByteString());
CHECK(!name->IsInternalizedString());
Handle<JSObject> global(isolate->context()->global_object());
Handle<JSObject> global(isolate->context()->global_object(), isolate);
ScriptData* cache = nullptr;
Handle<SharedFunctionInfo> orig =

View File

@ -49,7 +49,7 @@ static Handle<JSWeakSet> AllocateJSWeakSet(Isolate* isolate) {
Factory* factory = isolate->factory();
Handle<Map> map = factory->NewMap(JS_WEAK_SET_TYPE, JSWeakSet::kSize);
Handle<JSObject> weakset_obj = factory->NewJSObjectFromMap(map);
Handle<JSWeakSet> weakset(JSWeakSet::cast(*weakset_obj));
Handle<JSWeakSet> weakset(JSWeakSet::cast(*weakset_obj), isolate);
// Do not leak handles for the hash table, it would make entries strong.
{
HandleScope scope(isolate);

Some files were not shown because too many files have changed in this diff Show More