Commit 61f174a2 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[explicit isolates] Convert runtime/ to ReadOnlyRoots

In future the RO_SPACE root accessors in Heap will become private, so
instead convert them all to use ReadOnlyRoots.

Bug: v8:7786
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Ifd2f75298bacd2f6a89c551f689d269a59d87e97
Reviewed-on: https://chromium-review.googlesource.com/1124470
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54183}
parent 1fd8207b
...@@ -93,7 +93,7 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver, ...@@ -93,7 +93,7 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver,
if (key >= limit) break; if (key >= limit) break;
Maybe<bool> has_element = JSReceiver::HasElement(receiver, key); Maybe<bool> has_element = JSReceiver::HasElement(receiver, key);
MAYBE_RETURN(has_element, isolate->heap()->exception()); MAYBE_RETURN(has_element, ReadOnlyRoots(isolate).exception());
if (!has_element.FromJust()) { if (!has_element.FromJust()) {
continue; continue;
} }
...@@ -108,7 +108,7 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver, ...@@ -108,7 +108,7 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver,
// Find next free position to move elements to. // Find next free position to move elements to.
Maybe<uint32_t> free_position = Maybe<uint32_t> free_position =
FindNextFreePosition(isolate, receiver, current_pos); FindNextFreePosition(isolate, receiver, current_pos);
MAYBE_RETURN(free_position, isolate->heap()->exception()); MAYBE_RETURN(free_position, ReadOnlyRoots(isolate).exception());
current_pos = free_position.FromJust(); current_pos = free_position.FromJust();
// Do not move elements that are already in the "packed" area. // Do not move elements that are already in the "packed" area.
...@@ -148,7 +148,7 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver, ...@@ -148,7 +148,7 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver,
if (key >= limit) continue; if (key >= limit) continue;
Maybe<bool> delete_result = JSReceiver::DeleteElement(receiver, key); Maybe<bool> delete_result = JSReceiver::DeleteElement(receiver, key);
MAYBE_RETURN(delete_result, isolate->heap()->exception()); MAYBE_RETURN(delete_result, ReadOnlyRoots(isolate).exception());
} }
return *isolate->factory()->NewNumberFromUint(result); return *isolate->factory()->NewNumberFromUint(result);
...@@ -218,7 +218,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle<JSReceiver> receiver, ...@@ -218,7 +218,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle<JSReceiver> receiver,
} }
uint32_t result = 0; uint32_t result = 0;
if (elements_base->map() == isolate->heap()->fixed_double_array_map()) { if (elements_base->map() == ReadOnlyRoots(isolate).fixed_double_array_map()) {
FixedDoubleArray* elements = FixedDoubleArray::cast(*elements_base); FixedDoubleArray* elements = FixedDoubleArray::cast(*elements_base);
// Split elements into defined and the_hole, in that order. // Split elements into defined and the_hole, in that order.
unsigned int holes = limit; unsigned int holes = limit;
...@@ -367,7 +367,7 @@ RUNTIME_FUNCTION(Runtime_PrepareElementsForSort) { ...@@ -367,7 +367,7 @@ RUNTIME_FUNCTION(Runtime_PrepareElementsForSort) {
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects) { if (isolate->debug_execution_mode() == DebugInfo::kSideEffects) {
if (!isolate->debug()->PerformSideEffectCheckForObject(object)) { if (!isolate->debug()->PerformSideEffectCheckForObject(object)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
} }
...@@ -689,10 +689,10 @@ RUNTIME_FUNCTION(Runtime_HasComplexElements) { ...@@ -689,10 +689,10 @@ RUNTIME_FUNCTION(Runtime_HasComplexElements) {
for (PrototypeIterator iter(isolate, array, kStartAtReceiver); for (PrototypeIterator iter(isolate, array, kStartAtReceiver);
!iter.IsAtEnd(); iter.Advance()) { !iter.IsAtEnd(); iter.Advance()) {
if (PrototypeIterator::GetCurrent<JSReceiver>(iter)->HasComplexElements()) { if (PrototypeIterator::GetCurrent<JSReceiver>(iter)->HasComplexElements()) {
return isolate->heap()->true_value(); return ReadOnlyRoots(isolate).true_value();
} }
} }
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
// ES6 22.1.2.2 Array.isArray // ES6 22.1.2.2 Array.isArray
...@@ -701,7 +701,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIsArray) { ...@@ -701,7 +701,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIsArray) {
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
Maybe<bool> result = Object::IsArray(object); Maybe<bool> result = Object::IsArray(object);
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -754,7 +754,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) { ...@@ -754,7 +754,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) {
} }
} }
if (len == 0) return isolate->heap()->false_value(); if (len == 0) return ReadOnlyRoots(isolate).false_value();
// Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step // Let n be ? ToInteger(fromIndex). (If fromIndex is undefined, this step
// produces the value 0.) // produces the value 0.)
...@@ -773,7 +773,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) { ...@@ -773,7 +773,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) {
} else { } else {
DCHECK(from_index->IsHeapNumber()); DCHECK(from_index->IsHeapNumber());
double start_from = from_index->Number(); double start_from = from_index->Number();
if (start_from >= len) return isolate->heap()->false_value(); if (start_from >= len) return ReadOnlyRoots(isolate).false_value();
if (V8_LIKELY(std::isfinite(start_from))) { if (V8_LIKELY(std::isfinite(start_from))) {
if (start_from < 0) { if (start_from < 0) {
index = static_cast<int64_t>(std::max<double>(start_from + len, 0)); index = static_cast<int64_t>(std::max<double>(start_from + len, 0));
...@@ -795,7 +795,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) { ...@@ -795,7 +795,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) {
Maybe<bool> result = elements->IncludesValue(isolate, obj, search_element, Maybe<bool> result = elements->IncludesValue(isolate, obj, search_element,
static_cast<uint32_t>(index), static_cast<uint32_t>(index),
static_cast<uint32_t>(len)); static_cast<uint32_t>(len));
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return *isolate->factory()->ToBoolean(result.FromJust()); return *isolate->factory()->ToBoolean(result.FromJust());
} }
...@@ -815,10 +815,10 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) { ...@@ -815,10 +815,10 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) {
// If SameValueZero(searchElement, elementK) is true, return true. // If SameValueZero(searchElement, elementK) is true, return true.
if (search_element->SameValueZero(*element_k)) { if (search_element->SameValueZero(*element_k)) {
return isolate->heap()->true_value(); return ReadOnlyRoots(isolate).true_value();
} }
} }
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
RUNTIME_FUNCTION(Runtime_ArrayIndexOf) { RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
...@@ -893,7 +893,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIndexOf) { ...@@ -893,7 +893,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
Maybe<int64_t> result = elements->IndexOfValue(isolate, obj, search_element, Maybe<int64_t> result = elements->IndexOfValue(isolate, obj, search_element,
static_cast<uint32_t>(index), static_cast<uint32_t>(index),
static_cast<uint32_t>(len)); static_cast<uint32_t>(len));
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return *isolate->factory()->NewNumberFromInt64(result.FromJust()); return *isolate->factory()->NewNumberFromInt64(result.FromJust());
} }
...@@ -908,7 +908,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIndexOf) { ...@@ -908,7 +908,7 @@ RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
isolate, object, index_obj, &success); isolate, object, index_obj, &success);
DCHECK(success); DCHECK(success);
Maybe<bool> present = JSReceiver::HasProperty(&it); Maybe<bool> present = JSReceiver::HasProperty(&it);
MAYBE_RETURN(present, isolate->heap()->exception()); MAYBE_RETURN(present, ReadOnlyRoots(isolate).exception());
if (!present.FromJust()) continue; if (!present.FromJust()) continue;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element_k, ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element_k,
Object::GetProperty(&it)); Object::GetProperty(&it));
......
...@@ -103,7 +103,7 @@ RUNTIME_FUNCTION(Runtime_ThrowNotSuperConstructor) { ...@@ -103,7 +103,7 @@ RUNTIME_FUNCTION(Runtime_ThrowNotSuperConstructor) {
RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) { RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) {
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
return isolate->heap()->home_object_symbol(); return ReadOnlyRoots(isolate).home_object_symbol();
} }
namespace { namespace {
...@@ -128,7 +128,7 @@ inline void SetHomeObject(Isolate* isolate, JSFunction* method, ...@@ -128,7 +128,7 @@ inline void SetHomeObject(Isolate* isolate, JSFunction* method,
if (method->shared()->needs_home_object()) { if (method->shared()->needs_home_object()) {
const int kPropertyIndex = JSFunction::kMaybeHomeObjectDescriptorIndex; const int kPropertyIndex = JSFunction::kMaybeHomeObjectDescriptorIndex;
CHECK_EQ(method->map()->instance_descriptors()->GetKey(kPropertyIndex), CHECK_EQ(method->map()->instance_descriptors()->GetKey(kPropertyIndex),
isolate->heap()->home_object_symbol()); ReadOnlyRoots(isolate).home_object_symbol());
FieldIndex field_index = FieldIndex field_index =
FieldIndex::ForDescriptor(method->map(), kPropertyIndex); FieldIndex::ForDescriptor(method->map(), kPropertyIndex);
...@@ -287,7 +287,7 @@ bool AddDescriptorsByTemplate( ...@@ -287,7 +287,7 @@ bool AddDescriptorsByTemplate(
Handle<NumberDictionary> elements_dictionary = Handle<NumberDictionary> elements_dictionary =
*elements_dictionary_template == *elements_dictionary_template ==
isolate->heap()->empty_slow_element_dictionary() ReadOnlyRoots(isolate).empty_slow_element_dictionary()
? elements_dictionary_template ? elements_dictionary_template
: ShallowCopyDictionaryTemplate(isolate, : ShallowCopyDictionaryTemplate(isolate,
elements_dictionary_template); elements_dictionary_template);
...@@ -519,7 +519,7 @@ bool InitClassConstructor(Isolate* isolate, ...@@ -519,7 +519,7 @@ bool InitClassConstructor(Isolate* isolate,
Handle<NameDictionary>::cast(properties_template); Handle<NameDictionary>::cast(properties_template);
map->set_is_dictionary_map(true); map->set_is_dictionary_map(true);
map->InitializeDescriptors(isolate->heap()->empty_descriptor_array(), map->InitializeDescriptors(ReadOnlyRoots(isolate).empty_descriptor_array(),
LayoutDescriptor::FastPointerLayout()); LayoutDescriptor::FastPointerLayout());
map->set_is_migration_target(false); map->set_is_migration_target(false);
map->set_may_have_interesting_symbols(true); map->set_may_have_interesting_symbols(true);
......
...@@ -16,7 +16,7 @@ namespace internal { ...@@ -16,7 +16,7 @@ namespace internal {
RUNTIME_FUNCTION(Runtime_TheHole) { RUNTIME_FUNCTION(Runtime_TheHole) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
return isolate->heap()->the_hole_value(); return ReadOnlyRoots(isolate).the_hole_value();
} }
RUNTIME_FUNCTION(Runtime_SetGrow) { RUNTIME_FUNCTION(Runtime_SetGrow) {
...@@ -26,7 +26,7 @@ RUNTIME_FUNCTION(Runtime_SetGrow) { ...@@ -26,7 +26,7 @@ RUNTIME_FUNCTION(Runtime_SetGrow) {
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate); Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate);
table = OrderedHashSet::EnsureGrowable(isolate, table); table = OrderedHashSet::EnsureGrowable(isolate, table);
holder->set_table(*table); holder->set_table(*table);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -37,7 +37,7 @@ RUNTIME_FUNCTION(Runtime_SetShrink) { ...@@ -37,7 +37,7 @@ RUNTIME_FUNCTION(Runtime_SetShrink) {
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate); Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate);
table = OrderedHashSet::Shrink(isolate, table); table = OrderedHashSet::Shrink(isolate, table);
holder->set_table(*table); holder->set_table(*table);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_SetIteratorClone) { RUNTIME_FUNCTION(Runtime_SetIteratorClone) {
...@@ -57,7 +57,7 @@ RUNTIME_FUNCTION(Runtime_MapShrink) { ...@@ -57,7 +57,7 @@ RUNTIME_FUNCTION(Runtime_MapShrink) {
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate); Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate);
table = OrderedHashMap::Shrink(isolate, table); table = OrderedHashMap::Shrink(isolate, table);
holder->set_table(*table); holder->set_table(*table);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_MapGrow) { RUNTIME_FUNCTION(Runtime_MapGrow) {
...@@ -67,7 +67,7 @@ RUNTIME_FUNCTION(Runtime_MapGrow) { ...@@ -67,7 +67,7 @@ RUNTIME_FUNCTION(Runtime_MapGrow) {
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate); Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate);
table = OrderedHashMap::EnsureGrowable(isolate, table); table = OrderedHashMap::EnsureGrowable(isolate, table);
holder->set_table(*table); holder->set_table(*table);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_MapIteratorClone) { RUNTIME_FUNCTION(Runtime_MapIteratorClone) {
......
...@@ -36,7 +36,7 @@ RUNTIME_FUNCTION(Runtime_CompileLazy) { ...@@ -36,7 +36,7 @@ RUNTIME_FUNCTION(Runtime_CompileLazy) {
return isolate->StackOverflow(); return isolate->StackOverflow();
} }
if (!Compiler::Compile(function, Compiler::KEEP_EXCEPTION)) { if (!Compiler::Compile(function, Compiler::KEEP_EXCEPTION)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
DCHECK(function->is_compiled()); DCHECK(function->is_compiled());
return function->code(); return function->code();
...@@ -51,7 +51,7 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) { ...@@ -51,7 +51,7 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized_Concurrent) {
return isolate->StackOverflow(); return isolate->StackOverflow();
} }
if (!Compiler::CompileOptimized(function, ConcurrencyMode::kConcurrent)) { if (!Compiler::CompileOptimized(function, ConcurrencyMode::kConcurrent)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
DCHECK(function->is_compiled()); DCHECK(function->is_compiled());
return function->code(); return function->code();
...@@ -85,7 +85,7 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized_NotConcurrent) { ...@@ -85,7 +85,7 @@ RUNTIME_FUNCTION(Runtime_CompileOptimized_NotConcurrent) {
return isolate->StackOverflow(); return isolate->StackOverflow();
} }
if (!Compiler::CompileOptimized(function, ConcurrencyMode::kNotConcurrent)) { if (!Compiler::CompileOptimized(function, ConcurrencyMode::kNotConcurrent)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
DCHECK(function->is_compiled()); DCHECK(function->is_compiled());
return function->code(); return function->code();
...@@ -173,7 +173,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) { ...@@ -173,7 +173,7 @@ RUNTIME_FUNCTION(Runtime_NotifyDeoptimized) {
Deoptimizer::DeoptimizeFunction(*function); Deoptimizer::DeoptimizeFunction(*function);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -308,7 +308,7 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source, ...@@ -308,7 +308,7 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError( MaybeHandle<Object> maybe_error = isolate->factory()->NewEvalError(
MessageTemplate::kCodeGenFromStrings, error_message); MessageTemplate::kCodeGenFromStrings, error_message);
if (maybe_error.ToHandle(&error)) isolate->Throw(*error); if (maybe_error.ToHandle(&error)) isolate->Throw(*error);
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
// Deal with a normal eval call with a string argument. Compile it // Deal with a normal eval call with a string argument. Compile it
...@@ -320,7 +320,7 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source, ...@@ -320,7 +320,7 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
Compiler::GetFunctionFromEval(source, outer_info, context, language_mode, Compiler::GetFunctionFromEval(source, outer_info, context, language_mode,
restriction, kNoSourcePosition, restriction, kNoSourcePosition,
eval_scope_position, eval_position), eval_scope_position, eval_position),
isolate->heap()->exception()); ReadOnlyRoots(isolate).exception());
return *compiled; return *compiled;
} }
......
...@@ -84,7 +84,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) { ...@@ -84,7 +84,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
operand_scale); operand_scale);
if (side_effect_check_failed) { if (side_effect_check_failed) {
return MakePair(isolate->heap()->exception(), return MakePair(ReadOnlyRoots(isolate).exception(),
Smi::FromInt(static_cast<uint8_t>(bytecode))); Smi::FromInt(static_cast<uint8_t>(bytecode)));
} }
Object* interrupt_object = isolate->stack_guard()->HandleInterrupts(); Object* interrupt_object = isolate->stack_guard()->HandleInterrupts();
...@@ -110,7 +110,7 @@ RUNTIME_FUNCTION(Runtime_DebugBreakAtEntry) { ...@@ -110,7 +110,7 @@ RUNTIME_FUNCTION(Runtime_DebugBreakAtEntry) {
DCHECK_EQ(*function, it.frame()->function()); DCHECK_EQ(*function, it.frame()->function());
isolate->debug()->Break(it.frame(), function); isolate->debug()->Break(it.frame(), function);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) { RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) {
...@@ -128,7 +128,7 @@ RUNTIME_FUNCTION(Runtime_ScheduleBreak) { ...@@ -128,7 +128,7 @@ RUNTIME_FUNCTION(Runtime_ScheduleBreak) {
isolate->RequestInterrupt( isolate->RequestInterrupt(
[](v8::Isolate* isolate, void*) { v8::debug::BreakRightNow(isolate); }, [](v8::Isolate* isolate, void*) { v8::debug::BreakRightNow(isolate); },
nullptr); nullptr);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
template <class IteratorType> template <class IteratorType>
...@@ -246,7 +246,7 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate, ...@@ -246,7 +246,7 @@ MaybeHandle<JSArray> Runtime::GetInternalProperties(Isolate* isolate,
result->set(1, *status_str); result->set(1, *status_str);
Handle<Object> value_obj(promise->status() == Promise::kPending Handle<Object> value_obj(promise->status() == Promise::kPending
? isolate->heap()->undefined_value() ? ReadOnlyRoots(isolate).undefined_value()
: promise->result(), : promise->result(),
isolate); isolate);
Handle<String> promise_value = Handle<String> promise_value =
...@@ -314,7 +314,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) { ...@@ -314,7 +314,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) {
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
if (!args[0]->IsJSGeneratorObject()) { if (!args[0]->IsJSGeneratorObject()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// Check arguments. // Check arguments.
...@@ -323,7 +323,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) { ...@@ -323,7 +323,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) {
// Only inspect suspended generator scopes. // Only inspect suspended generator scopes.
if (!gen->is_suspended()) { if (!gen->is_suspended()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// Find the requested scope. // Find the requested scope.
...@@ -333,7 +333,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) { ...@@ -333,7 +333,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) {
n++; n++;
} }
if (it.Done()) { if (it.Done()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
return *it.MaterializeScopeDetails(); return *it.MaterializeScopeDetails();
...@@ -382,7 +382,7 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) { ...@@ -382,7 +382,7 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
Handle<Object> break_locations = Handle<Object> break_locations =
Debug::GetSourceBreakLocations(isolate, shared); Debug::GetSourceBreakLocations(isolate, shared);
if (break_locations->IsUndefined(isolate)) { if (break_locations->IsUndefined(isolate)) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// Return array as JS array // Return array as JS array
return *isolate->factory()->NewJSArrayWithElements( return *isolate->factory()->NewJSArrayWithElements(
...@@ -408,7 +408,7 @@ RUNTIME_FUNCTION(Runtime_ClearStepping) { ...@@ -408,7 +408,7 @@ RUNTIME_FUNCTION(Runtime_ClearStepping) {
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
CHECK(isolate->debug()->is_active()); CHECK(isolate->debug()->is_active());
isolate->debug()->ClearStepping(); isolate->debug()->ClearStepping();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) { RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
...@@ -420,7 +420,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) { ...@@ -420,7 +420,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
DebugScope debug_scope(isolate->debug()); DebugScope debug_scope(isolate->debug());
if (debug_scope.failed()) { if (debug_scope.failed()) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
// Fill the script objects. // Fill the script objects.
instances = isolate->debug()->GetLoadedScripts(); instances = isolate->debug()->GetLoadedScripts();
...@@ -451,7 +451,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetInferredName) { ...@@ -451,7 +451,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetInferredName) {
if (f->IsJSFunction()) { if (f->IsJSFunction()) {
return JSFunction::cast(f)->shared()->inferred_name(); return JSFunction::cast(f)->shared()->inferred_name();
} }
return isolate->heap()->empty_string(); return ReadOnlyRoots(isolate).empty_string();
} }
...@@ -463,11 +463,11 @@ RUNTIME_FUNCTION(Runtime_GetDebugContext) { ...@@ -463,11 +463,11 @@ RUNTIME_FUNCTION(Runtime_GetDebugContext) {
DebugScope debug_scope(isolate->debug()); DebugScope debug_scope(isolate->debug());
if (debug_scope.failed()) { if (debug_scope.failed()) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
context = isolate->debug()->GetDebugContext(); context = isolate->debug()->GetDebugContext();
} }
if (context.is_null()) return isolate->heap()->undefined_value(); if (context.is_null()) return ReadOnlyRoots(isolate).undefined_value();
context->set_security_token(isolate->native_context()->security_token()); context->set_security_token(isolate->native_context()->security_token());
return context->global_proxy(); return context->global_proxy();
} }
...@@ -480,7 +480,7 @@ RUNTIME_FUNCTION(Runtime_CollectGarbage) { ...@@ -480,7 +480,7 @@ RUNTIME_FUNCTION(Runtime_CollectGarbage) {
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask, isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask,
GarbageCollectionReason::kRuntime); GarbageCollectionReason::kRuntime);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -521,7 +521,7 @@ RUNTIME_FUNCTION(Runtime_GetScript) { ...@@ -521,7 +521,7 @@ RUNTIME_FUNCTION(Runtime_GetScript) {
} }
} }
if (found.is_null()) return isolate->heap()->undefined_value(); if (found.is_null()) return ReadOnlyRoots(isolate).undefined_value();
return *Script::GetWrapper(found); return *Script::GetWrapper(found);
} }
...@@ -729,10 +729,10 @@ RUNTIME_FUNCTION(Runtime_DebugOnFunctionCall) { ...@@ -729,10 +729,10 @@ RUNTIME_FUNCTION(Runtime_DebugOnFunctionCall) {
} }
if (isolate->debug_execution_mode() == DebugInfo::kSideEffects && if (isolate->debug_execution_mode() == DebugInfo::kSideEffects &&
!isolate->debug()->PerformSideEffectCheck(fun, receiver)) { !isolate->debug()->PerformSideEffectCheck(fun, receiver)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// Set one shot breakpoints for the suspended generator object. // Set one shot breakpoints for the suspended generator object.
...@@ -740,7 +740,7 @@ RUNTIME_FUNCTION(Runtime_DebugPrepareStepInSuspendedGenerator) { ...@@ -740,7 +740,7 @@ RUNTIME_FUNCTION(Runtime_DebugPrepareStepInSuspendedGenerator) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
isolate->debug()->PrepareStepInSuspendedGenerator(); isolate->debug()->PrepareStepInSuspendedGenerator();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugPushPromise) { RUNTIME_FUNCTION(Runtime_DebugPushPromise) {
...@@ -748,7 +748,7 @@ RUNTIME_FUNCTION(Runtime_DebugPushPromise) { ...@@ -748,7 +748,7 @@ RUNTIME_FUNCTION(Runtime_DebugPushPromise) {
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
isolate->PushPromise(promise); isolate->PushPromise(promise);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -756,7 +756,7 @@ RUNTIME_FUNCTION(Runtime_DebugPopPromise) { ...@@ -756,7 +756,7 @@ RUNTIME_FUNCTION(Runtime_DebugPopPromise) {
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
isolate->PopPromise(); isolate->PopPromise();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugIsActive) { RUNTIME_FUNCTION(Runtime_DebugIsActive) {
...@@ -838,7 +838,7 @@ RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) { ...@@ -838,7 +838,7 @@ RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
Coverage::SelectMode(isolate, enable ? debug::Coverage::kPreciseCount Coverage::SelectMode(isolate, enable ? debug::Coverage::kPreciseCount
: debug::Coverage::kBestEffort); : debug::Coverage::kBestEffort);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) { RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) {
...@@ -846,7 +846,7 @@ RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) { ...@@ -846,7 +846,7 @@ RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) {
CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
Coverage::SelectMode(isolate, enable ? debug::Coverage::kBlockCount Coverage::SelectMode(isolate, enable ? debug::Coverage::kBlockCount
: debug::Coverage::kBestEffort); : debug::Coverage::kBestEffort);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_IncBlockCounter) { RUNTIME_FUNCTION(Runtime_IncBlockCounter) {
...@@ -866,7 +866,7 @@ RUNTIME_FUNCTION(Runtime_IncBlockCounter) { ...@@ -866,7 +866,7 @@ RUNTIME_FUNCTION(Runtime_IncBlockCounter) {
coverage_info->IncrementBlockCount(coverage_array_slot_index); coverage_info->IncrementBlockCount(coverage_array_slot_index);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionSuspended) { RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionSuspended) {
...@@ -874,7 +874,7 @@ RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionSuspended) { ...@@ -874,7 +874,7 @@ RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionSuspended) {
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
isolate->OnAsyncFunctionStateChanged(promise, debug::kAsyncFunctionSuspended); isolate->OnAsyncFunctionStateChanged(promise, debug::kAsyncFunctionSuspended);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionFinished) { RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionFinished) {
...@@ -887,7 +887,7 @@ RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionFinished) { ...@@ -887,7 +887,7 @@ RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionFinished) {
isolate->OnAsyncFunctionStateChanged(promise, isolate->OnAsyncFunctionStateChanged(promise,
debug::kAsyncFunctionFinished); debug::kAsyncFunctionFinished);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_LiveEditPatchScript) { RUNTIME_FUNCTION(Runtime_LiveEditPatchScript) {
...@@ -924,9 +924,9 @@ RUNTIME_FUNCTION(Runtime_LiveEditPatchScript) { ...@@ -924,9 +924,9 @@ RUNTIME_FUNCTION(Runtime_LiveEditPatchScript) {
return isolate->Throw(*isolate->factory()->NewStringFromAsciiChecked( return isolate->Throw(*isolate->factory()->NewStringFromAsciiChecked(
"LiveEdit failed: FRAME_RESTART_IS_NOT_SUPPORTED")); "LiveEdit failed: FRAME_RESTART_IS_NOT_SUPPORTED"));
case v8::debug::LiveEditResult::OK: case v8::debug::LiveEditResult::OK:
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -40,7 +40,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScript) { ...@@ -40,7 +40,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScript) {
return *Script::GetWrapper(Handle<Script>::cast(script)); return *Script::GetWrapper(Handle<Script>::cast(script));
} }
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_FunctionGetScriptId) { RUNTIME_FUNCTION(Runtime_FunctionGetScriptId) {
...@@ -67,7 +67,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetSourceCode) { ...@@ -67,7 +67,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetSourceCode) {
Handle<JSFunction>::cast(function)->shared(), isolate); Handle<JSFunction>::cast(function)->shared(), isolate);
return *SharedFunctionInfo::GetSourceCode(shared); return *SharedFunctionInfo::GetSourceCode(shared);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -102,7 +102,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) { ...@@ -102,7 +102,7 @@ RUNTIME_FUNCTION(Runtime_SetCode) {
if (!source->is_compiled() && if (!source->is_compiled() &&
!Compiler::Compile(source, Compiler::KEEP_EXCEPTION)) { !Compiler::Compile(source, Compiler::KEEP_EXCEPTION)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
// Set the function data, scope info, formal parameter count, and the length // Set the function data, scope info, formal parameter count, and the length
...@@ -163,7 +163,7 @@ RUNTIME_FUNCTION(Runtime_SetNativeFlag) { ...@@ -163,7 +163,7 @@ RUNTIME_FUNCTION(Runtime_SetNativeFlag) {
JSFunction* func = JSFunction::cast(object); JSFunction* func = JSFunction::cast(object);
func->shared()->set_native(true); func->shared()->set_native(true);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
......
...@@ -39,7 +39,7 @@ RUNTIME_FUNCTION(Runtime_SetAllowAtomicsWait) { ...@@ -39,7 +39,7 @@ RUNTIME_FUNCTION(Runtime_SetAllowAtomicsWait) {
CONVERT_BOOLEAN_ARG_CHECKED(set, 0); CONVERT_BOOLEAN_ARG_CHECKED(set, 0);
isolate->set_allow_atomics_wait(set); isolate->set_allow_atomics_wait(set);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -96,7 +96,7 @@ RUNTIME_FUNCTION(Runtime_AsyncGeneratorHasCatchHandlerForPC) { ...@@ -96,7 +96,7 @@ RUNTIME_FUNCTION(Runtime_AsyncGeneratorHasCatchHandlerForPC) {
// If state is 0 ("suspendedStart"), there is guaranteed to be no catch // If state is 0 ("suspendedStart"), there is guaranteed to be no catch
// handler. Otherwise, if state is below 0, the generator is closed and will // handler. Otherwise, if state is below 0, the generator is closed and will
// not reach a catch handler. // not reach a catch handler.
if (state < 1) return isolate->heap()->false_value(); if (state < 1) return ReadOnlyRoots(isolate).false_value();
SharedFunctionInfo* shared = generator->function()->shared(); SharedFunctionInfo* shared = generator->function()->shared();
DCHECK(shared->HasBytecodeArray()); DCHECK(shared->HasBytecodeArray());
......
...@@ -27,7 +27,7 @@ RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) { ...@@ -27,7 +27,7 @@ RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
CHECK(isolate->bootstrapper()->IsActive()); CHECK(isolate->bootstrapper()->IsActive());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_ExportFromRuntime) { RUNTIME_FUNCTION(Runtime_ExportFromRuntime) {
...@@ -63,7 +63,7 @@ RUNTIME_FUNCTION(Runtime_InstallToContext) { ...@@ -63,7 +63,7 @@ RUNTIME_FUNCTION(Runtime_InstallToContext) {
CHECK_NE(index, Context::kNotFound); CHECK_NE(index, Context::kNotFound);
native_context->set(index, *object); native_context->set(index, *object);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_Throw) { RUNTIME_FUNCTION(Runtime_Throw) {
...@@ -297,7 +297,7 @@ RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) { ...@@ -297,7 +297,7 @@ RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_SMI_ARG_CHECKED(length, 0); CONVERT_SMI_ARG_CHECKED(length, 0);
if (length == 0) return isolate->heap()->empty_string(); if (length == 0) return ReadOnlyRoots(isolate).empty_string();
Handle<SeqOneByteString> result; Handle<SeqOneByteString> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate->factory()->NewRawOneByteString(length)); isolate, result, isolate->factory()->NewRawOneByteString(length));
...@@ -308,7 +308,7 @@ RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) { ...@@ -308,7 +308,7 @@ RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_SMI_ARG_CHECKED(length, 0); CONVERT_SMI_ARG_CHECKED(length, 0);
if (length == 0) return isolate->heap()->empty_string(); if (length == 0) return ReadOnlyRoots(isolate).empty_string();
Handle<SeqTwoByteString> result; Handle<SeqTwoByteString> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result, isolate->factory()->NewRawTwoByteString(length)); isolate, result, isolate->factory()->NewRawTwoByteString(length));
...@@ -471,7 +471,7 @@ RUNTIME_FUNCTION(Runtime_IncrementUseCounter) { ...@@ -471,7 +471,7 @@ RUNTIME_FUNCTION(Runtime_IncrementUseCounter) {
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_SMI_ARG_CHECKED(counter, 0); CONVERT_SMI_ARG_CHECKED(counter, 0);
isolate->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(counter)); isolate->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(counter));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) { RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
...@@ -516,7 +516,7 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) { ...@@ -516,7 +516,7 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
std::fclose(f); std::fclose(f);
else else
std::fflush(f); std::fflush(f);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} }
...@@ -587,7 +587,7 @@ RUNTIME_FUNCTION(Runtime_ReportMessage) { ...@@ -587,7 +587,7 @@ RUNTIME_FUNCTION(Runtime_ReportMessage) {
isolate->set_pending_exception(*message_obj); isolate->set_pending_exception(*message_obj);
isolate->ReportPendingMessagesFromJavaScript(); isolate->ReportPendingMessagesFromJavaScript();
isolate->clear_pending_exception(); isolate->clear_pending_exception();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} // namespace internal } // namespace internal
......
...@@ -118,7 +118,7 @@ void PrintRegisters(Isolate* isolate, std::ostream& os, bool is_input, ...@@ -118,7 +118,7 @@ void PrintRegisters(Isolate* isolate, std::ostream& os, bool is_input,
RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) { RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) {
if (!FLAG_trace_ignition) { if (!FLAG_trace_ignition) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
...@@ -147,12 +147,12 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) { ...@@ -147,12 +147,12 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeEntry) {
os << std::flush; os << std::flush;
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeExit) { RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeExit) {
if (!FLAG_trace_ignition) { if (!FLAG_trace_ignition) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
...@@ -175,7 +175,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeExit) { ...@@ -175,7 +175,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeExit) {
PrintRegisters(isolate, os, false, bytecode_iterator, accumulator); PrintRegisters(isolate, os, false, bytecode_iterator, accumulator);
os << std::flush; os << std::flush;
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
#endif #endif
...@@ -184,7 +184,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeExit) { ...@@ -184,7 +184,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceBytecodeExit) {
RUNTIME_FUNCTION(Runtime_InterpreterTraceUpdateFeedback) { RUNTIME_FUNCTION(Runtime_InterpreterTraceUpdateFeedback) {
if (!FLAG_trace_feedback_updates) { if (!FLAG_trace_feedback_updates) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
...@@ -210,7 +210,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceUpdateFeedback) { ...@@ -210,7 +210,7 @@ RUNTIME_FUNCTION(Runtime_InterpreterTraceUpdateFeedback) {
os << "]" << std::endl; os << "]" << std::endl;
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
#endif #endif
......
...@@ -204,7 +204,7 @@ RUNTIME_FUNCTION(Runtime_MarkAsInitializedIntlObjectOfType) { ...@@ -204,7 +204,7 @@ RUNTIME_FUNCTION(Runtime_MarkAsInitializedIntlObjectOfType) {
Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol(); Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol();
JSObject::SetProperty(input, marker, type, LanguageMode::kStrict).Assert(); JSObject::SetProperty(input, marker, type, LanguageMode::kStrict).Assert();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) { RUNTIME_FUNCTION(Runtime_CreateDateTimeFormat) {
...@@ -536,7 +536,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorAdoptText) { ...@@ -536,7 +536,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorAdoptText) {
break_iterator->setText(*u_text); break_iterator->setText(*u_text);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_BreakIteratorFirst) { RUNTIME_FUNCTION(Runtime_BreakIteratorFirst) {
...@@ -600,7 +600,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorBreakType) { ...@@ -600,7 +600,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorBreakType) {
if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) { if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) {
return *isolate->factory()->NewStringFromStaticChars("none"); return *isolate->factory()->NewStringFromStaticChars("none");
} else if (status >= UBRK_WORD_NUMBER && status < UBRK_WORD_NUMBER_LIMIT) { } else if (status >= UBRK_WORD_NUMBER && status < UBRK_WORD_NUMBER_LIMIT) {
return isolate->heap()->number_string(); return ReadOnlyRoots(isolate).number_string();
} else if (status >= UBRK_WORD_LETTER && status < UBRK_WORD_LETTER_LIMIT) { } else if (status >= UBRK_WORD_LETTER && status < UBRK_WORD_LETTER_LIMIT) {
return *isolate->factory()->NewStringFromStaticChars("letter"); return *isolate->factory()->NewStringFromStaticChars("letter");
} else if (status >= UBRK_WORD_KANA && status < UBRK_WORD_KANA_LIMIT) { } else if (status >= UBRK_WORD_KANA && status < UBRK_WORD_KANA_LIMIT) {
...@@ -674,7 +674,8 @@ RUNTIME_FUNCTION(Runtime_StringLocaleConvertCase) { ...@@ -674,7 +674,8 @@ RUNTIME_FUNCTION(Runtime_StringLocaleConvertCase) {
RUNTIME_FUNCTION(Runtime_DateCacheVersion) { RUNTIME_FUNCTION(Runtime_DateCacheVersion) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
if (isolate->serializer_enabled()) return isolate->heap()->undefined_value(); if (isolate->serializer_enabled())
return ReadOnlyRoots(isolate).undefined_value();
if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) { if (!isolate->eternal_handles()->Exists(EternalHandles::DATE_CACHE_VERSION)) {
Handle<FixedArray> date_cache_version = Handle<FixedArray> date_cache_version =
isolate->factory()->NewFixedArray(1, TENURED); isolate->factory()->NewFixedArray(1, TENURED);
......
...@@ -155,7 +155,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk( ...@@ -155,7 +155,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
case PACKED_ELEMENTS: case PACKED_ELEMENTS:
case HOLEY_ELEMENTS: { case HOLEY_ELEMENTS: {
Handle<FixedArray> elements(FixedArray::cast(copy->elements()), isolate); Handle<FixedArray> elements(FixedArray::cast(copy->elements()), isolate);
if (elements->map() == isolate->heap()->fixed_cow_array_map()) { if (elements->map() == ReadOnlyRoots(isolate).fixed_cow_array_map()) {
#ifdef DEBUG #ifdef DEBUG
for (int i = 0; i < elements->length(); i++) { for (int i = 0; i < elements->length(); i++) {
DCHECK(!elements->get(i)->IsJSObject()); DCHECK(!elements->get(i)->IsJSObject());
...@@ -412,7 +412,7 @@ struct ArrayBoilerplate { ...@@ -412,7 +412,7 @@ struct ArrayBoilerplate {
} else { } else {
DCHECK(IsSmiOrObjectElementsKind(constant_elements_kind)); DCHECK(IsSmiOrObjectElementsKind(constant_elements_kind));
const bool is_cow = (constant_elements_values->map() == const bool is_cow = (constant_elements_values->map() ==
isolate->heap()->fixed_cow_array_map()); ReadOnlyRoots(isolate).fixed_cow_array_map());
if (is_cow) { if (is_cow) {
copied_elements_values = constant_elements_values; copied_elements_values = constant_elements_values;
#if DEBUG #if DEBUG
......
...@@ -95,7 +95,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) { ...@@ -95,7 +95,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) {
Handle<Script> script_handle = Handle<Script>::cast(old_script); Handle<Script> script_handle = Handle<Script>::cast(old_script);
return *Script::GetWrapper(script_handle); return *Script::GetWrapper(script_handle);
} else { } else {
return isolate->heap()->null_value(); return ReadOnlyRoots(isolate).null_value();
} }
} }
...@@ -111,7 +111,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFixupScript) { ...@@ -111,7 +111,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFixupScript) {
Handle<Script> script(Script::cast(script_value->value()), isolate); Handle<Script> script(Script::cast(script_value->value()), isolate);
LiveEdit::FixupScript(isolate, script, max_function_literal_id); LiveEdit::FixupScript(isolate, script, max_function_literal_id);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) {
...@@ -122,7 +122,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { ...@@ -122,7 +122,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) {
CHECK(SharedInfoWrapper::IsInstance(shared_info)); CHECK(SharedInfoWrapper::IsInstance(shared_info));
LiveEdit::FunctionSourceUpdated(shared_info, new_function_literal_id); LiveEdit::FunctionSourceUpdated(shared_info, new_function_literal_id);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -135,7 +135,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { ...@@ -135,7 +135,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) {
CHECK(SharedInfoWrapper::IsInstance(shared_info)); CHECK(SharedInfoWrapper::IsInstance(shared_info));
LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info); LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -160,7 +160,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSetScript) { ...@@ -160,7 +160,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSetScript) {
// and we check it in this function. // and we check it in this function.
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -179,7 +179,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) { ...@@ -179,7 +179,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) {
LiveEdit::ReplaceRefToNestedFunction(isolate->heap(), parent_wrapper, LiveEdit::ReplaceRefToNestedFunction(isolate->heap(), parent_wrapper,
orig_wrapper, subst_wrapper); orig_wrapper, subst_wrapper);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -196,7 +196,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) { ...@@ -196,7 +196,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) {
CHECK(SharedInfoWrapper::IsInstance(shared_array)); CHECK(SharedInfoWrapper::IsInstance(shared_array));
LiveEdit::PatchFunctionPositions(shared_array, position_change_array); LiveEdit::PatchFunctionPositions(shared_array, position_change_array);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
......
...@@ -48,7 +48,7 @@ RUNTIME_FUNCTION(Runtime_StringParseInt) { ...@@ -48,7 +48,7 @@ RUNTIME_FUNCTION(Runtime_StringParseInt) {
} }
int radix32 = DoubleToInt32(radix->Number()); int radix32 = DoubleToInt32(radix->Number());
if (radix32 != 0 && (radix32 < 2 || radix32 > 36)) { if (radix32 != 0 && (radix32 < 2 || radix32 > 36)) {
return isolate->heap()->nan_value(); return ReadOnlyRoots(isolate).nan_value();
} }
double result = StringToInt(isolate, subject, radix32); double result = StringToInt(isolate, subject, radix32);
......
...@@ -22,7 +22,7 @@ MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate, ...@@ -22,7 +22,7 @@ MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate,
Handle<Object> key, Handle<Object> key,
bool* is_found_out) { bool* is_found_out) {
if (object->IsNullOrUndefined(isolate)) { if (object->IsNullOrUndefined(isolate)) {
if (*key == isolate->heap()->iterator_symbol()) { if (*key == ReadOnlyRoots(isolate).iterator_symbol()) {
return Runtime::ThrowIteratorError(isolate, object); return Runtime::ThrowIteratorError(isolate, object);
} }
THROW_NEW_ERROR( THROW_NEW_ERROR(
...@@ -180,9 +180,9 @@ bool DeleteObjectPropertyFast(Isolate* isolate, Handle<JSReceiver> receiver, ...@@ -180,9 +180,9 @@ bool DeleteObjectPropertyFast(Isolate* isolate, Handle<JSReceiver> receiver,
if (!index.is_inobject() && index.outobject_array_index() == 0) { if (!index.is_inobject() && index.outobject_array_index() == 0) {
DCHECK(!Map::cast(backpointer)->HasOutOfObjectProperties()); DCHECK(!Map::cast(backpointer)->HasOutOfObjectProperties());
// Clear out the properties backing store. // Clear out the properties backing store.
receiver->SetProperties(isolate->heap()->empty_fixed_array()); receiver->SetProperties(ReadOnlyRoots(isolate).empty_fixed_array());
} else { } else {
Object* filler = isolate->heap()->one_pointer_filler_map(); Object* filler = ReadOnlyRoots(isolate).one_pointer_filler_map();
JSObject::cast(*receiver)->RawFastPropertyAtPut(index, filler); JSObject::cast(*receiver)->RawFastPropertyAtPut(index, filler);
// We must clear any recorded slot for the deleted property, because // We must clear any recorded slot for the deleted property, because
// subsequent object modifications might put a raw double there. // subsequent object modifications might put a raw double there.
...@@ -315,12 +315,12 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) { ...@@ -315,12 +315,12 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) {
if (key.is_null()) { if (key.is_null()) {
DCHECK(key_is_array_index); DCHECK(key_is_array_index);
// Namespace objects can't have indexed properties. // Namespace objects can't have indexed properties.
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
Maybe<bool> result = Maybe<bool> result =
JSReceiver::HasOwnProperty(Handle<JSReceiver>::cast(object), key); JSReceiver::HasOwnProperty(Handle<JSReceiver>::cast(object), key);
if (!result.IsJust()) return isolate->heap()->exception(); if (!result.IsJust()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} else if (object->IsJSObject()) { } else if (object->IsJSObject()) {
...@@ -336,16 +336,16 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) { ...@@ -336,16 +336,16 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) {
key_is_array_index ? LookupIterator(isolate, js_obj, index, js_obj, c) key_is_array_index ? LookupIterator(isolate, js_obj, index, js_obj, c)
: LookupIterator(js_obj, key, js_obj, c); : LookupIterator(js_obj, key, js_obj, c);
Maybe<bool> maybe = JSReceiver::HasProperty(&it); Maybe<bool> maybe = JSReceiver::HasProperty(&it);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
DCHECK(!isolate->has_pending_exception()); DCHECK(!isolate->has_pending_exception());
if (maybe.FromJust()) return isolate->heap()->true_value(); if (maybe.FromJust()) return ReadOnlyRoots(isolate).true_value();
} }
Map* map = js_obj->map(); Map* map = js_obj->map();
if (!map->has_hidden_prototype() && if (!map->has_hidden_prototype() &&
(key_is_array_index ? !map->has_indexed_interceptor() (key_is_array_index ? !map->has_indexed_interceptor()
: !map->has_named_interceptor())) { : !map->has_named_interceptor())) {
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
// Slow case. // Slow case.
...@@ -355,7 +355,7 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) { ...@@ -355,7 +355,7 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) {
: LookupIterator(js_obj, key, js_obj, c); : LookupIterator(js_obj, key, js_obj, c);
Maybe<bool> maybe = JSReceiver::HasProperty(&it); Maybe<bool> maybe = JSReceiver::HasProperty(&it);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
DCHECK(!isolate->has_pending_exception()); DCHECK(!isolate->has_pending_exception());
return isolate->heap()->ToBoolean(maybe.FromJust()); return isolate->heap()->ToBoolean(maybe.FromJust());
...@@ -367,20 +367,20 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) { ...@@ -367,20 +367,20 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) {
Maybe<bool> result = Maybe<bool> result =
JSReceiver::HasOwnProperty(Handle<JSProxy>::cast(object), key); JSReceiver::HasOwnProperty(Handle<JSProxy>::cast(object), key);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} else if (object->IsString()) { } else if (object->IsString()) {
return isolate->heap()->ToBoolean( return isolate->heap()->ToBoolean(
key_is_array_index key_is_array_index
? index < static_cast<uint32_t>(String::cast(*object)->length()) ? index < static_cast<uint32_t>(String::cast(*object)->length())
: key->Equals(isolate->heap()->length_string())); : key->Equals(ReadOnlyRoots(isolate).length_string()));
} else if (object->IsNullOrUndefined(isolate)) { } else if (object->IsNullOrUndefined(isolate)) {
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject)); isolate, NewTypeError(MessageTemplate::kUndefinedOrNullToObject));
} }
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
RUNTIME_FUNCTION(Runtime_AddDictionaryProperty) { RUNTIME_FUNCTION(Runtime_AddDictionaryProperty) {
...@@ -485,13 +485,13 @@ RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { ...@@ -485,13 +485,13 @@ RUNTIME_FUNCTION(Runtime_InternalSetPrototype) {
Handle<Map> function_map(function->map(), isolate); Handle<Map> function_map(function->map(), isolate);
if (!JSFunction::SetName(function, isolate->factory()->proto_string(), if (!JSFunction::SetName(function, isolate->factory()->proto_string(),
isolate->factory()->empty_string())) { isolate->factory()->empty_string())) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
CHECK_EQ(*function_map, function->map()); CHECK_EQ(*function_map, function->map());
} }
} }
MAYBE_RETURN(JSReceiver::SetPrototype(obj, prototype, false, kThrowOnError), MAYBE_RETURN(JSReceiver::SetPrototype(obj, prototype, false, kThrowOnError),
isolate->heap()->exception()); ReadOnlyRoots(isolate).exception());
return *obj; return *obj;
} }
...@@ -602,7 +602,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) { ...@@ -602,7 +602,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
DCHECK(!name->ToArrayIndex(&index)); DCHECK(!name->ToArrayIndex(&index));
LookupIterator it(object, name, object, LookupIterator::OWN_SKIP_INTERCEPTOR); LookupIterator it(object, name, object, LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
DCHECK(!it.IsFound()); DCHECK(!it.IsFound());
#endif #endif
...@@ -628,7 +628,7 @@ RUNTIME_FUNCTION(Runtime_AddElement) { ...@@ -628,7 +628,7 @@ RUNTIME_FUNCTION(Runtime_AddElement) {
LookupIterator it(isolate, object, index, object, LookupIterator it(isolate, object, index, object,
LookupIterator::OWN_SKIP_INTERCEPTOR); LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
DCHECK(!it.IsFound()); DCHECK(!it.IsFound());
if (object->IsJSArray()) { if (object->IsJSArray()) {
...@@ -667,7 +667,7 @@ Object* DeleteProperty(Isolate* isolate, Handle<Object> object, ...@@ -667,7 +667,7 @@ Object* DeleteProperty(Isolate* isolate, Handle<Object> object,
Object::ToObject(isolate, object)); Object::ToObject(isolate, object));
Maybe<bool> result = Maybe<bool> result =
Runtime::DeleteObjectProperty(isolate, receiver, key, language_mode); Runtime::DeleteObjectProperty(isolate, receiver, key, language_mode);
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -715,7 +715,7 @@ RUNTIME_FUNCTION(Runtime_HasProperty) { ...@@ -715,7 +715,7 @@ RUNTIME_FUNCTION(Runtime_HasProperty) {
// Lookup the {name} on {receiver}. // Lookup the {name} on {receiver}.
Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name); Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(maybe.FromJust()); return isolate->heap()->ToBoolean(maybe.FromJust());
} }
...@@ -772,7 +772,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTrackingForMap) { ...@@ -772,7 +772,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTrackingForMap) {
CONVERT_ARG_HANDLE_CHECKED(Map, initial_map, 0); CONVERT_ARG_HANDLE_CHECKED(Map, initial_map, 0);
initial_map->CompleteInobjectSlackTracking(isolate); initial_map->CompleteInobjectSlackTracking(isolate);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -818,7 +818,7 @@ RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) { ...@@ -818,7 +818,7 @@ RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) {
RETURN_FAILURE_ON_EXCEPTION( RETURN_FAILURE_ON_EXCEPTION(
isolate, JSObject::DefineAccessor(obj, name, getter, setter, attrs)); isolate, JSObject::DefineAccessor(obj, name, getter, setter, attrs));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -861,7 +861,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { ...@@ -861,7 +861,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) {
Handle<Map> function_map(function->map(), isolate); Handle<Map> function_map(function->map(), isolate);
if (!JSFunction::SetName(function, name, if (!JSFunction::SetName(function, name,
isolate->factory()->empty_string())) { isolate->factory()->empty_string())) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
// Class constructors do not reserve in-object space for name field. // Class constructors do not reserve in-object space for name field.
CHECK_IMPLIES(!IsClassConstructor(function->shared()->kind()), CHECK_IMPLIES(!IsClassConstructor(function->shared()->kind()),
...@@ -892,14 +892,14 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) { ...@@ -892,14 +892,14 @@ 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(), isolate); type = Handle<String>(ReadOnlyRoots(isolate).null_string(), isolate);
} }
DCHECK(vector->metadata()->HasTypeProfileSlot()); DCHECK(vector->metadata()->HasTypeProfileSlot());
FeedbackNexus nexus(vector, vector->GetTypeProfileSlot()); FeedbackNexus nexus(vector, vector->GetTypeProfileSlot());
nexus.Collect(type, position->value()); nexus.Collect(type, position->value());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_HasFastPackedElements) { RUNTIME_FUNCTION(Runtime_HasFastPackedElements) {
...@@ -932,7 +932,7 @@ RUNTIME_FUNCTION(Runtime_ClassOf) { ...@@ -932,7 +932,7 @@ RUNTIME_FUNCTION(Runtime_ClassOf) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, obj, 0); CONVERT_ARG_CHECKED(Object, obj, 0);
if (!obj->IsJSReceiver()) return isolate->heap()->null_value(); if (!obj->IsJSReceiver()) return ReadOnlyRoots(isolate).null_value();
return JSReceiver::cast(obj)->class_name(); return JSReceiver::cast(obj)->class_name();
} }
...@@ -954,7 +954,7 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { ...@@ -954,7 +954,7 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
if (String::cast(getter->shared()->Name())->length() == 0) { if (String::cast(getter->shared()->Name())->length() == 0) {
Handle<Map> getter_map(getter->map(), isolate); Handle<Map> getter_map(getter->map(), isolate);
if (!JSFunction::SetName(getter, name, isolate->factory()->get_string())) { if (!JSFunction::SetName(getter, name, isolate->factory()->get_string())) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
CHECK_EQ(*getter_map, getter->map()); CHECK_EQ(*getter_map, getter->map());
} }
...@@ -963,7 +963,7 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) { ...@@ -963,7 +963,7 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
isolate, isolate,
JSObject::DefineAccessor(object, name, getter, JSObject::DefineAccessor(object, name, getter,
isolate->factory()->null_value(), attrs)); isolate->factory()->null_value(), attrs));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_SetDataProperties) { RUNTIME_FUNCTION(Runtime_SetDataProperties) {
...@@ -974,12 +974,12 @@ RUNTIME_FUNCTION(Runtime_SetDataProperties) { ...@@ -974,12 +974,12 @@ RUNTIME_FUNCTION(Runtime_SetDataProperties) {
// 2. If source is undefined or null, let keys be an empty List. // 2. If source is undefined or null, let keys be an empty List.
if (source->IsUndefined(isolate) || source->IsNull(isolate)) { if (source->IsUndefined(isolate) || source->IsNull(isolate)) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source), MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source),
isolate->heap()->exception()); ReadOnlyRoots(isolate).exception());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_CopyDataProperties) { RUNTIME_FUNCTION(Runtime_CopyDataProperties) {
...@@ -990,13 +990,13 @@ RUNTIME_FUNCTION(Runtime_CopyDataProperties) { ...@@ -990,13 +990,13 @@ RUNTIME_FUNCTION(Runtime_CopyDataProperties) {
// 2. If source is undefined or null, let keys be an empty List. // 2. If source is undefined or null, let keys be an empty List.
if (source->IsUndefined(isolate) || source->IsNull(isolate)) { if (source->IsUndefined(isolate) || source->IsNull(isolate)) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source, MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source,
nullptr, false), nullptr, false),
isolate->heap()->exception()); ReadOnlyRoots(isolate).exception());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) { RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) {
...@@ -1006,7 +1006,7 @@ RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) { ...@@ -1006,7 +1006,7 @@ RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) {
// 2. If source is undefined or null, let keys be an empty List. // 2. If source is undefined or null, let keys be an empty List.
if (source->IsUndefined(isolate) || source->IsNull(isolate)) { if (source->IsUndefined(isolate) || source->IsNull(isolate)) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
ScopedVector<Handle<Object>> excluded_properties(args.length() - 1); ScopedVector<Handle<Object>> excluded_properties(args.length() - 1);
...@@ -1029,7 +1029,7 @@ RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) { ...@@ -1029,7 +1029,7 @@ RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedProperties) {
isolate->factory()->NewJSObject(isolate->object_function()); isolate->factory()->NewJSObject(isolate->object_function());
MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source, MAYBE_RETURN(JSReceiver::SetOrCopyDataProperties(isolate, target, source,
&excluded_properties, false), &excluded_properties, false),
isolate->heap()->exception()); ReadOnlyRoots(isolate).exception());
return *target; return *target;
} }
...@@ -1071,7 +1071,7 @@ RUNTIME_FUNCTION(Runtime_DefineMethodsInternal) { ...@@ -1071,7 +1071,7 @@ RUNTIME_FUNCTION(Runtime_DefineMethodsInternal) {
for (int i = 0; i < keys->length(); ++i) { for (int i = 0; i < keys->length(); ++i) {
Handle<Name> key = Handle<Name>::cast(FixedArray::get(*keys, i, isolate)); Handle<Name> key = Handle<Name>::cast(FixedArray::get(*keys, i, isolate));
if (*key == isolate->heap()->constructor_string()) continue; if (*key == ReadOnlyRoots(isolate).constructor_string()) continue;
PropertyDescriptor descriptor; PropertyDescriptor descriptor;
Maybe<bool> did_get_descriptor = Maybe<bool> did_get_descriptor =
...@@ -1088,7 +1088,7 @@ RUNTIME_FUNCTION(Runtime_DefineMethodsInternal) { ...@@ -1088,7 +1088,7 @@ RUNTIME_FUNCTION(Runtime_DefineMethodsInternal) {
isolate, target, key, &descriptor, kDontThrow); isolate, target, key, &descriptor, kDontThrow);
CHECK(success.FromJust()); CHECK(success.FromJust());
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
...@@ -1102,7 +1102,7 @@ RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { ...@@ -1102,7 +1102,7 @@ RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
if (String::cast(setter->shared()->Name())->length() == 0) { if (String::cast(setter->shared()->Name())->length() == 0) {
Handle<Map> setter_map(setter->map(), isolate); Handle<Map> setter_map(setter->map(), isolate);
if (!JSFunction::SetName(setter, name, isolate->factory()->set_string())) { if (!JSFunction::SetName(setter, name, isolate->factory()->set_string())) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
CHECK_EQ(*setter_map, setter->map()); CHECK_EQ(*setter_map, setter->map());
} }
...@@ -1111,7 +1111,7 @@ RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) { ...@@ -1111,7 +1111,7 @@ RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
isolate, isolate,
JSObject::DefineAccessor(object, name, isolate->factory()->null_value(), JSObject::DefineAccessor(object, name, isolate->factory()->null_value(),
setter, attrs)); setter, attrs));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_ToObject) { RUNTIME_FUNCTION(Runtime_ToObject) {
...@@ -1204,10 +1204,10 @@ RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) { ...@@ -1204,10 +1204,10 @@ RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) {
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
if (!object->IsJSReceiver()) return isolate->heap()->false_value(); if (!object->IsJSReceiver()) return ReadOnlyRoots(isolate).false_value();
Maybe<bool> result = JSReceiver::HasInPrototypeChain( Maybe<bool> result = JSReceiver::HasInPrototypeChain(
isolate, Handle<JSReceiver>::cast(object), prototype); isolate, Handle<JSReceiver>::cast(object), prototype);
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -1231,9 +1231,9 @@ RUNTIME_FUNCTION(Runtime_CreateDataProperty) { ...@@ -1231,9 +1231,9 @@ RUNTIME_FUNCTION(Runtime_CreateDataProperty) {
bool success; bool success;
LookupIterator it = LookupIterator::PropertyOrElement( LookupIterator it = LookupIterator::PropertyOrElement(
isolate, o, key, &success, LookupIterator::OWN); isolate, o, key, &success, LookupIterator::OWN);
if (!success) return isolate->heap()->exception(); if (!success) return ReadOnlyRoots(isolate).exception();
MAYBE_RETURN(JSReceiver::CreateDataProperty(&it, value, kThrowOnError), MAYBE_RETURN(JSReceiver::CreateDataProperty(&it, value, kThrowOnError),
isolate->heap()->exception()); ReadOnlyRoots(isolate).exception());
return *value; return *value;
} }
...@@ -1268,9 +1268,9 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyDescriptor) { ...@@ -1268,9 +1268,9 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyDescriptor) {
PropertyDescriptor desc; PropertyDescriptor desc;
Maybe<bool> found = Maybe<bool> found =
JSReceiver::GetOwnPropertyDescriptor(isolate, object, name, &desc); JSReceiver::GetOwnPropertyDescriptor(isolate, object, name, &desc);
MAYBE_RETURN(found, isolate->heap()->exception()); MAYBE_RETURN(found, ReadOnlyRoots(isolate).exception());
if (!found.FromJust()) return isolate->heap()->undefined_value(); if (!found.FromJust()) return ReadOnlyRoots(isolate).undefined_value();
return *desc.ToPropertyDescriptorObject(isolate); return *desc.ToPropertyDescriptorObject(isolate);
} }
...@@ -1293,7 +1293,7 @@ RUNTIME_FUNCTION(Runtime_AddPrivateField) { ...@@ -1293,7 +1293,7 @@ RUNTIME_FUNCTION(Runtime_AddPrivateField) {
CHECK(Object::AddDataProperty(&it, value, NONE, kDontThrow, CHECK(Object::AddDataProperty(&it, value, NONE, kDontThrow,
Object::MAY_BE_STORE_FROM_KEYED) Object::MAY_BE_STORE_FROM_KEYED)
.FromJust()); .FromJust());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} // namespace internal } // namespace internal
......
...@@ -24,7 +24,7 @@ RUNTIME_FUNCTION(Runtime_Equal) { ...@@ -24,7 +24,7 @@ RUNTIME_FUNCTION(Runtime_Equal) {
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
Maybe<bool> result = Object::Equals(isolate, x, y); Maybe<bool> result = Object::Equals(isolate, x, y);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -34,7 +34,7 @@ RUNTIME_FUNCTION(Runtime_NotEqual) { ...@@ -34,7 +34,7 @@ RUNTIME_FUNCTION(Runtime_NotEqual) {
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
Maybe<bool> result = Object::Equals(isolate, x, y); Maybe<bool> result = Object::Equals(isolate, x, y);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(!result.FromJust()); return isolate->heap()->ToBoolean(!result.FromJust());
} }
...@@ -60,7 +60,7 @@ RUNTIME_FUNCTION(Runtime_LessThan) { ...@@ -60,7 +60,7 @@ RUNTIME_FUNCTION(Runtime_LessThan) {
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
Maybe<bool> result = Object::LessThan(isolate, x, y); Maybe<bool> result = Object::LessThan(isolate, x, y);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -70,7 +70,7 @@ RUNTIME_FUNCTION(Runtime_GreaterThan) { ...@@ -70,7 +70,7 @@ RUNTIME_FUNCTION(Runtime_GreaterThan) {
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
Maybe<bool> result = Object::GreaterThan(isolate, x, y); Maybe<bool> result = Object::GreaterThan(isolate, x, y);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -80,7 +80,7 @@ RUNTIME_FUNCTION(Runtime_LessThanOrEqual) { ...@@ -80,7 +80,7 @@ RUNTIME_FUNCTION(Runtime_LessThanOrEqual) {
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
Maybe<bool> result = Object::LessThanOrEqual(isolate, x, y); Maybe<bool> result = Object::LessThanOrEqual(isolate, x, y);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -90,7 +90,7 @@ RUNTIME_FUNCTION(Runtime_GreaterThanOrEqual) { ...@@ -90,7 +90,7 @@ RUNTIME_FUNCTION(Runtime_GreaterThanOrEqual) {
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0); CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1); CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
Maybe<bool> result = Object::GreaterThanOrEqual(isolate, x, y); Maybe<bool> result = Object::GreaterThanOrEqual(isolate, x, y);
if (result.IsNothing()) return isolate->heap()->exception(); if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
......
...@@ -36,7 +36,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) { ...@@ -36,7 +36,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) {
isolate->ReportPromiseReject(promise, value, isolate->ReportPromiseReject(promise, value,
v8::kPromiseRejectWithNoHandler); v8::kPromiseRejectWithNoHandler);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
...@@ -47,7 +47,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) { ...@@ -47,7 +47,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
CHECK(!promise->has_handler()); CHECK(!promise->has_handler());
isolate->ReportPromiseReject(promise, Handle<Object>(), isolate->ReportPromiseReject(promise, Handle<Object>(),
v8::kPromiseHandlerAddedAfterReject); v8::kPromiseHandlerAddedAfterReject);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) { RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
...@@ -57,14 +57,14 @@ RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) { ...@@ -57,14 +57,14 @@ RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
Handle<CallableTask> microtask = Handle<CallableTask> microtask =
isolate->factory()->NewCallableTask(function, isolate->native_context()); isolate->factory()->NewCallableTask(function, isolate->native_context());
isolate->EnqueueMicrotask(microtask); isolate->EnqueueMicrotask(microtask);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_RunMicrotasks) { RUNTIME_FUNCTION(Runtime_RunMicrotasks) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
isolate->RunMicrotasks(); isolate->RunMicrotasks();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) { RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) {
...@@ -76,7 +76,7 @@ RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) { ...@@ -76,7 +76,7 @@ RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) {
void* data = ToCData<void*>(microtask_data); void* data = ToCData<void*>(microtask_data);
callback(data); callback(data);
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_PromiseStatus) { RUNTIME_FUNCTION(Runtime_PromiseStatus) {
...@@ -100,7 +100,7 @@ RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) { ...@@ -100,7 +100,7 @@ RUNTIME_FUNCTION(Runtime_PromiseMarkAsHandled) {
CONVERT_ARG_CHECKED(JSPromise, promise, 0); CONVERT_ARG_CHECKED(JSPromise, promise, 0);
promise->set_has_handler(true); promise->set_has_handler(true);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_PromiseHookInit) { RUNTIME_FUNCTION(Runtime_PromiseHookInit) {
...@@ -109,7 +109,7 @@ RUNTIME_FUNCTION(Runtime_PromiseHookInit) { ...@@ -109,7 +109,7 @@ RUNTIME_FUNCTION(Runtime_PromiseHookInit) {
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0); CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1); CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1);
isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent); isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_AwaitPromisesInit) { RUNTIME_FUNCTION(Runtime_AwaitPromisesInit) {
...@@ -126,35 +126,37 @@ RUNTIME_FUNCTION(Runtime_AwaitPromisesInit) { ...@@ -126,35 +126,37 @@ RUNTIME_FUNCTION(Runtime_AwaitPromisesInit) {
// async_task_id as outer_promise since we generate WillHandle and DidHandle // async_task_id as outer_promise since we generate WillHandle and DidHandle
// events using throwaway promise. // events using throwaway promise.
throwaway->set_async_task_id(outer_promise->async_task_id()); throwaway->set_async_task_id(outer_promise->async_task_id());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_PromiseHookBefore) { RUNTIME_FUNCTION(Runtime_PromiseHookBefore) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, maybe_promise, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, maybe_promise, 0);
if (!maybe_promise->IsJSPromise()) return isolate->heap()->undefined_value(); if (!maybe_promise->IsJSPromise())
return ReadOnlyRoots(isolate).undefined_value();
Handle<JSPromise> promise = Handle<JSPromise>::cast(maybe_promise); Handle<JSPromise> promise = Handle<JSPromise>::cast(maybe_promise);
if (isolate->debug()->is_active()) isolate->PushPromise(promise); if (isolate->debug()->is_active()) isolate->PushPromise(promise);
if (promise->IsJSPromise()) { if (promise->IsJSPromise()) {
isolate->RunPromiseHook(PromiseHookType::kBefore, promise, isolate->RunPromiseHook(PromiseHookType::kBefore, promise,
isolate->factory()->undefined_value()); isolate->factory()->undefined_value());
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_PromiseHookAfter) { RUNTIME_FUNCTION(Runtime_PromiseHookAfter) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, maybe_promise, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, maybe_promise, 0);
if (!maybe_promise->IsJSPromise()) return isolate->heap()->undefined_value(); if (!maybe_promise->IsJSPromise())
return ReadOnlyRoots(isolate).undefined_value();
Handle<JSPromise> promise = Handle<JSPromise>::cast(maybe_promise); Handle<JSPromise> promise = Handle<JSPromise>::cast(maybe_promise);
if (isolate->debug()->is_active()) isolate->PopPromise(); if (isolate->debug()->is_active()) isolate->PopPromise();
if (promise->IsJSPromise()) { if (promise->IsJSPromise()) {
isolate->RunPromiseHook(PromiseHookType::kAfter, promise, isolate->RunPromiseHook(PromiseHookType::kAfter, promise,
isolate->factory()->undefined_value()); isolate->factory()->undefined_value());
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_RejectPromise) { RUNTIME_FUNCTION(Runtime_RejectPromise) {
......
...@@ -51,7 +51,7 @@ RUNTIME_FUNCTION(Runtime_GetPropertyWithReceiver) { ...@@ -51,7 +51,7 @@ RUNTIME_FUNCTION(Runtime_GetPropertyWithReceiver) {
&success, holder); &success, holder);
if (!success) { if (!success) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
RETURN_RESULT_OR_FAILURE(isolate, Object::GetProperty(&it)); RETURN_RESULT_OR_FAILURE(isolate, Object::GetProperty(&it));
} }
...@@ -71,11 +71,11 @@ RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) { ...@@ -71,11 +71,11 @@ RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) {
&success, holder); &success, holder);
if (!success) { if (!success) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
Maybe<bool> result = Object::SetSuperProperty( Maybe<bool> result = Object::SetSuperProperty(
&it, value, language_mode, Object::MAY_BE_STORE_FROM_KEYED); &it, value, language_mode, Object::MAY_BE_STORE_FROM_KEYED);
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return *isolate->factory()->ToBoolean(result.FromJust()); return *isolate->factory()->ToBoolean(result.FromJust());
} }
...@@ -101,7 +101,7 @@ RUNTIME_FUNCTION(Runtime_CheckProxyHasTrap) { ...@@ -101,7 +101,7 @@ RUNTIME_FUNCTION(Runtime_CheckProxyHasTrap) {
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1);
Maybe<bool> result = JSProxy::CheckHasTrap(isolate, name, target); Maybe<bool> result = JSProxy::CheckHasTrap(isolate, name, target);
if (!result.IsJust()) return isolate->heap()->exception(); if (!result.IsJust()) return ReadOnlyRoots(isolate).exception();
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
......
...@@ -557,7 +557,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalAtomRegExpWithString( ...@@ -557,7 +557,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalAtomRegExpWithString(
result_len = static_cast<int>(result_len_64); result_len = static_cast<int>(result_len_64);
} }
if (result_len == 0) { if (result_len == 0) {
return isolate->heap()->empty_string(); return ReadOnlyRoots(isolate).empty_string();
} }
int subject_pos = 0; int subject_pos = 0;
...@@ -619,7 +619,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString( ...@@ -619,7 +619,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString(
// Ensure the RegExp is compiled so we can access the capture-name map. // Ensure the RegExp is compiled so we can access the capture-name map.
if (RegExpImpl::IrregexpPrepare(isolate, regexp, subject) == -1) { if (RegExpImpl::IrregexpPrepare(isolate, regexp, subject) == -1) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
} }
...@@ -641,11 +641,11 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString( ...@@ -641,11 +641,11 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString(
} }
RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); RegExpImpl::GlobalCache global_cache(regexp, subject, isolate);
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
int32_t* current_match = global_cache.FetchNext(); int32_t* current_match = global_cache.FetchNext();
if (current_match == nullptr) { if (current_match == nullptr) {
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
return *subject; return *subject;
} }
...@@ -682,7 +682,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString( ...@@ -682,7 +682,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithString(
current_match = global_cache.FetchNext(); current_match = global_cache.FetchNext();
} while (current_match != nullptr); } while (current_match != nullptr);
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
if (prev < subject_length) { if (prev < subject_length) {
builder.EnsureCapacity(2); builder.EnsureCapacity(2);
...@@ -714,11 +714,11 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString( ...@@ -714,11 +714,11 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString(
} }
RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); RegExpImpl::GlobalCache global_cache(regexp, subject, isolate);
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
int32_t* current_match = global_cache.FetchNext(); int32_t* current_match = global_cache.FetchNext();
if (current_match == nullptr) { if (current_match == nullptr) {
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
return *subject; return *subject;
} }
...@@ -728,7 +728,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString( ...@@ -728,7 +728,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString(
int subject_length = subject->length(); int subject_length = subject->length();
int new_length = subject_length - (end - start); int new_length = subject_length - (end - start);
if (new_length == 0) return isolate->heap()->empty_string(); if (new_length == 0) return ReadOnlyRoots(isolate).empty_string();
Handle<ResultSeqString> answer; Handle<ResultSeqString> answer;
if (ResultSeqString::kHasOneByteEncoding) { if (ResultSeqString::kHasOneByteEncoding) {
...@@ -755,7 +755,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString( ...@@ -755,7 +755,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString(
current_match = global_cache.FetchNext(); current_match = global_cache.FetchNext();
} while (current_match != nullptr); } while (current_match != nullptr);
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
RegExpImpl::SetLastMatchInfo(isolate, last_match_info, subject, capture_count, RegExpImpl::SetLastMatchInfo(isolate, last_match_info, subject, capture_count,
global_cache.LastSuccessfulMatch()); global_cache.LastSuccessfulMatch());
...@@ -767,7 +767,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString( ...@@ -767,7 +767,7 @@ V8_WARN_UNUSED_RESULT static Object* StringReplaceGlobalRegExpWithEmptyString(
position += subject_length - prev; position += subject_length - prev;
} }
if (position == 0) return isolate->heap()->empty_string(); if (position == 0) return ReadOnlyRoots(isolate).empty_string();
// Shorten string and fill // Shorten string and fill
int string_size = ResultSeqString::SizeFor(position); int string_size = ResultSeqString::SizeFor(position);
...@@ -1164,7 +1164,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, ...@@ -1164,7 +1164,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
} }
RegExpImpl::GlobalCache global_cache(regexp, subject, isolate); RegExpImpl::GlobalCache global_cache(regexp, subject, isolate);
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
// Ensured in Runtime_RegExpExecMultiple. // Ensured in Runtime_RegExpExecMultiple.
DCHECK(result_array->HasObjectElements()); DCHECK(result_array->HasObjectElements());
...@@ -1232,7 +1232,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, ...@@ -1232,7 +1232,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
elements->set(cursor++, *substring); elements->set(cursor++, *substring);
} else { } else {
DCHECK_GT(0, current_match[i * 2 + 1]); DCHECK_GT(0, current_match[i * 2 + 1]);
elements->set(cursor++, isolate->heap()->undefined_value()); elements->set(cursor++, ReadOnlyRoots(isolate).undefined_value());
} }
} }
...@@ -1255,7 +1255,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, ...@@ -1255,7 +1255,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
} }
} }
if (global_cache.HasException()) return isolate->heap()->exception(); if (global_cache.HasException()) return ReadOnlyRoots(isolate).exception();
if (match_start >= 0) { if (match_start >= 0) {
// Finished matching, with at least one match. // Finished matching, with at least one match.
...@@ -1290,7 +1290,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject, ...@@ -1290,7 +1290,7 @@ static Object* SearchRegExpMultiple(Isolate* isolate, Handle<String> subject,
} }
return *builder.ToJSArray(result_array); return *builder.ToJSArray(result_array);
} else { } else {
return isolate->heap()->null_value(); // No matches at all. return ReadOnlyRoots(isolate).null_value(); // No matches at all.
} }
} }
......
...@@ -71,14 +71,14 @@ Object* DeclareGlobal( ...@@ -71,14 +71,14 @@ Object* DeclareGlobal(
} }
LookupIterator it(global, name, global, lookup_config); LookupIterator it(global, name, global, lookup_config);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
if (it.IsFound()) { if (it.IsFound()) {
PropertyAttributes old_attributes = maybe.FromJust(); PropertyAttributes old_attributes = maybe.FromJust();
// The name was declared before; check for conflicting re-declarations. // The name was declared before; check for conflicting re-declarations.
// Skip var re-declarations. // Skip var re-declarations.
if (is_var) return isolate->heap()->undefined_value(); if (is_var) return ReadOnlyRoots(isolate).undefined_value();
DCHECK(is_function_declaration); DCHECK(is_function_declaration);
if ((old_attributes & DONT_DELETE) != 0) { if ((old_attributes & DONT_DELETE) != 0) {
...@@ -128,7 +128,7 @@ Object* DeclareGlobal( ...@@ -128,7 +128,7 @@ Object* DeclareGlobal(
nexus.ConfigurePropertyCellMode(it.GetPropertyCell()); nexus.ConfigurePropertyCellMode(it.GetPropertyCell());
} }
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations, Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations,
...@@ -187,7 +187,7 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations, ...@@ -187,7 +187,7 @@ Object* DeclareGlobals(Isolate* isolate, Handle<FixedArray> declarations,
if (isolate->has_pending_exception()) return result; if (isolate->has_pending_exception()) return result;
}); });
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} // namespace } // namespace
...@@ -275,13 +275,13 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name, ...@@ -275,13 +275,13 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
DCHECK_EQ(NONE, attributes); DCHECK_EQ(NONE, attributes);
// Skip var re-declarations. // Skip var re-declarations.
if (is_var) return isolate->heap()->undefined_value(); if (is_var) return ReadOnlyRoots(isolate).undefined_value();
DCHECK(is_function); DCHECK(is_function);
if (index != Context::kNotFound) { if (index != Context::kNotFound) {
DCHECK(holder.is_identical_to(context)); DCHECK(holder.is_identical_to(context));
context->set(index, *value); context->set(index, *value);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
object = Handle<JSObject>::cast(holder); object = Handle<JSObject>::cast(holder);
...@@ -305,7 +305,7 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name, ...@@ -305,7 +305,7 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes( RETURN_FAILURE_ON_EXCEPTION(isolate, JSObject::SetOwnPropertyIgnoreAttributes(
object, name, value, NONE)); object, name, value, NONE));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
} // namespace } // namespace
...@@ -407,7 +407,8 @@ Handle<JSObject> NewSloppyArguments(Isolate* isolate, Handle<JSFunction> callee, ...@@ -407,7 +407,8 @@ Handle<JSObject> NewSloppyArguments(Isolate* isolate, Handle<JSFunction> callee,
int mapped_count = Min(argument_count, parameter_count); int mapped_count = Min(argument_count, parameter_count);
Handle<FixedArray> parameter_map = Handle<FixedArray> parameter_map =
isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED);
parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); parameter_map->set_map(
ReadOnlyRoots(isolate).sloppy_arguments_elements_map());
result->set_map(isolate->native_context()->fast_aliased_arguments_map()); result->set_map(isolate->native_context()->fast_aliased_arguments_map());
result->set_elements(*parameter_map); result->set_elements(*parameter_map);
...@@ -647,7 +648,7 @@ static Object* FindNameClash(Isolate* isolate, Handle<ScopeInfo> scope_info, ...@@ -647,7 +648,7 @@ static Object* FindNameClash(Isolate* isolate, Handle<ScopeInfo> scope_info,
LookupIterator it(global_object, name, global_object, LookupIterator it(global_object, name, global_object,
LookupIterator::OWN_SKIP_INTERCEPTOR); LookupIterator::OWN_SKIP_INTERCEPTOR);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
if (maybe.IsNothing()) return isolate->heap()->exception(); if (maybe.IsNothing()) return ReadOnlyRoots(isolate).exception();
if ((maybe.FromJust() & DONT_DELETE) != 0) { if ((maybe.FromJust() & DONT_DELETE) != 0) {
// ES#sec-globaldeclarationinstantiation 5.a: // ES#sec-globaldeclarationinstantiation 5.a:
// If envRec.HasVarDeclaration(name) is true, throw a SyntaxError // If envRec.HasVarDeclaration(name) is true, throw a SyntaxError
...@@ -661,7 +662,7 @@ static Object* FindNameClash(Isolate* isolate, Handle<ScopeInfo> scope_info, ...@@ -661,7 +662,7 @@ static Object* FindNameClash(Isolate* isolate, Handle<ScopeInfo> scope_info,
JSGlobalObject::InvalidatePropertyCell(global_object, name); JSGlobalObject::InvalidatePropertyCell(global_object, name);
} }
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -768,14 +769,15 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) { ...@@ -768,14 +769,15 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {
// If the slot was not found the result is true. // If the slot was not found the result is true.
if (holder.is_null()) { if (holder.is_null()) {
// In case of JSProxy, an exception might have been thrown. // In case of JSProxy, an exception might have been thrown.
if (isolate->has_pending_exception()) return isolate->heap()->exception(); if (isolate->has_pending_exception())
return isolate->heap()->true_value(); return ReadOnlyRoots(isolate).exception();
return ReadOnlyRoots(isolate).true_value();
} }
// If the slot was found in a context or in module imports and exports it // If the slot was found in a context or in module imports and exports it
// should be DONT_DELETE. // should be DONT_DELETE.
if (holder->IsContext() || holder->IsModule()) { if (holder->IsContext() || holder->IsModule()) {
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
// The slot was found in a JSReceiver, either a context extension object, // The slot was found in a JSReceiver, either a context extension object,
...@@ -783,7 +785,7 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) { ...@@ -783,7 +785,7 @@ RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {
// (respecting DONT_DELETE). // (respecting DONT_DELETE).
Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder); Handle<JSReceiver> object = Handle<JSReceiver>::cast(holder);
Maybe<bool> result = JSReceiver::DeleteProperty(object, name); Maybe<bool> result = JSReceiver::DeleteProperty(object, name);
MAYBE_RETURN(result, isolate->heap()->exception()); MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
return isolate->heap()->ToBoolean(result.FromJust()); return isolate->heap()->ToBoolean(result.FromJust());
} }
...@@ -880,7 +882,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) { ...@@ -880,7 +882,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) {
Handle<Object> receiver; Handle<Object> receiver;
ASSIGN_RETURN_ON_EXCEPTION_VALUE( ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, value, LoadLookupSlot(isolate, name, kThrowOnError, &receiver), isolate, value, LoadLookupSlot(isolate, name, kThrowOnError, &receiver),
MakePair(isolate->heap()->exception(), nullptr)); MakePair(ReadOnlyRoots(isolate).exception(), nullptr));
return MakePair(*value, *receiver); return MakePair(*value, *receiver);
} }
......
...@@ -123,14 +123,16 @@ RUNTIME_FUNCTION(Runtime_StringReplaceOneCharWithString) { ...@@ -123,14 +123,16 @@ RUNTIME_FUNCTION(Runtime_StringReplaceOneCharWithString) {
kRecursionLimit).ToHandle(&result)) { kRecursionLimit).ToHandle(&result)) {
return *result; return *result;
} }
if (isolate->has_pending_exception()) return isolate->heap()->exception(); if (isolate->has_pending_exception())
return ReadOnlyRoots(isolate).exception();
subject = String::Flatten(isolate, subject); subject = String::Flatten(isolate, subject);
if (StringReplaceOneCharWithString(isolate, subject, search, replace, &found, if (StringReplaceOneCharWithString(isolate, subject, search, replace, &found,
kRecursionLimit).ToHandle(&result)) { kRecursionLimit).ToHandle(&result)) {
return *result; return *result;
} }
if (isolate->has_pending_exception()) return isolate->heap()->exception(); if (isolate->has_pending_exception())
return ReadOnlyRoots(isolate).exception();
// In case of empty handle and no pending exception we have stack overflow. // In case of empty handle and no pending exception we have stack overflow.
return isolate->StackOverflow(); return isolate->StackOverflow();
} }
...@@ -166,7 +168,7 @@ RUNTIME_FUNCTION(Runtime_StringIncludes) { ...@@ -166,7 +168,7 @@ RUNTIME_FUNCTION(Runtime_StringIncludes) {
Maybe<bool> is_reg_exp = RegExpUtils::IsRegExp(isolate, search); Maybe<bool> is_reg_exp = RegExpUtils::IsRegExp(isolate, search);
if (is_reg_exp.IsNothing()) { if (is_reg_exp.IsNothing()) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
if (is_reg_exp.FromJust()) { if (is_reg_exp.FromJust()) {
THROW_NEW_ERROR_RETURN_FAILURE( THROW_NEW_ERROR_RETURN_FAILURE(
...@@ -260,7 +262,7 @@ RUNTIME_FUNCTION(Runtime_StringCharCodeAt) { ...@@ -260,7 +262,7 @@ RUNTIME_FUNCTION(Runtime_StringCharCodeAt) {
subject = String::Flatten(isolate, subject); subject = String::Flatten(isolate, subject);
if (i >= static_cast<uint32_t>(subject->length())) { if (i >= static_cast<uint32_t>(subject->length())) {
return isolate->heap()->nan_value(); return ReadOnlyRoots(isolate).nan_value();
} }
return Smi::FromInt(subject->Get(i)); return Smi::FromInt(subject->Get(i));
...@@ -289,7 +291,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderConcat) { ...@@ -289,7 +291,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderConcat) {
int special_length = special->length(); int special_length = special->length();
if (!array->HasObjectElements()) { if (!array->HasObjectElements()) {
return isolate->Throw(isolate->heap()->illegal_argument_string()); return isolate->Throw(ReadOnlyRoots(isolate).illegal_argument_string());
} }
int length; int length;
...@@ -303,7 +305,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderConcat) { ...@@ -303,7 +305,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderConcat) {
} }
if (array_length == 0) { if (array_length == 0) {
return isolate->heap()->empty_string(); return ReadOnlyRoots(isolate).empty_string();
} else if (array_length == 1) { } else if (array_length == 1) {
Object* first = fixed_array->get(0); Object* first = fixed_array->get(0);
if (first->IsString()) return first; if (first->IsString()) return first;
...@@ -313,10 +315,10 @@ RUNTIME_FUNCTION(Runtime_StringBuilderConcat) { ...@@ -313,10 +315,10 @@ RUNTIME_FUNCTION(Runtime_StringBuilderConcat) {
} }
if (length == -1) { if (length == -1) {
return isolate->Throw(isolate->heap()->illegal_argument_string()); return isolate->Throw(ReadOnlyRoots(isolate).illegal_argument_string());
} }
if (length == 0) { if (length == 0) {
return isolate->heap()->empty_string(); return ReadOnlyRoots(isolate).empty_string();
} }
if (one_byte) { if (one_byte) {
...@@ -356,7 +358,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderJoin) { ...@@ -356,7 +358,7 @@ RUNTIME_FUNCTION(Runtime_StringBuilderJoin) {
} }
if (array_length == 0) { if (array_length == 0) {
return isolate->heap()->empty_string(); return ReadOnlyRoots(isolate).empty_string();
} else if (array_length == 1) { } else if (array_length == 1) {
Object* first = fixed_array->get(0); Object* first = fixed_array->get(0);
CHECK(first->IsString()); CHECK(first->IsString());
...@@ -570,7 +572,7 @@ static int CopyCachedOneByteCharsToArray(Heap* heap, const uint8_t* chars, ...@@ -570,7 +572,7 @@ static int CopyCachedOneByteCharsToArray(Heap* heap, const uint8_t* chars,
FixedArray* elements, int length) { FixedArray* elements, int length) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
FixedArray* one_byte_cache = heap->single_character_string_cache(); FixedArray* one_byte_cache = heap->single_character_string_cache();
Object* undefined = heap->undefined_value(); Object* undefined = ReadOnlyRoots(heap).undefined_value();
int i; int i;
WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc); WriteBarrierMode mode = elements->GetWriteBarrierMode(no_gc);
for (i = 0; i < length; ++i) { for (i = 0; i < length; ++i) {
...@@ -618,8 +620,8 @@ RUNTIME_FUNCTION(Runtime_StringToArray) { ...@@ -618,8 +620,8 @@ RUNTIME_FUNCTION(Runtime_StringToArray) {
position = CopyCachedOneByteCharsToArray(isolate->heap(), chars.start(), position = CopyCachedOneByteCharsToArray(isolate->heap(), chars.start(),
*elements, length); *elements, length);
} else { } else {
MemsetPointer(elements->data_start(), isolate->heap()->undefined_value(), MemsetPointer(elements->data_start(),
length); ReadOnlyRoots(isolate).undefined_value(), length);
} }
} else { } else {
elements = isolate->factory()->NewFixedArray(length); elements = isolate->factory()->NewFixedArray(length);
...@@ -714,7 +716,7 @@ RUNTIME_FUNCTION(Runtime_StringCharFromCode) { ...@@ -714,7 +716,7 @@ RUNTIME_FUNCTION(Runtime_StringCharFromCode) {
code &= 0xFFFF; code &= 0xFFFF;
return *isolate->factory()->LookupSingleCharacterStringFromCode(code); return *isolate->factory()->LookupSingleCharacterStringFromCode(code);
} }
return isolate->heap()->empty_string(); return ReadOnlyRoots(isolate).empty_string();
} }
RUNTIME_FUNCTION(Runtime_StringMaxLength) { RUNTIME_FUNCTION(Runtime_StringMaxLength) {
......
...@@ -140,16 +140,16 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) { ...@@ -140,16 +140,16 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
// Ignore calls on non-function objects to avoid runtime errors. // Ignore calls on non-function objects to avoid runtime errors.
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
if (!function_object->IsJSFunction()) { if (!function_object->IsJSFunction()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
// If the function is not optimized, just return. // If the function is not optimized, just return.
if (!function->IsOptimized()) return isolate->heap()->undefined_value(); if (!function->IsOptimized()) return ReadOnlyRoots(isolate).undefined_value();
Deoptimizer::DeoptimizeFunction(*function); Deoptimizer::DeoptimizeFunction(*function);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -162,14 +162,14 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeNow) { ...@@ -162,14 +162,14 @@ 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(it.frame()->function(), isolate); if (!it.done()) function = handle(it.frame()->function(), isolate);
if (function.is_null()) return isolate->heap()->undefined_value(); if (function.is_null()) return ReadOnlyRoots(isolate).undefined_value();
// If the function is not optimized, just return. // If the function is not optimized, just return.
if (!function->IsOptimized()) return isolate->heap()->undefined_value(); if (!function->IsOptimized()) return ReadOnlyRoots(isolate).undefined_value();
Deoptimizer::DeoptimizeFunction(*function); Deoptimizer::DeoptimizeFunction(*function);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -177,9 +177,9 @@ RUNTIME_FUNCTION(Runtime_RunningInSimulator) { ...@@ -177,9 +177,9 @@ RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
#if defined(USE_SIMULATOR) #if defined(USE_SIMULATOR)
return isolate->heap()->true_value(); return ReadOnlyRoots(isolate).true_value();
#else #else
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
#endif #endif
} }
...@@ -196,14 +196,14 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { ...@@ -196,14 +196,14 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
// This function is used by fuzzers, ignore calls with bogus arguments count. // This function is used by fuzzers, ignore calls with bogus arguments count.
if (args.length() != 1 && args.length() != 2) { if (args.length() != 1 && args.length() != 2) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// This function is used by fuzzers to get coverage for optimizations // This function is used by fuzzers to get coverage for optimizations
// in compiler. Ignore calls on non-function objects to avoid runtime errors. // in compiler. Ignore calls on non-function objects to avoid runtime errors.
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
if (!function_object->IsJSFunction()) { if (!function_object->IsJSFunction()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
...@@ -211,24 +211,24 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { ...@@ -211,24 +211,24 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
// JSFunction::MarkForOptimization(). // JSFunction::MarkForOptimization().
if (!function->shared()->allows_lazy_compilation()) { if (!function->shared()->allows_lazy_compilation()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// If function isn't compiled, compile it now. // If function isn't compiled, compile it now.
if (!function->shared()->is_compiled() && if (!function->shared()->is_compiled() &&
!Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) { !Compiler::Compile(function, Compiler::CLEAR_EXCEPTION)) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// If the function is already optimized, just return. // If the function is already optimized, just return.
if (function->IsOptimized() || function->shared()->HasAsmWasmData()) { if (function->IsOptimized() || function->shared()->HasAsmWasmData()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// If the function has optimized code, ensure that we check for it and return. // If the function has optimized code, ensure that we check for it and return.
if (function->HasOptimizedCode()) { if (function->HasOptimizedCode()) {
DCHECK(function->ChecksOptimizationMarker()); DCHECK(function->ChecksOptimizationMarker());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
ConcurrencyMode concurrency_mode = ConcurrencyMode::kNotConcurrent; ConcurrencyMode concurrency_mode = ConcurrencyMode::kNotConcurrent;
...@@ -257,7 +257,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { ...@@ -257,7 +257,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
JSFunction::EnsureFeedbackVector(function); JSFunction::EnsureFeedbackVector(function);
function->MarkForOptimization(concurrency_mode); function->MarkForOptimization(concurrency_mode);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_OptimizeOsr) { RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
...@@ -273,10 +273,10 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { ...@@ -273,10 +273,10 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
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(it.frame()->function(), isolate); if (!it.done()) function = handle(it.frame()->function(), isolate);
if (function.is_null()) return isolate->heap()->undefined_value(); if (function.is_null()) return ReadOnlyRoots(isolate).undefined_value();
// If the function is already optimized, just return. // If the function is already optimized, just return.
if (function->IsOptimized()) return isolate->heap()->undefined_value(); if (function->IsOptimized()) return ReadOnlyRoots(isolate).undefined_value();
// Ensure that the function is marked for non-concurrent optimization, so that // Ensure that the function is marked for non-concurrent optimization, so that
// subsequent runs don't also optimize. // subsequent runs don't also optimize.
...@@ -295,7 +295,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) { ...@@ -295,7 +295,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
it.frame(), AbstractCode::kMaxLoopNestingMarker); it.frame(), AbstractCode::kMaxLoopNestingMarker);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -306,12 +306,12 @@ RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) { ...@@ -306,12 +306,12 @@ RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
// in compiler. Ignore calls on non-function objects to avoid runtime errors. // in compiler. Ignore calls on non-function objects to avoid runtime errors.
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
if (!function_object->IsJSFunction()) { if (!function_object->IsJSFunction()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
function->shared()->DisableOptimization( function->shared()->DisableOptimization(
BailoutReason::kOptimizationDisabledForTest); BailoutReason::kOptimizationDisabledForTest);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
...@@ -340,7 +340,8 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { ...@@ -340,7 +340,8 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
bool sync_with_compiler_thread = true; bool sync_with_compiler_thread = true;
if (args.length() == 2) { if (args.length() == 2) {
CONVERT_ARG_HANDLE_CHECKED(Object, sync_object, 1); CONVERT_ARG_HANDLE_CHECKED(Object, sync_object, 1);
if (!sync_object->IsString()) return isolate->heap()->undefined_value(); if (!sync_object->IsString())
return ReadOnlyRoots(isolate).undefined_value();
Handle<String> sync = Handle<String>::cast(sync_object); Handle<String> sync = Handle<String>::cast(sync_object);
if (sync->IsOneByteEqualTo(STATIC_CHAR_VECTOR("no sync"))) { if (sync->IsOneByteEqualTo(STATIC_CHAR_VECTOR("no sync"))) {
sync_with_compiler_thread = false; sync_with_compiler_thread = false;
...@@ -402,7 +403,7 @@ RUNTIME_FUNCTION(Runtime_UnblockConcurrentRecompilation) { ...@@ -402,7 +403,7 @@ RUNTIME_FUNCTION(Runtime_UnblockConcurrentRecompilation) {
isolate->concurrent_recompilation_enabled()) { isolate->concurrent_recompilation_enabled()) {
isolate->optimizing_compile_dispatcher()->Unblock(); isolate->optimizing_compile_dispatcher()->Unblock();
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_GetDeoptCount) { RUNTIME_FUNCTION(Runtime_GetDeoptCount) {
...@@ -467,7 +468,7 @@ RUNTIME_FUNCTION(Runtime_ClearFunctionFeedback) { ...@@ -467,7 +468,7 @@ RUNTIME_FUNCTION(Runtime_ClearFunctionFeedback) {
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
function->ClearTypeFeedbackInfo(); function->ClearTypeFeedbackInfo();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) { RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) {
...@@ -480,7 +481,7 @@ RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) { ...@@ -480,7 +481,7 @@ RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) {
ctrl.AllowAnySizeForAsync = allow_async; ctrl.AllowAnySizeForAsync = allow_async;
ctrl.MaxWasmBufferSize = static_cast<uint32_t>(block_size->value()); ctrl.MaxWasmBufferSize = static_cast<uint32_t>(block_size->value());
v8_isolate->SetWasmModuleCallback(WasmModuleOverride); v8_isolate->SetWasmModuleCallback(WasmModuleOverride);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_SetWasmInstantiateControls) { RUNTIME_FUNCTION(Runtime_SetWasmInstantiateControls) {
...@@ -488,14 +489,14 @@ RUNTIME_FUNCTION(Runtime_SetWasmInstantiateControls) { ...@@ -488,14 +489,14 @@ RUNTIME_FUNCTION(Runtime_SetWasmInstantiateControls) {
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
CHECK_EQ(args.length(), 0); CHECK_EQ(args.length(), 0);
v8_isolate->SetWasmInstanceCallback(WasmInstanceOverride); v8_isolate->SetWasmInstanceCallback(WasmInstanceOverride);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_NotifyContextDisposed) { RUNTIME_FUNCTION(Runtime_NotifyContextDisposed) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
isolate->heap()->NotifyContextDisposed(true); isolate->heap()->NotifyContextDisposed(true);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -519,7 +520,7 @@ RUNTIME_FUNCTION(Runtime_SetAllocationTimeout) { ...@@ -519,7 +520,7 @@ RUNTIME_FUNCTION(Runtime_SetAllocationTimeout) {
} }
} }
#endif #endif
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -596,14 +597,14 @@ RUNTIME_FUNCTION(Runtime_PrintWithNameForAssert) { ...@@ -596,14 +597,14 @@ RUNTIME_FUNCTION(Runtime_PrintWithNameForAssert) {
args[1]->ShortPrint(); args[1]->ShortPrint();
PrintF("\n"); PrintF("\n");
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugTrace) { RUNTIME_FUNCTION(Runtime_DebugTrace) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
isolate->PrintStack(stdout); isolate->PrintStack(stdout);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) { RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) {
...@@ -628,7 +629,7 @@ RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) { ...@@ -628,7 +629,7 @@ RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) {
} }
isolate->heap()->AddRetainingPathTarget(object, option); isolate->heap()->AddRetainingPathTarget(object, option);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// This will not allocate (flatten the string), but it may run // This will not allocate (flatten the string), but it may run
...@@ -653,7 +654,7 @@ RUNTIME_FUNCTION(Runtime_SystemBreak) { ...@@ -653,7 +654,7 @@ RUNTIME_FUNCTION(Runtime_SystemBreak) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(0, args.length()); DCHECK_EQ(0, args.length());
base::OS::DebugBreak(); base::OS::DebugBreak();
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -665,7 +666,7 @@ RUNTIME_FUNCTION(Runtime_SetFlags) { ...@@ -665,7 +666,7 @@ RUNTIME_FUNCTION(Runtime_SetFlags) {
std::unique_ptr<char[]> flags = std::unique_ptr<char[]> flags =
arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL);
FlagList::SetFlagsFromString(flags.get(), StrLength(flags.get())); FlagList::SetFlagsFromString(flags.get(), StrLength(flags.get()));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_SetForceSlowPath) { RUNTIME_FUNCTION(Runtime_SetForceSlowPath) {
...@@ -678,7 +679,7 @@ RUNTIME_FUNCTION(Runtime_SetForceSlowPath) { ...@@ -678,7 +679,7 @@ RUNTIME_FUNCTION(Runtime_SetForceSlowPath) {
DCHECK(arg->IsFalse(isolate)); DCHECK(arg->IsFalse(isolate));
isolate->set_force_slow_path(false); isolate->set_force_slow_path(false);
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_Abort) { RUNTIME_FUNCTION(Runtime_Abort) {
...@@ -722,13 +723,13 @@ RUNTIME_FUNCTION(Runtime_DisassembleFunction) { ...@@ -722,13 +723,13 @@ RUNTIME_FUNCTION(Runtime_DisassembleFunction) {
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
if (!func->is_compiled() && if (!func->is_compiled() &&
!Compiler::Compile(func, Compiler::KEEP_EXCEPTION)) { !Compiler::Compile(func, Compiler::KEEP_EXCEPTION)) {
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
StdoutStream os; StdoutStream os;
func->code()->Print(isolate, os); func->code()->Print(isolate, os);
os << std::endl; os << std::endl;
#endif // DEBUG #endif // DEBUG
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
namespace { namespace {
...@@ -757,7 +758,7 @@ RUNTIME_FUNCTION(Runtime_TraceEnter) { ...@@ -757,7 +758,7 @@ RUNTIME_FUNCTION(Runtime_TraceEnter) {
PrintIndentation(isolate); PrintIndentation(isolate);
JavaScriptFrame::PrintTop(isolate, stdout, true, false); JavaScriptFrame::PrintTop(isolate, stdout, true, false);
PrintF(" {\n"); PrintF(" {\n");
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
...@@ -794,14 +795,14 @@ RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) { ...@@ -794,14 +795,14 @@ RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) {
CONVERT_ARG_CHECKED(JSFunction, function, 0); CONVERT_ARG_CHECKED(JSFunction, function, 0);
if (!function->shared()->HasAsmWasmData()) { if (!function->shared()->HasAsmWasmData()) {
// Doesn't have wasm data. // Doesn't have wasm data.
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
if (function->shared()->HasBuiltinId() && if (function->shared()->HasBuiltinId() &&
function->shared()->builtin_id() == Builtins::kInstantiateAsmJs) { function->shared()->builtin_id() == Builtins::kInstantiateAsmJs) {
// Hasn't been compiled yet. // Hasn't been compiled yet.
return isolate->heap()->false_value(); return ReadOnlyRoots(isolate).false_value();
} }
return isolate->heap()->true_value(); return ReadOnlyRoots(isolate).true_value();
} }
namespace { namespace {
...@@ -818,7 +819,7 @@ RUNTIME_FUNCTION(Runtime_DisallowCodegenFromStrings) { ...@@ -818,7 +819,7 @@ RUNTIME_FUNCTION(Runtime_DisallowCodegenFromStrings) {
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8_isolate->SetAllowCodeGenerationFromStringsCallback( v8_isolate->SetAllowCodeGenerationFromStringsCallback(
flag ? DisallowCodegenFromStringsCallback : nullptr); flag ? DisallowCodegenFromStringsCallback : nullptr);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) { RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) {
...@@ -828,7 +829,7 @@ RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) { ...@@ -828,7 +829,7 @@ RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) {
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
v8_isolate->SetAllowWasmCodeGenerationCallback( v8_isolate->SetAllowWasmCodeGenerationCallback(
flag ? DisallowCodegenFromStringsCallback : nullptr); flag ? DisallowCodegenFromStringsCallback : nullptr);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_IsWasmCode) { RUNTIME_FUNCTION(Runtime_IsWasmCode) {
...@@ -919,7 +920,7 @@ RUNTIME_FUNCTION(Runtime_SerializeWasmModule) { ...@@ -919,7 +920,7 @@ RUNTIME_FUNCTION(Runtime_SerializeWasmModule) {
!wasm::SerializeNativeModule( !wasm::SerializeNativeModule(
isolate, native_module, isolate, native_module,
{reinterpret_cast<uint8_t*>(array_data), compiled_size})) { {reinterpret_cast<uint8_t*>(array_data), compiled_size})) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
return *array_buffer; return *array_buffer;
} }
...@@ -954,7 +955,7 @@ RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) { ...@@ -954,7 +955,7 @@ RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
} }
Handle<WasmModuleObject> module_object; Handle<WasmModuleObject> module_object;
if (!maybe_module_object.ToHandle(&module_object)) { if (!maybe_module_object.ToHandle(&module_object)) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
return *module_object; return *module_object;
} }
...@@ -1006,7 +1007,7 @@ RUNTIME_FUNCTION(Runtime_RedirectToWasmInterpreter) { ...@@ -1006,7 +1007,7 @@ RUNTIME_FUNCTION(Runtime_RedirectToWasmInterpreter) {
WasmInstanceObject::GetOrCreateDebugInfo(instance); WasmInstanceObject::GetOrCreateDebugInfo(instance);
WasmDebugInfo::RedirectToInterpreter(debug_info, WasmDebugInfo::RedirectToInterpreter(debug_info,
Vector<int>(&function_index, 1)); Vector<int>(&function_index, 1));
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_WasmTraceMemory) { RUNTIME_FUNCTION(Runtime_WasmTraceMemory) {
...@@ -1035,7 +1036,7 @@ RUNTIME_FUNCTION(Runtime_WasmTraceMemory) { ...@@ -1035,7 +1036,7 @@ RUNTIME_FUNCTION(Runtime_WasmTraceMemory) {
: wasm::ExecutionEngine::kTurbofan; : wasm::ExecutionEngine::kTurbofan;
wasm::TraceMemoryOperation(eng, info, func_index, pos - func_start, wasm::TraceMemoryOperation(eng, info, func_index, pos - func_start,
mem_start); mem_start);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_IsLiftoffFunction) { RUNTIME_FUNCTION(Runtime_IsLiftoffFunction) {
...@@ -1060,7 +1061,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTracking) { ...@@ -1060,7 +1061,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTracking) {
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
object->map()->CompleteInobjectSlackTracking(isolate); object->map()->CompleteInobjectSlackTracking(isolate);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_FreezeWasmLazyCompilation) { RUNTIME_FUNCTION(Runtime_FreezeWasmLazyCompilation) {
...@@ -1069,7 +1070,7 @@ RUNTIME_FUNCTION(Runtime_FreezeWasmLazyCompilation) { ...@@ -1069,7 +1070,7 @@ RUNTIME_FUNCTION(Runtime_FreezeWasmLazyCompilation) {
CONVERT_ARG_CHECKED(WasmInstanceObject, instance, 0); CONVERT_ARG_CHECKED(WasmInstanceObject, instance, 0);
instance->module_object()->native_module()->set_lazy_compile_frozen(true); instance->module_object()->native_module()->set_lazy_compile_frozen(true);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_WasmMemoryHasFullGuardRegion) { RUNTIME_FUNCTION(Runtime_WasmMemoryHasFullGuardRegion) {
......
...@@ -26,11 +26,11 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) { ...@@ -26,11 +26,11 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) {
} }
Handle<JSArrayBuffer> array_buffer = Handle<JSArrayBuffer>::cast(argument); Handle<JSArrayBuffer> array_buffer = Handle<JSArrayBuffer>::cast(argument);
if (!array_buffer->is_neuterable()) { if (!array_buffer->is_neuterable()) {
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
if (array_buffer->backing_store() == nullptr) { if (array_buffer->backing_store() == nullptr) {
CHECK_EQ(Smi::kZero, array_buffer->byte_length()); CHECK_EQ(Smi::kZero, array_buffer->byte_length());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
// Shared array buffers should never be neutered. // Shared array buffers should never be neutered.
CHECK(!array_buffer->is_shared()); CHECK(!array_buffer->is_shared());
...@@ -41,7 +41,7 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) { ...@@ -41,7 +41,7 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferNeuter) {
isolate->heap()->UnregisterArrayBuffer(*array_buffer); isolate->heap()->UnregisterArrayBuffer(*array_buffer);
array_buffer->Neuter(); array_buffer->Neuter();
isolate->array_buffer_allocator()->Free(backing_store, byte_length); isolate->array_buffer_allocator()->Free(backing_store, byte_length);
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) { RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) {
......
...@@ -136,7 +136,7 @@ RUNTIME_FUNCTION(Runtime_WasmThrowCreate) { ...@@ -136,7 +136,7 @@ RUNTIME_FUNCTION(Runtime_WasmThrowCreate) {
wasm::WasmException::kRuntimeValuesStr), wasm::WasmException::kRuntimeValuesStr),
values, LanguageMode::kStrict) values, LanguageMode::kStrict)
.is_null()); .is_null());
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_WasmThrow) { RUNTIME_FUNCTION(Runtime_WasmThrow) {
...@@ -226,7 +226,7 @@ RUNTIME_FUNCTION(Runtime_WasmExceptionSetElement) { ...@@ -226,7 +226,7 @@ RUNTIME_FUNCTION(Runtime_WasmExceptionSetElement) {
} }
} }
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) {
...@@ -267,9 +267,9 @@ RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) { ...@@ -267,9 +267,9 @@ RUNTIME_FUNCTION(Runtime_WasmRunInterpreter) {
if (!success) { if (!success) {
DCHECK(isolate->has_pending_exception()); DCHECK(isolate->has_pending_exception());
return isolate->heap()->exception(); return ReadOnlyRoots(isolate).exception();
} }
return isolate->heap()->undefined_value(); return ReadOnlyRoots(isolate).undefined_value();
} }
RUNTIME_FUNCTION(Runtime_WasmStackGuard) { RUNTIME_FUNCTION(Runtime_WasmStackGuard) {
......
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