Commit 735a5073 authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Improve HConstant::ImmortalImmovable() to check for all immortal immovable roots.

Move the list to IMMORTAL_IMMOVABLE_ROOT_LIST in heap.h, and
automatically include INTERNALIZED_STRING_LIST and STRING_TYPE_LIST.

R=hpayer@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/146623003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18970 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent dae054e7
......@@ -208,6 +208,51 @@ namespace internal {
STRONG_ROOT_LIST(V) \
V(StringTable, string_table, StringTable)
// Heap roots that are known to be immortal immovable, for which we can safely
// skip write barriers.
#define IMMORTAL_IMMOVABLE_ROOT_LIST(V) \
V(byte_array_map) \
V(free_space_map) \
V(one_pointer_filler_map) \
V(two_pointer_filler_map) \
V(undefined_value) \
V(the_hole_value) \
V(null_value) \
V(true_value) \
V(false_value) \
V(uninitialized_value) \
V(cell_map) \
V(global_property_cell_map) \
V(shared_function_info_map) \
V(meta_map) \
V(heap_number_map) \
V(native_context_map) \
V(fixed_array_map) \
V(code_map) \
V(scope_info_map) \
V(fixed_cow_array_map) \
V(fixed_double_array_map) \
V(constant_pool_array_map) \
V(no_interceptor_result_sentinel) \
V(hash_table_map) \
V(empty_fixed_array) \
V(empty_byte_array) \
V(empty_descriptor_array) \
V(empty_constant_pool_array) \
V(arguments_marker) \
V(symbol_map) \
V(non_strict_arguments_elements_map) \
V(function_context_map) \
V(catch_context_map) \
V(with_context_map) \
V(block_context_map) \
V(module_context_map) \
V(global_context_map) \
V(oddball_map) \
V(message_object_map) \
V(foreign_map) \
V(neander_map)
#define INTERNALIZED_STRING_LIST(V) \
V(Array_string, "Array") \
V(Object_string, "Object") \
......
......@@ -2611,6 +2611,41 @@ void HConstant::Initialize(Representation r) {
}
bool HConstant::ImmortalImmovable() const {
if (has_int32_value_) {
return false;
}
if (has_double_value_) {
if (IsSpecialDouble()) {
return true;
}
return false;
}
if (has_external_reference_value_) {
return false;
}
ASSERT(!object_.handle().is_null());
Heap* heap = isolate()->heap();
ASSERT(!object_.IsKnownGlobal(heap->minus_zero_value()));
ASSERT(!object_.IsKnownGlobal(heap->nan_value()));
return
#define IMMORTAL_IMMOVABLE_ROOT(name) \
object_.IsKnownGlobal(heap->name()) ||
IMMORTAL_IMMOVABLE_ROOT_LIST(IMMORTAL_IMMOVABLE_ROOT)
#undef IMMORTAL_IMMOVABLE_ROOT
#define INTERNALIZED_STRING(name, value) \
object_.IsKnownGlobal(heap->name()) ||
INTERNALIZED_STRING_LIST(INTERNALIZED_STRING)
#undef INTERNALIZED_STRING
#define STRING_TYPE(NAME, size, name, Name) \
object_.IsKnownGlobal(heap->name##_map()) ||
STRING_TYPE_LIST(STRING_TYPE)
#undef STRING_TYPE
false;
}
bool HConstant::EmitAtUses() {
ASSERT(IsLinked());
if (block()->graph()->has_osr() &&
......
......@@ -3390,34 +3390,7 @@ class HConstant V8_FINAL : public HTemplateInstruction<0> {
return is_not_in_new_space_;
}
bool ImmortalImmovable() const {
if (has_int32_value_) {
return false;
}
if (has_double_value_) {
if (IsSpecialDouble()) {
return true;
}
return false;
}
if (has_external_reference_value_) {
return false;
}
ASSERT(!object_.handle().is_null());
Heap* heap = isolate()->heap();
ASSERT(!object_.IsKnownGlobal(heap->minus_zero_value()));
ASSERT(!object_.IsKnownGlobal(heap->nan_value()));
return
object_.IsKnownGlobal(heap->undefined_value()) ||
object_.IsKnownGlobal(heap->uninitialized_value()) ||
object_.IsKnownGlobal(heap->null_value()) ||
object_.IsKnownGlobal(heap->true_value()) ||
object_.IsKnownGlobal(heap->false_value()) ||
object_.IsKnownGlobal(heap->the_hole_value()) ||
object_.IsKnownGlobal(heap->empty_string()) ||
object_.IsKnownGlobal(heap->empty_fixed_array());
}
bool ImmortalImmovable() const;
bool IsCell() const {
return is_cell_;
......
......@@ -489,7 +489,7 @@ const int kStubMinorKeyBits = kBitsPerInt - kSmiTagSize - kStubMajorKeyBits;
ExternalAsciiString) \
V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \
ExternalTwoByteString::kSize, \
external_string_with_one_bytei_data, \
external_string_with_one_byte_data, \
ExternalStringWithOneByteData) \
V(SHORT_EXTERNAL_STRING_TYPE, \
ExternalTwoByteString::kShortSize, \
......
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