Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 2f41f83747eb5e31d064679fc09ca9e9d8d134b7..f11e4ef0290f20cb296a18dc1b3183f000c430ca 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -170,10 +170,10 @@ Heap::Heap() |
memset(roots_, 0, sizeof(roots_[0]) * kRootListLength); |
set_native_contexts_list(NULL); |
- set_allocation_sites_list(Smi::FromInt(0)); |
- set_encountered_weak_collections(Smi::FromInt(0)); |
- set_encountered_weak_cells(Smi::FromInt(0)); |
- set_encountered_transition_arrays(Smi::FromInt(0)); |
+ set_allocation_sites_list(Smi::kZero); |
+ set_encountered_weak_collections(Smi::kZero); |
+ set_encountered_weak_cells(Smi::kZero); |
+ set_encountered_transition_arrays(Smi::kZero); |
// Put a dummy entry in the remembered pages so we can find the list the |
// minidump even if there are no real unmapped pages. |
RememberUnmappedPage(NULL, false); |
@@ -742,7 +742,7 @@ void Heap::PreprocessStackTraces() { |
} |
// We must not compact the weak fixed list here, as we may be in the middle |
// of writing to it, when the GC triggered. Instead, we reset the root value. |
- set_weak_stack_trace_list(Smi::FromInt(0)); |
+ set_weak_stack_trace_list(Smi::kZero); |
} |
@@ -2061,7 +2061,7 @@ AllocationResult Heap::AllocatePartialMap(InstanceType instance_type, |
Map::OwnsDescriptors::encode(true) | |
Map::ConstructionCounter::encode(Map::kNoSlackTracking); |
reinterpret_cast<Map*>(result)->set_bit_field3(bit_field3); |
- reinterpret_cast<Map*>(result)->set_weak_cell_cache(Smi::FromInt(0)); |
+ reinterpret_cast<Map*>(result)->set_weak_cell_cache(Smi::kZero); |
return result; |
} |
@@ -2085,8 +2085,8 @@ AllocationResult Heap::AllocateMap(InstanceType instance_type, |
map->set_code_cache(empty_fixed_array(), SKIP_WRITE_BARRIER); |
map->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
SKIP_WRITE_BARRIER); |
- map->set_weak_cell_cache(Smi::FromInt(0)); |
- map->set_raw_transitions(Smi::FromInt(0)); |
+ map->set_weak_cell_cache(Smi::kZero); |
+ map->set_raw_transitions(Smi::kZero); |
map->set_unused_property_fields(0); |
map->set_instance_descriptors(empty_descriptor_array()); |
if (FLAG_unbox_double_fields) { |
@@ -2158,7 +2158,7 @@ namespace { |
void FinalizePartialMap(Heap* heap, Map* map) { |
map->set_code_cache(heap->empty_fixed_array()); |
map->set_dependent_code(DependentCode::cast(heap->empty_fixed_array())); |
- map->set_raw_transitions(Smi::FromInt(0)); |
+ map->set_raw_transitions(Smi::kZero); |
map->set_instance_descriptors(heap->empty_descriptor_array()); |
if (FLAG_unbox_double_fields) { |
map->set_layout_descriptor(LayoutDescriptor::FastPointerLayout()); |
@@ -2493,7 +2493,7 @@ AllocationResult Heap::AllocatePropertyCell() { |
PropertyCell* cell = PropertyCell::cast(result); |
cell->set_dependent_code(DependentCode::cast(empty_fixed_array()), |
SKIP_WRITE_BARRIER); |
- cell->set_property_details(PropertyDetails(Smi::FromInt(0))); |
+ cell->set_property_details(PropertyDetails(Smi::kZero)); |
cell->set_value(the_hole_value()); |
return result; |
} |
@@ -2623,8 +2623,7 @@ void Heap::CreateInitialObjects() { |
// Initialize the null_value. |
Oddball::Initialize(isolate(), factory->null_value(), "null", |
- handle(Smi::FromInt(0), isolate()), "object", |
- Oddball::kNull); |
+ handle(Smi::kZero, isolate()), "object", Oddball::kNull); |
// Initialize the_hole_value. |
Oddball::Initialize(isolate(), factory->the_hole_value(), "hole", |
@@ -2638,7 +2637,7 @@ void Heap::CreateInitialObjects() { |
// Initialize the false_value. |
Oddball::Initialize(isolate(), factory->false_value(), "false", |
- handle(Smi::FromInt(0), isolate()), "boolean", |
+ handle(Smi::kZero, isolate()), "boolean", |
Oddball::kFalse); |
set_uninitialized_value( |
@@ -2684,9 +2683,9 @@ void Heap::CreateInitialObjects() { |
// expanding the dictionary during bootstrapping. |
set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); |
- set_instanceof_cache_function(Smi::FromInt(0)); |
- set_instanceof_cache_map(Smi::FromInt(0)); |
- set_instanceof_cache_answer(Smi::FromInt(0)); |
+ set_instanceof_cache_function(Smi::kZero); |
+ set_instanceof_cache_map(Smi::kZero); |
+ set_instanceof_cache_answer(Smi::kZero); |
{ |
HandleScope scope(isolate()); |
@@ -2755,7 +2754,7 @@ void Heap::CreateInitialObjects() { |
set_undefined_cell(*factory->NewCell(factory->undefined_value())); |
// The symbol registry is initialized lazily. |
- set_symbol_registry(Smi::FromInt(0)); |
+ set_symbol_registry(Smi::kZero); |
// Microtask queue uses the empty fixed array as a sentinel for "empty". |
// Number of queued microtasks stored in Isolate::pending_microtask_count(). |
@@ -2803,7 +2802,7 @@ void Heap::CreateInitialObjects() { |
empty_type_feedback_vector->set(TypeFeedbackVector::kMetadataIndex, |
empty_fixed_array()); |
empty_type_feedback_vector->set(TypeFeedbackVector::kInvocationCountIndex, |
- Smi::FromInt(0)); |
+ Smi::kZero); |
set_empty_type_feedback_vector(*empty_type_feedback_vector); |
// We use a canonical empty LiteralsArray for all functions that neither |
@@ -2847,7 +2846,7 @@ void Heap::CreateInitialObjects() { |
ArrayList::cast(*(factory->NewFixedArray(16, TENURED)))); |
weak_new_space_object_to_code_list()->SetLength(0); |
- set_script_list(Smi::FromInt(0)); |
+ set_script_list(Smi::kZero); |
Handle<SeededNumberDictionary> slow_element_dictionary = |
SeededNumberDictionary::New(isolate(), 0, TENURED); |
@@ -2858,7 +2857,7 @@ void Heap::CreateInitialObjects() { |
// Handling of script id generation is in Heap::NextScriptId(). |
set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); |
- set_next_template_serial_number(Smi::FromInt(0)); |
+ set_next_template_serial_number(Smi::kZero); |
// Allocate the empty script. |
Handle<Script> script = factory->NewScript(factory->empty_string()); |
@@ -2891,9 +2890,9 @@ void Heap::CreateInitialObjects() { |
set_serialized_templates(empty_fixed_array()); |
- set_weak_stack_trace_list(Smi::FromInt(0)); |
+ set_weak_stack_trace_list(Smi::kZero); |
- set_noscript_shared_function_infos(Smi::FromInt(0)); |
+ set_noscript_shared_function_infos(Smi::kZero); |
// Initialize keyed lookup cache. |
isolate_->keyed_lookup_cache()->Clear(); |
@@ -3295,7 +3294,7 @@ AllocationResult Heap::AllocateFixedTypedArrayWithExternalPointer( |
result->set_map_no_write_barrier(MapForFixedTypedArray(array_type)); |
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result); |
- elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER); |
+ elements->set_base_pointer(Smi::kZero, SKIP_WRITE_BARRIER); |
elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER); |
elements->set_length(length); |
return elements; |
@@ -3379,7 +3378,7 @@ AllocationResult Heap::AllocateCode(int object_size, bool immovable) { |
DCHECK(!memory_allocator()->code_range()->valid() || |
memory_allocator()->code_range()->contains(code->address()) || |
object_size <= code_space()->AreaSize()); |
- code->set_gc_metadata(Smi::FromInt(0)); |
+ code->set_gc_metadata(Smi::kZero); |
code->set_ic_age(global_ic_age_); |
return code; |
} |
@@ -3476,7 +3475,7 @@ void Heap::InitializeJSObjectFromMap(JSObject* obj, FixedArray* properties, |
// TODO(1240798): Initialize the object's body using valid initial values |
// according to the object's initial map. For example, if the map's |
// instance type is JS_ARRAY_TYPE, the length field should be initialized |
- // to a number (e.g. Smi::FromInt(0)) and the elements initialized to a |
+ // to a number (e.g. Smi::kZero) and the elements initialized to a |
// fixed array (e.g. Heap::empty_fixed_array()). Currently, the object |
// verification code has to cope with (temporarily) invalid objects. See |
// for example, JSArray::JSArrayVerify). |
@@ -5556,8 +5555,8 @@ void Heap::SetStackLimits() { |
} |
void Heap::ClearStackLimits() { |
- roots_[kStackLimitRootIndex] = Smi::FromInt(0); |
- roots_[kRealStackLimitRootIndex] = Smi::FromInt(0); |
+ roots_[kStackLimitRootIndex] = Smi::kZero; |
+ roots_[kRealStackLimitRootIndex] = Smi::kZero; |
} |
void Heap::PrintAlloctionsHash() { |