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

Unified Diff: src/objects-inl.h

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/objects-debug.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index dccb22ece0044b2fef59926b018d8e9001078492..5bfc976ff2ce6653ab474cb0f22f0ff904fecc39 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -305,7 +305,7 @@ Handle<Object> Object::NewStorageFor(Isolate* isolate,
Handle<Object> object,
Representation representation) {
if (representation.IsSmi() && object->IsUninitialized(isolate)) {
- return handle(Smi::kZero, isolate);
+ return handle(Smi::FromInt(0), isolate);
}
if (!representation.IsDouble()) return object;
double value;
@@ -1589,9 +1589,9 @@ FixedArrayBase* JSObject::elements() const {
void AllocationSite::Initialize() {
- set_transition_info(Smi::kZero);
+ set_transition_info(Smi::FromInt(0));
SetElementsKind(GetInitialFastElementsKind());
- set_nested_site(Smi::kZero);
+ set_nested_site(Smi::FromInt(0));
set_pretenure_data(0);
set_pretenure_create_count(0);
set_dependent_code(DependentCode::cast(GetHeap()->empty_fixed_array()),
@@ -2019,7 +2019,7 @@ void WeakCell::clear() {
// initializing the root empty weak cell.
DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT ||
this == GetHeap()->empty_weak_cell());
- WRITE_FIELD(this, kValueOffset, Smi::kZero);
+ WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
}
@@ -2034,7 +2034,9 @@ void WeakCell::initialize(HeapObject* val) {
CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kValueOffset, val, mode);
}
-bool WeakCell::cleared() const { return value() == Smi::kZero; }
+
+bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
+
Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
@@ -2467,7 +2469,7 @@ bool WeakFixedArray::IsEmptySlot(int index) const {
void WeakFixedArray::Clear(int index) {
- FixedArray::cast(this)->set(index + kFirstIndex, Smi::kZero);
+ FixedArray::cast(this)->set(index + kFirstIndex, Smi::FromInt(0));
}
@@ -4225,7 +4227,7 @@ int FixedTypedArrayBase::ElementSize(InstanceType type) {
int FixedTypedArrayBase::DataSize(InstanceType type) {
- if (base_pointer() == Smi::kZero) return 0;
+ if (base_pointer() == Smi::FromInt(0)) return 0;
return length() * ElementSize(type);
}
@@ -6915,7 +6917,7 @@ void JSArrayBuffer::set_is_shared(bool value) {
Object* JSArrayBufferView::byte_offset() const {
- if (WasNeutered()) return Smi::kZero;
+ if (WasNeutered()) return Smi::FromInt(0);
return Object::cast(READ_FIELD(this, kByteOffsetOffset));
}
@@ -6927,7 +6929,7 @@ void JSArrayBufferView::set_byte_offset(Object* value, WriteBarrierMode mode) {
Object* JSArrayBufferView::byte_length() const {
- if (WasNeutered()) return Smi::kZero;
+ if (WasNeutered()) return Smi::FromInt(0);
return Object::cast(READ_FIELD(this, kByteLengthOffset));
}
@@ -6951,7 +6953,7 @@ bool JSArrayBufferView::WasNeutered() const {
Object* JSTypedArray::length() const {
- if (WasNeutered()) return Smi::kZero;
+ if (WasNeutered()) return Smi::FromInt(0);
return Object::cast(READ_FIELD(this, kLengthOffset));
}
@@ -7703,7 +7705,7 @@ template<typename Derived, typename Shape, typename Key>
void Dictionary<Derived, Shape, Key>::SetEntry(int entry,
Handle<Object> key,
Handle<Object> value) {
- this->SetEntry(entry, key, value, PropertyDetails(Smi::kZero));
+ this->SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0)));
}
@@ -8095,9 +8097,9 @@ void TypeFeedbackInfo::change_ic_generic_count(int delta) {
void TypeFeedbackInfo::initialize_storage() {
- WRITE_FIELD(this, kStorage1Offset, Smi::kZero);
- WRITE_FIELD(this, kStorage2Offset, Smi::kZero);
- WRITE_FIELD(this, kStorage3Offset, Smi::kZero);
+ WRITE_FIELD(this, kStorage1Offset, Smi::FromInt(0));
+ WRITE_FIELD(this, kStorage2Offset, Smi::FromInt(0));
+ WRITE_FIELD(this, kStorage3Offset, Smi::FromInt(0));
}
« no previous file with comments | « src/objects-debug.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698