Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(700)

Unified Diff: src/heap/heap.cc

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index f6a1b3551ba57a59cfcd4bdc6e102650379f4af2..1ab4d2e85b300400445eed38bf4c80414efef102 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::kZero);
- set_encountered_weak_collections(Smi::kZero);
- set_encountered_weak_cells(Smi::kZero);
- set_encountered_transition_arrays(Smi::kZero);
+ 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));
// 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::kZero);
+ set_weak_stack_trace_list(Smi::FromInt(0));
}
@@ -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::kZero);
+ reinterpret_cast<Map*>(result)->set_weak_cell_cache(Smi::FromInt(0));
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::kZero);
- map->set_raw_transitions(Smi::kZero);
+ map->set_weak_cell_cache(Smi::FromInt(0));
+ map->set_raw_transitions(Smi::FromInt(0));
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::kZero);
+ map->set_raw_transitions(Smi::FromInt(0));
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::kZero));
+ cell->set_property_details(PropertyDetails(Smi::FromInt(0)));
cell->set_value(the_hole_value());
return result;
}
@@ -2623,7 +2623,8 @@ void Heap::CreateInitialObjects() {
// Initialize the null_value.
Oddball::Initialize(isolate(), factory->null_value(), "null",
- handle(Smi::kZero, isolate()), "object", Oddball::kNull);
+ handle(Smi::FromInt(0), isolate()), "object",
+ Oddball::kNull);
// Initialize the_hole_value.
Oddball::Initialize(isolate(), factory->the_hole_value(), "hole",
@@ -2637,7 +2638,7 @@ void Heap::CreateInitialObjects() {
// Initialize the false_value.
Oddball::Initialize(isolate(), factory->false_value(), "false",
- handle(Smi::kZero, isolate()), "boolean",
+ handle(Smi::FromInt(0), isolate()), "boolean",
Oddball::kFalse);
set_uninitialized_value(
@@ -2683,9 +2684,9 @@ void Heap::CreateInitialObjects() {
// expanding the dictionary during bootstrapping.
set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128));
- set_instanceof_cache_function(Smi::kZero);
- set_instanceof_cache_map(Smi::kZero);
- set_instanceof_cache_answer(Smi::kZero);
+ set_instanceof_cache_function(Smi::FromInt(0));
+ set_instanceof_cache_map(Smi::FromInt(0));
+ set_instanceof_cache_answer(Smi::FromInt(0));
{
HandleScope scope(isolate());
@@ -2754,7 +2755,7 @@ void Heap::CreateInitialObjects() {
set_undefined_cell(*factory->NewCell(factory->undefined_value()));
// The symbol registry is initialized lazily.
- set_symbol_registry(Smi::kZero);
+ set_symbol_registry(Smi::FromInt(0));
// Microtask queue uses the empty fixed array as a sentinel for "empty".
// Number of queued microtasks stored in Isolate::pending_microtask_count().
@@ -2802,7 +2803,7 @@ void Heap::CreateInitialObjects() {
empty_type_feedback_vector->set(TypeFeedbackVector::kMetadataIndex,
empty_fixed_array());
empty_type_feedback_vector->set(TypeFeedbackVector::kInvocationCountIndex,
- Smi::kZero);
+ Smi::FromInt(0));
set_empty_type_feedback_vector(*empty_type_feedback_vector);
// We use a canonical empty LiteralsArray for all functions that neither
@@ -2838,7 +2839,7 @@ void Heap::CreateInitialObjects() {
ArrayList::cast(*(factory->NewFixedArray(16, TENURED))));
weak_new_space_object_to_code_list()->SetLength(0);
- set_script_list(Smi::kZero);
+ set_script_list(Smi::FromInt(0));
Handle<SeededNumberDictionary> slow_element_dictionary =
SeededNumberDictionary::New(isolate(), 0, TENURED);
@@ -2849,7 +2850,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::kZero);
+ set_next_template_serial_number(Smi::FromInt(0));
// Allocate the empty script.
Handle<Script> script = factory->NewScript(factory->empty_string());
@@ -2882,9 +2883,9 @@ void Heap::CreateInitialObjects() {
set_serialized_templates(empty_fixed_array());
- set_weak_stack_trace_list(Smi::kZero);
+ set_weak_stack_trace_list(Smi::FromInt(0));
- set_noscript_shared_function_infos(Smi::kZero);
+ set_noscript_shared_function_infos(Smi::FromInt(0));
// Initialize keyed lookup cache.
isolate_->keyed_lookup_cache()->Clear();
@@ -3286,7 +3287,7 @@ AllocationResult Heap::AllocateFixedTypedArrayWithExternalPointer(
result->set_map_no_write_barrier(MapForFixedTypedArray(array_type));
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(result);
- elements->set_base_pointer(Smi::kZero, SKIP_WRITE_BARRIER);
+ elements->set_base_pointer(Smi::FromInt(0), SKIP_WRITE_BARRIER);
elements->set_external_pointer(external_pointer, SKIP_WRITE_BARRIER);
elements->set_length(length);
return elements;
@@ -3370,7 +3371,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::kZero);
+ code->set_gc_metadata(Smi::FromInt(0));
code->set_ic_age(global_ic_age_);
return code;
}
@@ -3467,7 +3468,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::kZero) and the elements initialized to a
+ // to a number (e.g. Smi::FromInt(0)) 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).
@@ -5547,8 +5548,8 @@ void Heap::SetStackLimits() {
}
void Heap::ClearStackLimits() {
- roots_[kStackLimitRootIndex] = Smi::kZero;
- roots_[kRealStackLimitRootIndex] = Smi::kZero;
+ roots_[kStackLimitRootIndex] = Smi::FromInt(0);
+ roots_[kRealStackLimitRootIndex] = Smi::FromInt(0);
}
void Heap::PrintAlloctionsHash() {
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/heap/heap-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698