Commit 0a028aa3 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[runtime] Eliminate all GetIsolates

Removes all explicit calls to GetIsolate() in runtime/ by passing it
through calling function functions and implicit calls via the single
argument Handle constructor and handle function.

Bug: v8:7786
Change-Id: I96ac2289a72a42c7abb6754418fecb8e03f2bb29
Reviewed-on: https://chromium-review.googlesource.com/1080528
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53457}
parent 0f1204f2
...@@ -628,7 +628,7 @@ MaybeHandle<JSReceiver> GetSuperHolder( ...@@ -628,7 +628,7 @@ MaybeHandle<JSReceiver> GetSuperHolder(
Isolate* isolate, Handle<Object> receiver, Handle<JSObject> home_object, Isolate* isolate, Handle<Object> receiver, Handle<JSObject> home_object,
SuperMode mode, MaybeHandle<Name> maybe_name, uint32_t index) { SuperMode mode, MaybeHandle<Name> maybe_name, uint32_t index) {
if (home_object->IsAccessCheckNeeded() && if (home_object->IsAccessCheckNeeded() &&
!isolate->MayAccess(handle(isolate->context()), home_object)) { !isolate->MayAccess(handle(isolate->context(), isolate), home_object)) {
isolate->ReportFailedAccessCheck(home_object); isolate->ReportFailedAccessCheck(home_object);
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, JSReceiver); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, JSReceiver);
} }
......
...@@ -294,8 +294,8 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source, ...@@ -294,8 +294,8 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> outer_info,
LanguageMode language_mode, LanguageMode language_mode,
int eval_scope_position, int eval_position) { int eval_scope_position, int eval_position) {
Handle<Context> context = Handle<Context>(isolate->context()); Handle<Context> context(isolate->context(), isolate);
Handle<Context> native_context = Handle<Context>(context->native_context()); Handle<Context> native_context(context->native_context(), isolate);
// Check if native context allows code generation from // Check if native context allows code generation from
// strings. Throw an exception if it doesn't. // strings. Throw an exception if it doesn't.
......
...@@ -47,7 +47,8 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) { ...@@ -47,7 +47,8 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
// Get the top-most JavaScript frame. // Get the top-most JavaScript frame.
JavaScriptFrameIterator it(isolate); JavaScriptFrameIterator it(isolate);
if (isolate->debug_execution_mode() == DebugInfo::kBreakpoints) { if (isolate->debug_execution_mode() == DebugInfo::kBreakpoints) {
isolate->debug()->Break(it.frame(), handle(it.frame()->function())); isolate->debug()->Break(it.frame(),
handle(it.frame()->function(), isolate));
} }
// Return the handler from the original bytecode array. // Return the handler from the original bytecode array.
...@@ -116,7 +117,7 @@ RUNTIME_FUNCTION(Runtime_DebugApplyInstrumentation) { ...@@ -116,7 +117,7 @@ RUNTIME_FUNCTION(Runtime_DebugApplyInstrumentation) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
isolate->debug()->ApplyInstrumentation(handle(function->shared())); isolate->debug()->ApplyInstrumentation(handle(function->shared(), isolate));
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -1211,7 +1212,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) { ...@@ -1211,7 +1212,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
// Convert the script objects to proper JS objects. // Convert the script objects to proper JS objects.
for (int i = 0; i < instances->length(); i++) { for (int i = 0; i < instances->length(); i++) {
Handle<Script> script = Handle<Script>(Script::cast(instances->get(i))); Handle<Script> script(Script::cast(instances->get(i)), isolate);
// Get the script wrapper in a local handle before calling GetScriptWrapper, // Get the script wrapper in a local handle before calling GetScriptWrapper,
// because using // because using
// instances->set(i, *GetScriptWrapper(script)) // instances->set(i, *GetScriptWrapper(script))
...@@ -1471,7 +1472,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineCount) { ...@@ -1471,7 +1472,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineCount) {
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
CHECK(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle(Script::cast(script->value()), isolate);
if (script_handle->type() == Script::TYPE_WASM) { if (script_handle->type() == Script::TYPE_WASM) {
// Return 0 for now; this function will disappear soon anyway. // Return 0 for now; this function will disappear soon anyway.
...@@ -1590,7 +1591,7 @@ bool GetScriptById(Isolate* isolate, int needle, Handle<Script>* result) { ...@@ -1590,7 +1591,7 @@ bool GetScriptById(Isolate* isolate, int needle, Handle<Script>* result) {
Script* script = nullptr; Script* script = nullptr;
while ((script = iterator.Next()) != nullptr) { while ((script = iterator.Next()) != nullptr) {
if (script->id() == needle) { if (script->id() == needle) {
*result = handle(script); *result = handle(script, isolate);
return true; return true;
} }
} }
...@@ -1618,7 +1619,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) { ...@@ -1618,7 +1619,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) {
CONVERT_NUMBER_CHECKED(int32_t, offset, Int32, args[3]); CONVERT_NUMBER_CHECKED(int32_t, offset, Int32, args[3]);
CHECK(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle(Script::cast(script->value()), isolate);
return *ScriptLocationFromLine(isolate, script_handle, opt_line, opt_column, return *ScriptLocationFromLine(isolate, script_handle, opt_line, opt_column,
offset); offset);
...@@ -1648,7 +1649,7 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo) { ...@@ -1648,7 +1649,7 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo) {
CONVERT_BOOLEAN_ARG_CHECKED(with_offset, 2); CONVERT_BOOLEAN_ARG_CHECKED(with_offset, 2);
CHECK(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle(Script::cast(script->value()), isolate);
const Script::OffsetFlag offset_flag = const Script::OffsetFlag offset_flag =
with_offset ? Script::WITH_OFFSET : Script::NO_OFFSET; with_offset ? Script::WITH_OFFSET : Script::NO_OFFSET;
......
...@@ -21,8 +21,8 @@ namespace { ...@@ -21,8 +21,8 @@ namespace {
// that contains all enumerable properties of the {receiver} and its prototypes // that contains all enumerable properties of the {receiver} and its prototypes
// have none, the map of the {receiver}. This is used to speed up the check for // have none, the map of the {receiver}. This is used to speed up the check for
// deletions during a for-in. // deletions during a for-in.
MaybeHandle<HeapObject> Enumerate(Handle<JSReceiver> receiver) { MaybeHandle<HeapObject> Enumerate(Isolate* isolate,
Isolate* const isolate = receiver->GetIsolate(); Handle<JSReceiver> receiver) {
JSObject::MakePrototypesFast(receiver, kStartAtReceiver, isolate); JSObject::MakePrototypesFast(receiver, kStartAtReceiver, isolate);
FastKeyAccumulator accumulator(isolate, receiver, FastKeyAccumulator accumulator(isolate, receiver,
KeyCollectionMode::kIncludePrototypes, KeyCollectionMode::kIncludePrototypes,
...@@ -116,7 +116,7 @@ RUNTIME_FUNCTION(Runtime_ForInEnumerate) { ...@@ -116,7 +116,7 @@ RUNTIME_FUNCTION(Runtime_ForInEnumerate) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
RETURN_RESULT_OR_FAILURE(isolate, Enumerate(receiver)); RETURN_RESULT_OR_FAILURE(isolate, Enumerate(isolate, receiver));
} }
......
...@@ -150,7 +150,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) { ...@@ -150,7 +150,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) {
if (isolate->logger()->is_listening_to_code_events() || if (isolate->logger()->is_listening_to_code_events() ||
isolate->is_profiling()) { isolate->is_profiling()) {
isolate->logger()->LogExistingFunction( isolate->logger()->LogExistingFunction(
source_shared, Handle<AbstractCode>(source_shared->abstract_code())); source_shared, handle(source_shared->abstract_code(), isolate));
} }
return *target; return *target;
......
...@@ -58,7 +58,7 @@ void AdvanceToOffsetForTracing( ...@@ -58,7 +58,7 @@ void AdvanceToOffsetForTracing(
interpreter::OperandScale::kSingle)); interpreter::OperandScale::kSingle));
} }
void PrintRegisters(std::ostream& os, bool is_input, void PrintRegisters(Isolate* isolate, std::ostream& os, bool is_input,
interpreter::BytecodeArrayIterator& bytecode_iterator, interpreter::BytecodeArrayIterator& bytecode_iterator,
Handle<Object> accumulator) { Handle<Object> accumulator) {
static const char kAccumulator[] = "accumulator"; static const char kAccumulator[] = "accumulator";
...@@ -82,8 +82,7 @@ void PrintRegisters(std::ostream& os, bool is_input, ...@@ -82,8 +82,7 @@ void PrintRegisters(std::ostream& os, bool is_input,
} }
// Print the registers. // Print the registers.
JavaScriptFrameIterator frame_iterator( JavaScriptFrameIterator frame_iterator(isolate);
bytecode_iterator.bytecode_array()->GetIsolate());
InterpretedFrame* frame = InterpretedFrame* frame =
reinterpret_cast<InterpretedFrame*>(frame_iterator.frame()); reinterpret_cast<InterpretedFrame*>(frame_iterator.frame());
int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode); int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode);
...@@ -144,7 +143,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) { ...@@ -144,7 +143,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) {
bytecode_array->parameter_count()); bytecode_array->parameter_count());
os << std::endl; os << std::endl;
// Print all input registers and accumulator. // Print all input registers and accumulator.
PrintRegisters(os, true, bytecode_iterator, accumulator); PrintRegisters(isolate, os, true, bytecode_iterator, accumulator);
os << std::flush; os << std::flush;
} }
......
...@@ -25,7 +25,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) { ...@@ -25,7 +25,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) {
CONVERT_ARG_CHECKED(JSValue, script_value, 0); CONVERT_ARG_CHECKED(JSValue, script_value, 0);
CHECK(script_value->value()->IsScript()); CHECK(script_value->value()->IsScript());
Handle<Script> script = Handle<Script>(Script::cast(script_value->value())); Handle<Script> script(Script::cast(script_value->value()), isolate);
std::vector<Handle<SharedFunctionInfo>> found; std::vector<Handle<SharedFunctionInfo>> found;
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
...@@ -36,7 +36,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) { ...@@ -36,7 +36,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) {
if (!heap_obj->IsSharedFunctionInfo()) continue; if (!heap_obj->IsSharedFunctionInfo()) continue;
SharedFunctionInfo* shared = SharedFunctionInfo::cast(heap_obj); SharedFunctionInfo* shared = SharedFunctionInfo::cast(heap_obj);
if (shared->script() != *script) continue; if (shared->script() != *script) continue;
found.push_back(Handle<SharedFunctionInfo>(shared)); found.push_back(Handle<SharedFunctionInfo>(shared, isolate));
} }
} }
...@@ -69,7 +69,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) { ...@@ -69,7 +69,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) {
CONVERT_ARG_HANDLE_CHECKED(String, source, 1); CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
CHECK(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle(Script::cast(script->value()), isolate);
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(isolate,
LiveEdit::GatherCompileInfo(script_handle, source)); LiveEdit::GatherCompileInfo(script_handle, source));
......
...@@ -803,7 +803,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { ...@@ -803,7 +803,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
FeedbackNexus nexus(vector, FeedbackVector::ToSlot(index)); FeedbackNexus nexus(vector, FeedbackVector::ToSlot(index));
if (nexus.ic_state() == UNINITIALIZED) { if (nexus.ic_state() == UNINITIALIZED) {
if (name->IsUniqueName()) { if (name->IsUniqueName()) {
nexus.ConfigureMonomorphic(name, handle(object->map()), nexus.ConfigureMonomorphic(name, handle(object->map(), isolate),
MaybeObjectHandle()); MaybeObjectHandle());
} else { } else {
nexus.ConfigureMegamorphic(PROPERTY); nexus.ConfigureMegamorphic(PROPERTY);
...@@ -860,7 +860,7 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) { ...@@ -860,7 +860,7 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) {
} else if (value->IsNull(isolate)) { } else if (value->IsNull(isolate)) {
// typeof(null) is object. But it's more user-friendly to annotate // typeof(null) is object. But it's more user-friendly to annotate
// null as type "null". // null as type "null".
type = Handle<String>(isolate->heap()->null_string()); type = Handle<String>(isolate->heap()->null_string(), isolate);
} }
DCHECK(vector->metadata()->HasTypeProfileSlot()); DCHECK(vector->metadata()->HasTypeProfileSlot());
......
...@@ -68,8 +68,9 @@ class CompiledReplacement { ...@@ -68,8 +68,9 @@ class CompiledReplacement {
: parts_(1, zone), replacement_substrings_(0, zone), zone_(zone) {} : parts_(1, zone), replacement_substrings_(0, zone), zone_(zone) {}
// Return whether the replacement is simple. // Return whether the replacement is simple.
bool Compile(Handle<JSRegExp> regexp, Handle<String> replacement, bool Compile(Isolate* isolate, Handle<JSRegExp> regexp,
int capture_count, int subject_length); Handle<String> replacement, int capture_count,
int subject_length);
// Use Apply only if Compile returned false. // Use Apply only if Compile returned false.
void Apply(ReplacementStringBuilder* builder, int match_from, int match_to, void Apply(ReplacementStringBuilder* builder, int match_from, int match_to,
...@@ -315,7 +316,7 @@ class CompiledReplacement { ...@@ -315,7 +316,7 @@ class CompiledReplacement {
Zone* zone_; Zone* zone_;
}; };
bool CompiledReplacement::Compile(Handle<JSRegExp> regexp, bool CompiledReplacement::Compile(Isolate* isolate, Handle<JSRegExp> regexp,
Handle<String> replacement, int capture_count, Handle<String> replacement, int capture_count,
int subject_length) { int subject_length) {
{ {
...@@ -347,7 +348,6 @@ bool CompiledReplacement::Compile(Handle<JSRegExp> regexp, ...@@ -347,7 +348,6 @@ bool CompiledReplacement::Compile(Handle<JSRegExp> regexp,
if (simple) return true; if (simple) return true;
} }
Isolate* isolate = replacement->GetIsolate();
// Find substrings of replacement string and create them as String objects. // Find substrings of replacement string and create them as String objects.
int substring_index = 0; int substring_index = 0;
for (int i = 0, n = parts_.length(); i < n; i++) { for (int i = 0, n = parts_.length(); i < n; i++) {
...@@ -630,7 +630,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString( ...@@ -630,7 +630,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString(
Zone zone(isolate->allocator(), ZONE_NAME); Zone zone(isolate->allocator(), ZONE_NAME);
CompiledReplacement compiled_replacement(&zone); CompiledReplacement compiled_replacement(&zone);
const bool simple_replace = compiled_replacement.Compile( const bool simple_replace = compiled_replacement.Compile(
regexp, replacement, capture_count, subject_length); isolate, regexp, replacement, capture_count, subject_length);
// Shortcut for simple non-regexp global replacements // Shortcut for simple non-regexp global replacements
if (typeTag == JSRegExp::ATOM && simple_replace) { if (typeTag == JSRegExp::ATOM && simple_replace) {
...@@ -948,7 +948,7 @@ class MatchInfoBackedMatch : public String::Match { ...@@ -948,7 +948,7 @@ class MatchInfoBackedMatch : public String::Match {
has_named_captures_ = o->IsFixedArray(); has_named_captures_ = o->IsFixedArray();
if (has_named_captures_) { if (has_named_captures_) {
DCHECK(FLAG_harmony_regexp_named_captures); DCHECK(FLAG_harmony_regexp_named_captures);
capture_name_map_ = handle(FixedArray::cast(o)); capture_name_map_ = handle(FixedArray::cast(o), isolate);
} }
} else { } else {
has_named_captures_ = false; has_named_captures_ = false;
...@@ -1154,7 +1154,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, ...@@ -1154,7 +1154,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
last_match[i] = Smi::ToInt(last_match_cache->get(i)); last_match[i] = Smi::ToInt(last_match_cache->get(i));
} }
Handle<FixedArray> cached_fixed_array = Handle<FixedArray> cached_fixed_array =
Handle<FixedArray>(FixedArray::cast(cached_answer)); Handle<FixedArray>(FixedArray::cast(cached_answer), isolate);
// The cache FixedArray is a COW-array and we need to return a copy. // The cache FixedArray is a COW-array and we need to return a copy.
Handle<FixedArray> copied_fixed_array = Handle<FixedArray> copied_fixed_array =
isolate->factory()->CopyFixedArrayWithMap( isolate->factory()->CopyFixedArrayWithMap(
...@@ -1491,7 +1491,7 @@ RUNTIME_FUNCTION(Runtime_StringReplaceNonGlobalRegExpWithFunction) { ...@@ -1491,7 +1491,7 @@ RUNTIME_FUNCTION(Runtime_StringReplaceNonGlobalRegExpWithFunction) {
Object* maybe_capture_map = regexp->CaptureNameMap(); Object* maybe_capture_map = regexp->CaptureNameMap();
if (maybe_capture_map->IsFixedArray()) { if (maybe_capture_map->IsFixedArray()) {
has_named_captures = true; has_named_captures = true;
capture_map = handle(FixedArray::cast(maybe_capture_map)); capture_map = handle(FixedArray::cast(maybe_capture_map), isolate);
} }
} }
......
...@@ -645,10 +645,9 @@ RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) { ...@@ -645,10 +645,9 @@ RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) {
return *function; return *function;
} }
static Object* FindNameClash(Handle<ScopeInfo> scope_info, static Object* FindNameClash(Isolate* isolate, Handle<ScopeInfo> scope_info,
Handle<JSGlobalObject> global_object, Handle<JSGlobalObject> global_object,
Handle<ScriptContextTable> script_context) { Handle<ScriptContextTable> script_context) {
Isolate* isolate = scope_info->GetIsolate();
for (int var = 0; var < scope_info->ContextLocalCount(); var++) { for (int var = 0; var < scope_info->ContextLocalCount(); var++) {
Handle<String> name(scope_info->ContextLocalName(var)); Handle<String> name(scope_info->ContextLocalName(var));
VariableMode mode = scope_info->ContextLocalMode(var); VariableMode mode = scope_info->ContextLocalMode(var);
...@@ -697,7 +696,7 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) { ...@@ -697,7 +696,7 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) {
native_context->script_context_table()); native_context->script_context_table());
Object* name_clash_result = Object* name_clash_result =
FindNameClash(scope_info, global_object, script_context_table); FindNameClash(isolate, scope_info, global_object, script_context_table);
if (isolate->has_pending_exception()) return name_clash_result; if (isolate->has_pending_exception()) return name_clash_result;
// We do not need script contexts here during bootstrap. // We do not need script contexts here during bootstrap.
...@@ -809,11 +808,9 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) { ...@@ -809,11 +808,9 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {
namespace { namespace {
MaybeHandle<Object> LoadLookupSlot(Handle<String> name, MaybeHandle<Object> LoadLookupSlot(Isolate* isolate, Handle<String> name,
ShouldThrow should_throw, ShouldThrow should_throw,
Handle<Object>* receiver_return = nullptr) { Handle<Object>* receiver_return = nullptr) {
Isolate* const isolate = name->GetIsolate();
int index; int index;
PropertyAttributes attributes; PropertyAttributes attributes;
InitializationFlag flag; InitializationFlag flag;
...@@ -879,7 +876,8 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlot) { ...@@ -879,7 +876,8 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlot) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
RETURN_RESULT_OR_FAILURE(isolate, LoadLookupSlot(name, kThrowOnError)); RETURN_RESULT_OR_FAILURE(isolate,
LoadLookupSlot(isolate, name, kThrowOnError));
} }
...@@ -887,7 +885,7 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) { ...@@ -887,7 +885,7 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
RETURN_RESULT_OR_FAILURE(isolate, LoadLookupSlot(name, kDontThrow)); RETURN_RESULT_OR_FAILURE(isolate, LoadLookupSlot(isolate, name, kDontThrow));
} }
...@@ -899,7 +897,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) { ...@@ -899,7 +897,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) {
Handle<Object> value; Handle<Object> value;
Handle<Object> receiver; Handle<Object> receiver;
ASSIGN_RETURN_ON_EXCEPTION_VALUE( ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, value, LoadLookupSlot(name, kThrowOnError, &receiver), isolate, value, LoadLookupSlot(isolate, name, kThrowOnError, &receiver),
MakePair(isolate->heap()->exception(), nullptr)); MakePair(isolate->heap()->exception(), nullptr));
return MakePair(*value, *receiver); return MakePair(*value, *receiver);
} }
...@@ -908,9 +906,9 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) { ...@@ -908,9 +906,9 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) {
namespace { namespace {
MaybeHandle<Object> StoreLookupSlot( MaybeHandle<Object> StoreLookupSlot(
Handle<String> name, Handle<Object> value, LanguageMode language_mode, Isolate* isolate, Handle<String> name, Handle<Object> value,
LanguageMode language_mode,
ContextLookupFlags context_lookup_flags = FOLLOW_CHAINS) { ContextLookupFlags context_lookup_flags = FOLLOW_CHAINS) {
Isolate* const isolate = name->GetIsolate();
Handle<Context> context(isolate->context(), isolate); Handle<Context> context(isolate->context(), isolate);
int index; int index;
...@@ -963,7 +961,7 @@ MaybeHandle<Object> StoreLookupSlot( ...@@ -963,7 +961,7 @@ MaybeHandle<Object> StoreLookupSlot(
isolate, NewReferenceError(MessageTemplate::kNotDefined, name), Object); isolate, NewReferenceError(MessageTemplate::kNotDefined, name), Object);
} else { } else {
// If absent in sloppy mode: add the property to the global object. // If absent in sloppy mode: add the property to the global object.
object = Handle<JSReceiver>(context->global_object()); object = handle(context->global_object(), isolate);
} }
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
...@@ -980,8 +978,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) { ...@@ -980,8 +978,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) {
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(
StoreLookupSlot(name, value, LanguageMode::kSloppy)); isolate, StoreLookupSlot(isolate, name, value, LanguageMode::kSloppy));
} }
// Store into a dynamic context for sloppy-mode block-scoped function hoisting // Store into a dynamic context for sloppy-mode block-scoped function hoisting
...@@ -995,8 +993,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_SloppyHoisting) { ...@@ -995,8 +993,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_SloppyHoisting) {
const ContextLookupFlags lookup_flags = static_cast<ContextLookupFlags>( const ContextLookupFlags lookup_flags = static_cast<ContextLookupFlags>(
FOLLOW_CONTEXT_CHAIN | STOP_AT_DECLARATION_SCOPE | SKIP_WITH_CONTEXT); FOLLOW_CONTEXT_CHAIN | STOP_AT_DECLARATION_SCOPE | SKIP_WITH_CONTEXT);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, isolate, StoreLookupSlot(isolate, name, value, LanguageMode::kSloppy,
StoreLookupSlot(name, value, LanguageMode::kSloppy, lookup_flags)); lookup_flags));
} }
RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
...@@ -1004,8 +1002,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) { ...@@ -1004,8 +1002,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, name, 0); CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(
StoreLookupSlot(name, value, LanguageMode::kStrict)); isolate, StoreLookupSlot(isolate, name, value, LanguageMode::kStrict));
} }
} // namespace internal } // namespace internal
......
...@@ -74,8 +74,8 @@ MaybeHandle<String> StringReplaceOneCharWithString( ...@@ -74,8 +74,8 @@ MaybeHandle<String> StringReplaceOneCharWithString(
recursion_limit--; recursion_limit--;
if (subject->IsConsString()) { if (subject->IsConsString()) {
ConsString* cons = ConsString::cast(*subject); ConsString* cons = ConsString::cast(*subject);
Handle<String> first = Handle<String>(cons->first()); Handle<String> first = handle(cons->first(), isolate);
Handle<String> second = Handle<String>(cons->second()); Handle<String> second = handle(cons->second(), isolate);
Handle<String> new_first; Handle<String> new_first;
if (!StringReplaceOneCharWithString(isolate, first, search, replace, found, if (!StringReplaceOneCharWithString(isolate, first, search, replace, found,
recursion_limit).ToHandle(&new_first)) { recursion_limit).ToHandle(&new_first)) {
......
...@@ -160,7 +160,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { ...@@ -160,7 +160,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) {
// Find the JavaScript function on the top of the stack. // Find the JavaScript function on the top of the stack.
JavaScriptFrameIterator it(isolate); JavaScriptFrameIterator it(isolate);
if (!it.done()) function = Handle<JSFunction>(it.frame()->function()); if (!it.done()) function = handle(it.frame()->function(), isolate);
if (function.is_null()) return isolate->heap()->undefined_value(); if (function.is_null()) return isolate->heap()->undefined_value();
// If the function is not optimized, just return. // If the function is not optimized, just return.
...@@ -271,7 +271,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { ...@@ -271,7 +271,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
// Find the JavaScript function on the top of the stack. // Find the JavaScript function on the top of the stack.
JavaScriptFrameIterator it(isolate); JavaScriptFrameIterator it(isolate);
while (!it.done() && stack_depth--) it.Advance(); while (!it.done() && stack_depth--) it.Advance();
if (!it.done()) function = Handle<JSFunction>(it.frame()->function()); if (!it.done()) function = handle(it.frame()->function(), isolate);
if (function.is_null()) return isolate->heap()->undefined_value(); if (function.is_null()) return isolate->heap()->undefined_value();
// If the function is already optimized, just return. // If the function is already optimized, just return.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment