[explicit isolates] Remove final GetIsolate/GetHeaps

Strictly speaking there are some left in api.cc, but they are in
deprecated functions with non-deprecated alternatives.

Apart from changes made using tooling, this also modifies
FieldType::AsClass to return Map* rather than Handle<Map> and converts
its call sites to create the Handle when they need it - currently
several sites immediately dereference the Handle.

Also marks WasmDebugInfo as NeverReadOnlySpaceObject so GetIsolate and
GetHeap remain usable.

Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng
Change-Id: I7ea5048f97f140c757f651712b8c33a5c7e0ebc1
Reviewed-on: https://chromium-review.googlesource.com/1140302
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54513}
This commit is contained in:
Dan Elphick 2018-07-17 16:08:58 +01:00 committed by Commit Bot
parent 98e955a781
commit 4f19dac984
31 changed files with 164 additions and 134 deletions

View File

@ -2517,8 +2517,8 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
source->host_defined_options);
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
i::Compiler::GetSharedFunctionInfoForScript(
str, script_details, source->resource_options, nullptr, script_data,
options, no_cache_reason, i::NOT_NATIVES_CODE);
isolate, str, script_details, source->resource_options, nullptr,
script_data, options, no_cache_reason, i::NOT_NATIVES_CODE);
if (options == kConsumeCodeCache) {
source->cached_data->rejected = script_data->rejected();
}
@ -2726,7 +2726,7 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
i::Compiler::GetSharedFunctionInfoForStreamedScript(
str, script_details, origin.Options(), streaming_data);
isolate, str, script_details, origin.Options(), streaming_data);
i::Handle<i::SharedFunctionInfo> result;
has_pending_exception = !maybe_function_info.ToHandle(&result);
@ -5601,7 +5601,9 @@ bool String::ContainsOnlyOneByte() const {
}
int String::Utf8Length() const {
DISABLE_DEPRECATED_WARNINGS
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
RESET_DEPRECATED_WARNINGS
return Utf8Length(reinterpret_cast<Isolate*>(isolate));
}
@ -9761,7 +9763,7 @@ MaybeLocal<UnboundScript> debug::CompileInspectorScript(Isolate* v8_isolate,
i::ScriptData* script_data = nullptr;
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
i::Compiler::GetSharedFunctionInfoForScript(
str, i::Compiler::ScriptDetails(), origin_options, nullptr,
isolate, str, i::Compiler::ScriptDetails(), origin_options, nullptr,
script_data, ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheBecauseInspector,
i::FLAG_expose_inspector_scripts ? i::NOT_NATIVES_CODE

View File

@ -1104,15 +1104,15 @@ void Genesis::CreateJSProxyMaps() {
Map::EnsureDescriptorSlack(isolate_, map, 2);
{ // proxy
Descriptor d = Descriptor::DataField(factory()->proxy_string(),
Descriptor d = Descriptor::DataField(isolate(), factory()->proxy_string(),
JSProxyRevocableResult::kProxyIndex,
NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // revoke
Descriptor d = Descriptor::DataField(factory()->revoke_string(),
JSProxyRevocableResult::kRevokeIndex,
NONE, Representation::Tagged());
Descriptor d = Descriptor::DataField(
isolate(), factory()->revoke_string(),
JSProxyRevocableResult::kRevokeIndex, NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
@ -2611,7 +2611,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
// ECMA-262, section 15.10.7.5.
PropertyAttributes writable =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
Descriptor d = Descriptor::DataField(factory->lastIndex_string(),
Descriptor d = Descriptor::DataField(isolate(), factory->lastIndex_string(),
JSRegExp::kLastIndexFieldIndex,
writable, Representation::Tagged());
initial_map->AppendDescriptor(&d);
@ -3324,7 +3324,7 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
PropertyAttributes attribs =
static_cast<PropertyAttributes>(DONT_DELETE | DONT_ENUM | READ_ONLY);
Descriptor d =
Descriptor::DataField(factory->to_string_tag_symbol(),
Descriptor::DataField(isolate(), factory->to_string_tag_symbol(),
JSModuleNamespace::kToStringTagFieldIndex,
attribs, Representation::Tagged());
map->AppendDescriptor(&d);
@ -3338,14 +3338,14 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(isolate_, map, 2);
{ // value
Descriptor d = Descriptor::DataField(factory->value_string(),
Descriptor d = Descriptor::DataField(isolate(), factory->value_string(),
JSIteratorResult::kValueIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // done
Descriptor d = Descriptor::DataField(factory->done_string(),
Descriptor d = Descriptor::DataField(isolate(), factory->done_string(),
JSIteratorResult::kDoneIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
@ -3556,15 +3556,17 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(isolate_, map, 2);
{ // length
Descriptor d = Descriptor::DataField(
factory->length_string(), JSSloppyArgumentsObject::kLengthIndex,
DONT_ENUM, Representation::Tagged());
Descriptor d =
Descriptor::DataField(isolate(), factory->length_string(),
JSSloppyArgumentsObject::kLengthIndex,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
Descriptor d = Descriptor::DataField(
factory->callee_string(), JSSloppyArgumentsObject::kCalleeIndex,
DONT_ENUM, Representation::Tagged());
Descriptor d =
Descriptor::DataField(isolate(), factory->callee_string(),
JSSloppyArgumentsObject::kCalleeIndex,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
// @@iterator method is added later.
@ -3608,9 +3610,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Map::EnsureDescriptorSlack(isolate_, map, 2);
{ // length
Descriptor d = Descriptor::DataField(
factory->length_string(), JSStrictArgumentsObject::kLengthIndex,
DONT_ENUM, Representation::Tagged());
Descriptor d =
Descriptor::DataField(isolate(), factory->length_string(),
JSStrictArgumentsObject::kLengthIndex,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // callee
@ -3763,9 +3766,10 @@ bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name,
isolate->factory()->NewStringFromUtf8(name).ToHandleChecked();
MaybeHandle<SharedFunctionInfo> maybe_function_info =
Compiler::GetSharedFunctionInfoForScript(
source, Compiler::ScriptDetails(script_name), ScriptOriginOptions(),
nullptr, nullptr, ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, natives_flag);
isolate, source, Compiler::ScriptDetails(script_name),
ScriptOriginOptions(), nullptr, nullptr,
ScriptCompiler::kNoCompileOptions, ScriptCompiler::kNoCacheNoReason,
natives_flag);
Handle<SharedFunctionInfo> function_info;
if (!maybe_function_info.ToHandle(&function_info)) return false;
@ -3828,8 +3832,9 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
factory->NewStringFromUtf8(name).ToHandleChecked();
MaybeHandle<SharedFunctionInfo> maybe_function_info =
Compiler::GetSharedFunctionInfoForScript(
source, Compiler::ScriptDetails(script_name), ScriptOriginOptions(),
extension, nullptr, ScriptCompiler::kNoCompileOptions,
isolate, source, Compiler::ScriptDetails(script_name),
ScriptOriginOptions(), extension, nullptr,
ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheBecauseV8Extension, EXTENSION_CODE);
if (!maybe_function_info.ToHandle(&function_info)) return false;
cache->Add(isolate, name, function_info);
@ -4885,27 +4890,29 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
Map::EnsureDescriptorSlack(isolate(), map, 4);
{ // get
Descriptor d = Descriptor::DataField(
factory()->get_string(), JSAccessorPropertyDescriptor::kGetIndex,
NONE, Representation::Tagged());
Descriptor d =
Descriptor::DataField(isolate(), factory()->get_string(),
JSAccessorPropertyDescriptor::kGetIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // set
Descriptor d = Descriptor::DataField(
factory()->set_string(), JSAccessorPropertyDescriptor::kSetIndex,
NONE, Representation::Tagged());
Descriptor d =
Descriptor::DataField(isolate(), factory()->set_string(),
JSAccessorPropertyDescriptor::kSetIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // enumerable
Descriptor d =
Descriptor::DataField(factory()->enumerable_string(),
Descriptor::DataField(isolate(), factory()->enumerable_string(),
JSAccessorPropertyDescriptor::kEnumerableIndex,
NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // configurable
Descriptor d = Descriptor::DataField(
factory()->configurable_string(),
isolate(), factory()->configurable_string(),
JSAccessorPropertyDescriptor::kConfigurableIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
@ -4929,28 +4936,29 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
Map::EnsureDescriptorSlack(isolate(), map, 4);
{ // value
Descriptor d = Descriptor::DataField(
factory()->value_string(), JSDataPropertyDescriptor::kValueIndex,
NONE, Representation::Tagged());
Descriptor d =
Descriptor::DataField(isolate(), factory()->value_string(),
JSDataPropertyDescriptor::kValueIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // writable
Descriptor d =
Descriptor::DataField(factory()->writable_string(),
Descriptor::DataField(isolate(), factory()->writable_string(),
JSDataPropertyDescriptor::kWritableIndex, NONE,
Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // enumerable
Descriptor d =
Descriptor::DataField(factory()->enumerable_string(),
Descriptor::DataField(isolate(), factory()->enumerable_string(),
JSDataPropertyDescriptor::kEnumerableIndex,
NONE, Representation::Tagged());
map->AppendDescriptor(&d);
}
{ // configurable
Descriptor d =
Descriptor::DataField(factory()->configurable_string(),
Descriptor::DataField(isolate(), factory()->configurable_string(),
JSDataPropertyDescriptor::kConfigurableIndex,
NONE, Representation::Tagged());
map->AppendDescriptor(&d);
@ -5005,7 +5013,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
// index descriptor.
{
Descriptor d = Descriptor::DataField(factory()->index_string(),
Descriptor d = Descriptor::DataField(isolate(), factory()->index_string(),
JSRegExpResult::kIndexIndex, NONE,
Representation::Tagged());
initial_map->AppendDescriptor(&d);
@ -5013,7 +5021,7 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
// input descriptor.
{
Descriptor d = Descriptor::DataField(factory()->input_string(),
Descriptor d = Descriptor::DataField(isolate(), factory()->input_string(),
JSRegExpResult::kInputIndex, NONE,
Representation::Tagged());
initial_map->AppendDescriptor(&d);
@ -5021,9 +5029,9 @@ bool Genesis::InstallNatives(GlobalContextType context_type) {
// groups descriptor.
{
Descriptor d = Descriptor::DataField(factory()->groups_string(),
JSRegExpResult::kGroupsIndex, NONE,
Representation::Tagged());
Descriptor d = Descriptor::DataField(
isolate(), factory()->groups_string(), JSRegExpResult::kGroupsIndex,
NONE, Representation::Tagged());
initial_map->AppendDescriptor(&d);
}

View File

@ -1595,11 +1595,11 @@ Handle<Script> NewScript(Isolate* isolate, ParseInfo* parse_info,
} // namespace
MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
Handle<String> source, const Compiler::ScriptDetails& script_details,
Isolate* isolate, Handle<String> source,
const Compiler::ScriptDetails& script_details,
ScriptOriginOptions origin_options, v8::Extension* extension,
ScriptData* cached_data, ScriptCompiler::CompileOptions compile_options,
ScriptCompiler::NoCacheReason no_cache_reason, NativesFlag natives) {
Isolate* isolate = source->GetIsolate();
ScriptCompileTimerScope compile_timer(isolate, no_cache_reason);
if (compile_options == ScriptCompiler::kNoCompileOptions ||
@ -1775,9 +1775,9 @@ ScriptCompiler::ScriptStreamingTask* Compiler::NewBackgroundCompileTask(
MaybeHandle<SharedFunctionInfo>
Compiler::GetSharedFunctionInfoForStreamedScript(
Handle<String> source, const ScriptDetails& script_details,
ScriptOriginOptions origin_options, ScriptStreamingData* streaming_data) {
Isolate* isolate = source->GetIsolate();
Isolate* isolate, Handle<String> source,
const ScriptDetails& script_details, ScriptOriginOptions origin_options,
ScriptStreamingData* streaming_data) {
ScriptCompileTimerScope compile_timer(
isolate, ScriptCompiler::kNoCacheBecauseStreamingSource);
PostponeInterruptsScope postpone(isolate);

View File

@ -139,9 +139,10 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
// Create a shared function info object for a String source.
static MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScript(
Handle<String> source, const ScriptDetails& script_details,
ScriptOriginOptions origin_options, v8::Extension* extension,
ScriptData* cached_data, ScriptCompiler::CompileOptions compile_options,
Isolate* isolate, Handle<String> source,
const ScriptDetails& script_details, ScriptOriginOptions origin_options,
v8::Extension* extension, ScriptData* cached_data,
ScriptCompiler::CompileOptions compile_options,
ScriptCompiler::NoCacheReason no_cache_reason,
NativesFlag is_natives_code);
@ -151,8 +152,9 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
// have been released, however the object itself isn't freed and is still
// owned by the caller.
static MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForStreamedScript(
Handle<String> source, const ScriptDetails& script_details,
ScriptOriginOptions origin_options, ScriptStreamingData* streaming_data);
Isolate* isolate, Handle<String> source,
const ScriptDetails& script_details, ScriptOriginOptions origin_options,
ScriptStreamingData* streaming_data);
// Create a shared function info object for the given function literal
// node (the code may be lazily compiled).

View File

@ -399,9 +399,9 @@ bool AccessInfoFactory::ComputePropertyAccessInfo(
dependencies()->DependOnFieldType(MapRef(js_heap_broker(), map),
number);
// Remember the field map, and try to infer a useful type.
field_type = Type::For(js_heap_broker(),
descriptors_field_type->AsClass());
field_map = descriptors_field_type->AsClass();
Handle<Map> map(descriptors_field_type->AsClass(), isolate());
field_type = Type::For(js_heap_broker(), map);
field_map = MaybeHandle<Map>(map);
}
}
*access_info = PropertyAccessInfo::DataField(
@ -703,9 +703,9 @@ bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name,
dependencies()->DependOnFieldType(
MapRef(js_heap_broker(), transition_map), number);
// Remember the field map, and try to infer a useful type.
field_type =
Type::For(js_heap_broker(), descriptors_field_type->AsClass());
field_map = descriptors_field_type->AsClass();
Handle<Map> map(descriptors_field_type->AsClass(), isolate());
field_type = Type::For(js_heap_broker(), map);
field_map = MaybeHandle<Map>(map);
}
}
dependencies()->DependOnTransition(MapRef(js_heap_broker(), transition_map));

View File

@ -32,7 +32,8 @@ MaybeHandle<Object> DebugEvaluate::Global(Isolate* isolate,
ScriptOriginOptions origin_options(false, true);
MaybeHandle<SharedFunctionInfo> maybe_function_info =
Compiler::GetSharedFunctionInfoForScript(
source, Compiler::ScriptDetails(isolate->factory()->empty_string()),
isolate, source,
Compiler::ScriptDetails(isolate->factory()->empty_string()),
origin_options, nullptr, nullptr, ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE);

View File

@ -944,9 +944,8 @@ bool CanRestartFrame(Isolate* isolate, Address fp,
return true;
}
void TranslateSourcePositionTable(Handle<BytecodeArray> code,
void TranslateSourcePositionTable(Isolate* isolate, Handle<BytecodeArray> code,
const std::vector<SourceChangeRange>& diffs) {
Isolate* isolate = code->GetIsolate();
SourcePositionTableBuilder builder;
Handle<ByteArray> source_position_table(code->SourcePositionTable(), isolate);
@ -979,8 +978,8 @@ void UpdatePositions(Isolate* isolate, Handle<SharedFunctionInfo> sfi,
sfi->SetFunctionTokenPosition(new_function_token_position,
new_start_position);
if (sfi->HasBytecodeArray()) {
TranslateSourcePositionTable(handle(sfi->GetBytecodeArray(), isolate),
diffs);
TranslateSourcePositionTable(
isolate, handle(sfi->GetBytecodeArray(), isolate), diffs);
}
}
} // anonymous namespace

View File

@ -2945,7 +2945,7 @@ class TypedElementsAccessor
static Handle<Object> GetImpl(Isolate* isolate, FixedArrayBase* backing_store,
uint32_t entry) {
return BackingStore::get(BackingStore::cast(backing_store), entry);
return BackingStore::get(isolate, BackingStore::cast(backing_store), entry);
}
static PropertyDetails GetDetailsImpl(JSObject* holder, uint32_t entry) {

View File

@ -49,14 +49,13 @@ FieldType* FieldType::cast(Object* object) {
bool FieldType::IsClass() { return this->IsMap(); }
Handle<i::Map> FieldType::AsClass() {
Map* FieldType::AsClass() {
DCHECK(IsClass());
i::Map* map = Map::cast(this);
return handle(map, map->GetIsolate());
return Map::cast(this);
}
bool FieldType::NowStable() {
return !this->IsClass() || this->AsClass()->is_stable();
return !this->IsClass() || AsClass()->is_stable();
}
bool FieldType::NowIs(FieldType* other) {
@ -78,7 +77,7 @@ void FieldType::PrintTo(std::ostream& os) {
os << "None";
} else {
DCHECK(IsClass());
os << "Class(" << static_cast<void*>(*AsClass()) << ")";
os << "Class(" << static_cast<void*>(AsClass()) << ")";
}
}

View File

@ -34,7 +34,7 @@ class FieldType : public Object {
bool NowContains(Handle<Object> value) { return NowContains(*value); }
bool IsClass();
Handle<i::Map> AsClass();
Map* AsClass();
bool IsNone() { return this == None(); }
bool IsAny() { return this == Any(); }
bool NowStable();

View File

@ -78,6 +78,10 @@ MaybeObjectHandle MaybeObjectHandle::Weak(Handle<Object> object) {
return MaybeObjectHandle(object, HeapObjectReferenceType::WEAK);
}
MaybeObjectHandle MaybeObjectHandle::Weak(Object* object, Isolate* isolate) {
return MaybeObjectHandle(object, HeapObjectReferenceType::WEAK, isolate);
}
MaybeObject* MaybeObjectHandle::operator*() const {
if (reference_type_ == HeapObjectReferenceType::WEAK) {
return HeapObjectReference::Weak(*handle_.ToHandleChecked());

View File

@ -3910,8 +3910,8 @@ Handle<Map> Factory::CreateSloppyFunctionMap(
if (IsFunctionModeWithName(function_mode)) {
// Add name field.
Handle<Name> name = isolate()->factory()->name_string();
Descriptor d = Descriptor::DataField(name, field_index++, roc_attribs,
Representation::Tagged());
Descriptor d = Descriptor::DataField(isolate(), name, field_index++,
roc_attribs, Representation::Tagged());
map->AppendDescriptor(&d);
} else {
@ -3986,8 +3986,8 @@ Handle<Map> Factory::CreateStrictFunctionMap(
if (IsFunctionModeWithName(function_mode)) {
// Add name field.
Handle<Name> name = isolate()->factory()->name_string();
Descriptor d = Descriptor::DataField(name, field_index++, roc_attribs,
Representation::Tagged());
Descriptor d = Descriptor::DataField(isolate(), name, field_index++,
roc_attribs, Representation::Tagged());
map->AppendDescriptor(&d);
} else {
@ -4001,8 +4001,8 @@ Handle<Map> Factory::CreateStrictFunctionMap(
if (IsFunctionModeWithHomeObject(function_mode)) {
// Add home object field.
Handle<Name> name = isolate()->factory()->home_object_symbol();
Descriptor d = Descriptor::DataField(name, field_index++, DONT_ENUM,
Representation::Tagged());
Descriptor d = Descriptor::DataField(isolate(), name, field_index++,
DONT_ENUM, Representation::Tagged());
map->AppendDescriptor(&d);
}

View File

@ -508,7 +508,8 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
isolate_, instance_type, &next_constness, &next_representation,
&next_field_type);
MaybeObjectHandle wrapped_type(Map::WrapFieldType(next_field_type));
MaybeObjectHandle wrapped_type(
Map::WrapFieldType(isolate_, next_field_type));
Descriptor d;
if (next_kind == kData) {
d = Descriptor::DataField(key, current_offset, next_attributes,
@ -561,7 +562,8 @@ Handle<DescriptorArray> MapUpdater::BuildDescriptorArray() {
!Map::IsInplaceGeneralizableField(
next_constness, next_representation, *next_field_type));
MaybeObjectHandle wrapped_type(Map::WrapFieldType(next_field_type));
MaybeObjectHandle wrapped_type(
Map::WrapFieldType(isolate_, next_field_type));
Descriptor d;
if (next_kind == kData) {
DCHECK_IMPLIES(!FLAG_track_constant_fields,

View File

@ -1029,7 +1029,7 @@ Handle<String> MessageTemplate::FormatMessage(Isolate* isolate,
Factory* factory = isolate->factory();
Handle<String> result_string = Object::NoSideEffectsToString(isolate, arg);
MaybeHandle<String> maybe_result_string = MessageTemplate::FormatMessage(
template_index, result_string, factory->empty_string(),
isolate, template_index, result_string, factory->empty_string(),
factory->empty_string());
if (!maybe_result_string.ToHandle(&result_string)) {
DCHECK(isolate->has_pending_exception());
@ -1058,12 +1058,11 @@ const char* MessageTemplate::TemplateString(int template_index) {
}
}
MaybeHandle<String> MessageTemplate::FormatMessage(int template_index,
MaybeHandle<String> MessageTemplate::FormatMessage(Isolate* isolate,
int template_index,
Handle<String> arg0,
Handle<String> arg1,
Handle<String> arg2) {
Isolate* isolate = arg0->GetIsolate();
const char* template_string = TemplateString(template_index);
if (template_string == nullptr) {
isolate->ThrowIllegalOperation();
@ -1228,8 +1227,8 @@ Handle<String> FormatMessage(Isolate* isolate, int template_index,
isolate->native_context()->IncrementErrorsThrown();
Handle<String> msg;
if (!MessageTemplate::FormatMessage(template_index, arg0_str, arg1_str,
arg2_str)
if (!MessageTemplate::FormatMessage(isolate, template_index, arg0_str,
arg1_str, arg2_str)
.ToHandle(&msg)) {
DCHECK(isolate->has_pending_exception());
isolate->clear_pending_exception();

View File

@ -770,7 +770,7 @@ class MessageTemplate {
static const char* TemplateString(int template_index);
static MaybeHandle<String> FormatMessage(int template_index,
static MaybeHandle<String> FormatMessage(Isolate* isolate, int template_index,
Handle<String> arg0,
Handle<String> arg1,
Handle<String> arg2);

View File

@ -2457,7 +2457,7 @@ extern void _v8_internal_Print_TransitionTree(void* object) {
#if defined(DEBUG) || defined(OBJECT_PRINT)
i::DisallowHeapAllocation no_gc;
i::Map* map = reinterpret_cast<i::Map*>(object);
i::TransitionsAccessor transitions(map->GetIsolate(), map, &no_gc);
i::TransitionsAccessor transitions(i::Isolate::Current(), map, &no_gc);
transitions.PrintTransitionTree();
#endif
}

View File

@ -3852,9 +3852,9 @@ Handle<Context> JSReceiver::GetCreationContext() {
}
// static
MaybeObjectHandle Map::WrapFieldType(Handle<FieldType> type) {
MaybeObjectHandle Map::WrapFieldType(Isolate* isolate, Handle<FieldType> type) {
if (type->IsClass()) {
return MaybeObjectHandle::Weak(type->AsClass());
return MaybeObjectHandle::Weak(type->AsClass(), isolate);
}
return MaybeObjectHandle(type);
}
@ -3898,7 +3898,7 @@ MaybeHandle<Map> Map::CopyWithField(Isolate* isolate, Handle<Map> map,
isolate, map->instance_type(), &constness, &representation, &type);
}
MaybeObjectHandle wrapped_type = WrapFieldType(type);
MaybeObjectHandle wrapped_type = WrapFieldType(isolate, type);
DCHECK_IMPLIES(!FLAG_track_constant_fields,
constness == PropertyConstness::kMutable);
@ -3926,7 +3926,8 @@ MaybeHandle<Map> Map::CopyWithConstant(Isolate* isolate, Handle<Map> map,
PropertyConstness::kConst, representation, flag);
} else {
// Allocate new instance descriptors with (name, constant) added.
Descriptor d = Descriptor::DataConstant(name, 0, constant, attributes);
Descriptor d =
Descriptor::DataConstant(isolate, name, 0, constant, attributes);
Handle<Map> new_map = Map::CopyAddDescriptor(isolate, map, &d, flag);
return new_map;
}
@ -4523,8 +4524,8 @@ Handle<Map> Map::CopyGeneralizeAllFields(Isolate* isolate, Handle<Map> map,
? details.field_index()
: new_map->NumberOfFields();
Descriptor d = Descriptor::DataField(
handle(descriptors->GetKey(modify_index), isolate), field_index,
attributes, Representation::Tagged());
isolate, handle(descriptors->GetKey(modify_index), isolate),
field_index, attributes, Representation::Tagged());
descriptors->Replace(modify_index, &d);
if (details.location() != kField) {
new_map->AccountAddedPropertyField();
@ -4741,7 +4742,7 @@ void Map::GeneralizeField(Isolate* isolate, Handle<Map> map, int modify_index,
PropertyDetails details = descriptors->GetDetails(modify_index);
Handle<Name> name(descriptors->GetKey(modify_index), isolate);
MaybeObjectHandle wrapped_type(WrapFieldType(new_field_type));
MaybeObjectHandle wrapped_type(WrapFieldType(isolate, new_field_type));
field_owner->UpdateFieldType(isolate, modify_index, name, new_constness,
new_representation, wrapped_type);
field_owner->dependent_code()->DeoptimizeDependentCodeGroup(

View File

@ -33,8 +33,12 @@ namespace internal {
// Many of the functions in this class use arguments of type {BigIntBase},
// indicating that they will be used in a read-only capacity, and both
// {BigInt} and {MutableBigInt} objects can be passed in.
class MutableBigInt : public FreshlyAllocatedBigInt {
class MutableBigInt : public FreshlyAllocatedBigInt,
public NeverReadOnlySpaceObject {
public:
using NeverReadOnlySpaceObject::GetHeap;
using NeverReadOnlySpaceObject::GetIsolate;
// Bottleneck for converting MutableBigInts to BigInts.
static MaybeHandle<BigInt> MakeImmutable(MaybeHandle<MutableBigInt> maybe);
static Handle<BigInt> MakeImmutable(Handle<MutableBigInt> result);
@ -152,7 +156,8 @@ class MutableBigInt : public FreshlyAllocatedBigInt {
static MaybeHandle<String> ToStringBasePowerOfTwo(Isolate* isolate,
Handle<BigIntBase> x,
int radix);
static MaybeHandle<String> ToStringGeneric(Handle<BigIntBase> x, int radix);
static MaybeHandle<String> ToStringGeneric(Isolate* isolate,
Handle<BigIntBase> x, int radix);
static double ToDouble(Handle<BigIntBase> x);
enum Rounding { kRoundDown, kTie, kRoundUp };
@ -926,7 +931,7 @@ MaybeHandle<String> BigInt::ToString(Isolate* isolate, Handle<BigInt> bigint,
if (base::bits::IsPowerOfTwo(radix)) {
return MutableBigInt::ToStringBasePowerOfTwo(isolate, bigint, radix);
}
return MutableBigInt::ToStringGeneric(bigint, radix);
return MutableBigInt::ToStringGeneric(isolate, bigint, radix);
}
MaybeHandle<BigInt> BigInt::FromNumber(Isolate* isolate,
@ -1981,12 +1986,12 @@ MaybeHandle<String> MutableBigInt::ToStringBasePowerOfTwo(Isolate* isolate,
return result;
}
MaybeHandle<String> MutableBigInt::ToStringGeneric(Handle<BigIntBase> x,
MaybeHandle<String> MutableBigInt::ToStringGeneric(Isolate* isolate,
Handle<BigIntBase> x,
int radix) {
DCHECK(radix >= 2 && radix <= 36);
DCHECK(!x->is_zero());
Heap* heap = x->GetHeap();
Isolate* isolate = heap->isolate();
Heap* heap = isolate->heap();
const int length = x->length();
const bool sign = x->sign();

View File

@ -688,9 +688,10 @@ inline uint64_t FixedTypedArray<BigUint64ArrayTraits>::FromHandle(
}
template <class Traits>
Handle<Object> FixedTypedArray<Traits>::get(FixedTypedArray<Traits>* array,
Handle<Object> FixedTypedArray<Traits>::get(Isolate* isolate,
FixedTypedArray<Traits>* array,
int index) {
return Traits::ToHandle(array->GetIsolate(), array->get_scalar(index));
return Traits::ToHandle(isolate, array->get_scalar(index));
}
template <class Traits>

View File

@ -676,7 +676,8 @@ class FixedTypedArray : public FixedTypedArrayBase {
static inline ElementType get_scalar_from_data_ptr(void* data_ptr, int index);
inline ElementType get_scalar(int index);
static inline Handle<Object> get(FixedTypedArray* array, int index);
static inline Handle<Object> get(Isolate* isolate, FixedTypedArray* array,
int index);
inline void set(int index, ElementType value);
static inline ElementType from(int value);

View File

@ -651,7 +651,8 @@ class Map : public HeapObject {
Descriptor* descriptor,
TransitionFlag flag);
static MaybeObjectHandle WrapFieldType(Handle<FieldType> type);
static MaybeObjectHandle WrapFieldType(Isolate* isolate,
Handle<FieldType> type);
static FieldType* UnwrapFieldType(MaybeObject* wrapped_type);
V8_WARN_UNUSED_RESULT static MaybeHandle<Map> CopyWithField(

View File

@ -577,7 +577,7 @@ void ConsumedPreParsedScopeData::RestoreData(Scope* scope) {
if (scope_data_->RemainingBytes() < kUint8Size) {
// Temporary debugging code for detecting inconsistent data. Write debug
// information on the stack, then crash.
data_->GetIsolate()->PushStackTraceAndDie();
isolate_->PushStackTraceAndDie();
}
// scope_type is stored only in debug mode.

View File

@ -22,12 +22,11 @@ std::ostream& operator<<(std::ostream& os,
return os;
}
Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
PropertyAttributes attributes,
Descriptor Descriptor::DataField(Isolate* isolate, Handle<Name> key,
int field_index, PropertyAttributes attributes,
Representation representation) {
return DataField(key, field_index, attributes, PropertyConstness::kMutable,
representation,
MaybeObjectHandle(FieldType::Any(key->GetIsolate())));
representation, MaybeObjectHandle(FieldType::Any(isolate)));
}
Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
@ -41,11 +40,11 @@ Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
return Descriptor(key, wrapped_field_type, details);
}
Descriptor Descriptor::DataConstant(Handle<Name> key, int field_index,
Handle<Object> value,
Descriptor Descriptor::DataConstant(Isolate* isolate, Handle<Name> key,
int field_index, Handle<Object> value,
PropertyAttributes attributes) {
if (FLAG_track_constant_fields) {
MaybeObjectHandle any_type(FieldType::Any(), key->GetIsolate());
MaybeObjectHandle any_type(FieldType::Any(), isolate);
return DataField(key, field_index, attributes, PropertyConstness::kConst,
Representation::Tagged(), any_type);

View File

@ -31,8 +31,8 @@ class Descriptor final BASE_EMBEDDED {
void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); }
static Descriptor DataField(Handle<Name> key, int field_index,
PropertyAttributes attributes,
static Descriptor DataField(Isolate* isolate, Handle<Name> key,
int field_index, PropertyAttributes attributes,
Representation representation);
static Descriptor DataField(Handle<Name> key, int field_index,
@ -48,8 +48,8 @@ class Descriptor final BASE_EMBEDDED {
value->OptimalRepresentation(), 0);
}
static Descriptor DataConstant(Handle<Name> key, int field_index,
Handle<Object> value,
static Descriptor DataConstant(Isolate* isolate, Handle<Name> key,
int field_index, Handle<Object> value,
PropertyAttributes attributes);
static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign,

View File

@ -516,8 +516,11 @@ class WasmExportedFunctionData : public Struct {
#undef WASM_EXPORTED_FUNCTION_DATA_FIELDS
};
class WasmDebugInfo : public Struct {
class WasmDebugInfo : public Struct, public NeverReadOnlySpaceObject {
public:
using NeverReadOnlySpaceObject::GetHeap;
using NeverReadOnlySpaceObject::GetIsolate;
DECL_ACCESSORS(wasm_instance, WasmInstanceObject)
DECL_ACCESSORS(interpreter_handle, Object);
DECL_ACCESSORS(interpreted_functions, Object);

View File

@ -35,8 +35,9 @@ static Handle<JSFunction> Compile(const char* source) {
.ToHandleChecked();
Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript(
source_code, Compiler::ScriptDetails(), v8::ScriptOriginOptions(),
nullptr, nullptr, v8::ScriptCompiler::kNoCompileOptions,
isolate, source_code, Compiler::ScriptDetails(),
v8::ScriptOriginOptions(), nullptr, nullptr,
v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
return isolate->factory()->NewFunctionFromSharedFunctionInfo(

View File

@ -66,8 +66,9 @@ static Handle<JSFunction> Compile(const char* source) {
CStrVector(source)).ToHandleChecked();
Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript(
source_code, Compiler::ScriptDetails(), v8::ScriptOriginOptions(),
nullptr, nullptr, v8::ScriptCompiler::kNoCompileOptions,
isolate, source_code, Compiler::ScriptDetails(),
v8::ScriptOriginOptions(), nullptr, nullptr,
v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
return isolate->factory()->NewFunctionFromSharedFunctionInfo(

View File

@ -195,7 +195,7 @@ class ObjectHashTableTest: public ObjectHashTable {
}
int lookup(int key) {
Handle<Object> key_obj(Smi::FromInt(key), GetIsolate());
Handle<Object> key_obj(Smi::FromInt(key), CcTest::i_isolate());
return Smi::ToInt(Lookup(key_obj));
}

View File

@ -1364,9 +1364,9 @@ static Handle<SharedFunctionInfo> CompileScript(
Isolate* isolate, Handle<String> source, Handle<String> name,
ScriptData* cached_data, v8::ScriptCompiler::CompileOptions options) {
return Compiler::GetSharedFunctionInfoForScript(
source, Compiler::ScriptDetails(name), v8::ScriptOriginOptions(),
nullptr, cached_data, options, ScriptCompiler::kNoCacheNoReason,
NOT_NATIVES_CODE)
isolate, source, Compiler::ScriptDetails(name),
v8::ScriptOriginOptions(), nullptr, cached_data, options,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
}
@ -1375,9 +1375,9 @@ static Handle<SharedFunctionInfo> CompileScriptAndProduceCache(
ScriptData** script_data, v8::ScriptCompiler::CompileOptions options) {
Handle<SharedFunctionInfo> sfi =
Compiler::GetSharedFunctionInfoForScript(
source, Compiler::ScriptDetails(name), v8::ScriptOriginOptions(),
nullptr, nullptr, options, ScriptCompiler::kNoCacheNoReason,
NOT_NATIVES_CODE)
isolate, source, Compiler::ScriptDetails(name),
v8::ScriptOriginOptions(), nullptr, nullptr, options,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
std::unique_ptr<ScriptCompiler::CachedData> cached_data(
ScriptCompiler::CreateCodeCache(ToApiHandle<UnboundScript>(sfi)));

View File

@ -1526,8 +1526,9 @@ TEST(FormatMessage) {
Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1");
Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2");
Handle<String> result =
MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction,
arg0, arg1, arg2).ToHandleChecked();
MessageTemplate::FormatMessage(
isolate, MessageTemplate::kPropertyNotFunction, arg0, arg1, arg2)
.ToHandleChecked();
Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked(
"'arg0' returned for property 'arg1' of object 'arg2' is not a function");
CHECK(String::Equals(isolate, result, expected));

View File

@ -124,7 +124,7 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate,
d = Descriptor::AccessorConstant(name, info, NONE);
} else {
d = Descriptor::DataField(name, next_field_offset, NONE,
d = Descriptor::DataField(isolate, name, next_field_offset, NONE,
representations[kind]);
}
descriptors->Append(&d);
@ -658,7 +658,7 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend(
d = Descriptor::AccessorConstant(name, info, NONE);
} else {
d = Descriptor::DataField(name, next_field_offset, NONE,
d = Descriptor::DataField(isolate, name, next_field_offset, NONE,
representations[kind]);
}
PropertyDetails details = d.GetDetails();