Commit d5de8f0d authored by neis's avatar neis Committed by Commit bot

Don't wrap roots in Handle just to dereference immediately.

R=adamk@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2452543003
Cr-Commit-Position: refs/heads/master@{#40584}
parent 20c4370d
......@@ -373,7 +373,7 @@ Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) {
// Here we add info for context-allocated "this".
DCHECK_EQ(index, scope_info->ContextLocalNamesIndex());
scope_info->set(index++, *isolate->factory()->this_string());
scope_info->set(index++, isolate->heap()->this_string());
DCHECK_EQ(index, scope_info->ContextLocalInfosIndex());
const uint32_t value = VariableModeField::encode(CONST) |
InitFlagField::encode(kCreatedInitialized) |
......
......@@ -4542,7 +4542,7 @@ Genesis::Genesis(Isolate* isolate,
factory()->ReinitializeJSGlobalProxy(global_proxy, global_proxy_function);
// HookUpGlobalProxy.
global_proxy->set_native_context(*factory()->null_value());
global_proxy->set_native_context(heap()->null_value());
// DetachGlobal.
JSObject::ForceSetPrototype(global_proxy, factory()->null_value());
......
......@@ -55,7 +55,7 @@ BUILTIN(ErrorCaptureStackTrace) {
Handle<Object> stack_trace =
isolate->CaptureSimpleStackTrace(object, mode, caller);
if (!stack_trace->IsJSArray()) return *isolate->factory()->undefined_value();
if (!stack_trace->IsJSArray()) return isolate->heap()->undefined_value();
Handle<Object> formatted_stack_trace;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
......
......@@ -370,7 +370,7 @@ BUILTIN(MathHypot) {
}
if (one_arg_is_nan) {
return *isolate->factory()->nan_value();
return isolate->heap()->nan_value();
}
if (max == 0) {
......
......@@ -820,17 +820,17 @@ BUILTIN(StringPrototypeEndsWith) {
}
int start = end - search_string->length();
if (start < 0) return *isolate->factory()->false_value();
if (start < 0) return isolate->heap()->false_value();
FlatStringReader str_reader(isolate, String::Flatten(str));
FlatStringReader search_reader(isolate, String::Flatten(search_string));
for (int i = 0; i < search_string->length(); i++) {
if (str_reader.Get(start + i) != search_reader.Get(i)) {
return *isolate->factory()->false_value();
return isolate->heap()->false_value();
}
}
return *isolate->factory()->true_value();
return isolate->heap()->true_value();
}
// ES6 section 21.1.3.7
......@@ -1239,7 +1239,7 @@ BUILTIN(StringPrototypeStartsWith) {
}
if (start + search_string->length() > str->length()) {
return *isolate->factory()->false_value();
return isolate->heap()->false_value();
}
FlatStringReader str_reader(isolate, String::Flatten(str));
......@@ -1247,10 +1247,10 @@ BUILTIN(StringPrototypeStartsWith) {
for (int i = 0; i < search_string->length(); i++) {
if (str_reader.Get(start + i) != search_reader.Get(i)) {
return *isolate->factory()->false_value();
return isolate->heap()->false_value();
}
}
return *isolate->factory()->true_value();
return isolate->heap()->true_value();
}
// ES6 section 21.1.3.25 String.prototype.toString ()
......
......@@ -1494,7 +1494,7 @@ Address WasmFrame::GetCallerStackPointer() const {
Object* WasmFrame::wasm_instance() const {
Object* ret = wasm::GetOwningWasmInstance(LookupCode());
if (ret == nullptr) ret = *(isolate()->factory()->undefined_value());
if (ret == nullptr) ret = isolate()->heap()->undefined_value();
return ret;
}
......
......@@ -2379,7 +2379,7 @@ RUNTIME_FUNCTION(Runtime_LoadIC_Miss) {
} else if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) {
Handle<Name> key(vector->GetName(vector_slot), isolate);
DCHECK_NE(*key, *isolate->factory()->empty_string());
DCHECK_NE(*key, isolate->heap()->empty_string());
DCHECK_EQ(*isolate->global_object(), *receiver);
LoadGlobalICNexus nexus(vector, vector_slot);
LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
......@@ -2409,7 +2409,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
vector->GetKind(vector_slot));
Handle<String> name(vector->GetName(vector_slot), isolate);
DCHECK_NE(*name, *isolate->factory()->empty_string());
DCHECK_NE(*name, isolate->heap()->empty_string());
LoadGlobalICNexus nexus(vector, vector_slot);
LoadGlobalIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus);
......@@ -2430,7 +2430,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
DCHECK_EQ(FeedbackVectorSlotKind::LOAD_GLOBAL_IC,
vector->GetKind(vector_slot));
Handle<String> name(vector->GetName(vector_slot), isolate);
DCHECK_NE(*name, *isolate->factory()->empty_string());
DCHECK_NE(*name, isolate->heap()->empty_string());
Handle<JSGlobalObject> global = isolate->global_object();
......@@ -2443,7 +2443,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
script_contexts, lookup_result.context_index);
Handle<Object> result =
FixedArray::get(*script_context, lookup_result.slot_index, isolate);
if (*result == *isolate->factory()->the_hole_value()) {
if (*result == isolate->heap()->the_hole_value()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
}
......
......@@ -301,7 +301,7 @@ namespace {
Object* EvalFromFunctionName(Isolate* isolate, Handle<Script> script) {
if (script->eval_from_shared()->IsUndefined(isolate))
return *isolate->factory()->undefined_value();
return isolate->heap()->undefined_value();
Handle<SharedFunctionInfo> shared(
SharedFunctionInfo::cast(script->eval_from_shared()));
......@@ -315,13 +315,13 @@ Object* EvalFromFunctionName(Isolate* isolate, Handle<Script> script) {
Object* EvalFromScript(Isolate* isolate, Handle<Script> script) {
if (script->eval_from_shared()->IsUndefined(isolate))
return *isolate->factory()->undefined_value();
return isolate->heap()->undefined_value();
Handle<SharedFunctionInfo> eval_from_shared(
SharedFunctionInfo::cast(script->eval_from_shared()));
return eval_from_shared->script()->IsScript()
? eval_from_shared->script()
: *isolate->factory()->undefined_value();
: isolate->heap()->undefined_value();
}
MaybeHandle<String> FormatEvalOrigin(Isolate* isolate, Handle<Script> script) {
......
......@@ -7867,7 +7867,7 @@ uint32_t UnseededNumberDictionaryShape::HashForObject(uint32_t key,
}
Map* UnseededNumberDictionaryShape::GetMap(Isolate* isolate) {
return *isolate->factory()->unseeded_number_dictionary_map();
return isolate->heap()->unseeded_number_dictionary_map();
}
uint32_t SeededNumberDictionaryShape::SeededHash(uint32_t key, uint32_t seed) {
......
......@@ -1312,7 +1312,7 @@ void V8HeapExplorer::ExtractSharedFunctionInfoReferences(
HeapObject* obj = shared;
String* shared_name = shared->DebugName();
const char* name = NULL;
if (shared_name != *heap_->isolate()->factory()->empty_string()) {
if (shared_name != heap_->empty_string()) {
name = names_->GetName(shared_name);
TagObject(shared->code(), names_->GetFormatted("(code for %s)", name));
} else {
......
......@@ -6866,7 +6866,7 @@ void RegExpResultsCache::Enter(Isolate* isolate, Handle<String> key_string,
}
}
// Convert backing store to a copy-on-write array.
value_array->set_map_no_write_barrier(*factory->fixed_cow_array_map());
value_array->set_map_no_write_barrier(isolate->heap()->fixed_cow_array_map());
}
......
......@@ -948,7 +948,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) {
DCHECK(args.length() == 2);
if (!args[0]->IsJSGeneratorObject()) {
return *isolate->factory()->undefined_value();
return isolate->heap()->undefined_value();
}
// Check arguments.
......
......@@ -926,7 +926,7 @@ RUNTIME_FUNCTION(Runtime_BreakIteratorBreakType) {
if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) {
return *isolate->factory()->NewStringFromStaticChars("none");
} else if (status >= UBRK_WORD_NUMBER && status < UBRK_WORD_NUMBER_LIMIT) {
return *isolate->factory()->number_string();
return isolate->heap()->number_string();
} else if (status >= UBRK_WORD_LETTER && status < UBRK_WORD_LETTER_LIMIT) {
return *isolate->factory()->NewStringFromStaticChars("letter");
} else if (status >= UBRK_WORD_KANA && status < UBRK_WORD_KANA_LIMIT) {
......
......@@ -100,8 +100,8 @@ void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
}
if (ElideObject(obj)) {
return SerializeObject(*isolate()->factory()->undefined_value(),
how_to_code, where_to_point, skip);
return SerializeObject(isolate()->heap()->undefined_value(), how_to_code,
where_to_point, skip);
}
// Past this point we should not see any (context-specific) maps anymore.
CHECK(!obj->IsMap());
......
......@@ -247,7 +247,7 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
// Ensure we can skip the write barrier
Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate);
DCHECK_EQ(*factory->uninitialized_symbol(), *uninitialized_sentinel);
DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel);
for (int i = 0; i < slot_count;) {
FeedbackVectorSlot slot(i);
FeedbackVectorSlotKind kind = metadata->GetKind(slot);
......@@ -256,7 +256,7 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
Object* value;
if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) {
value = *factory->empty_weak_cell();
value = isolate->heap()->empty_weak_cell();
} else if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC ||
kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) {
value = Smi::kZero;
......
......@@ -943,7 +943,8 @@ class WasmInstanceBuilder {
JS_OBJECT_TYPE,
JSObject::kHeaderSize + kWasmInstanceInternalFieldCount * kPointerSize);
Handle<JSObject> instance = factory->NewJSObjectFromMap(map, TENURED);
instance->SetInternalField(kWasmMemObject, *factory->undefined_value());
instance->SetInternalField(kWasmMemObject,
isolate_->heap()->undefined_value());
//--------------------------------------------------------------------------
// Set up the globals for the new instance.
......@@ -962,7 +963,7 @@ class WasmInstanceBuilder {
Address old_address = owner.is_null()
? nullptr
: GetGlobalStartAddressFromCodeTemplate(
*factory->undefined_value(),
isolate_->heap()->undefined_value(),
JSObject::cast(*owner.ToHandleChecked()));
RelocateGlobals(code_table, old_address,
static_cast<Address>(global_buffer->backing_store()));
......
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