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

Side by Side Diff: src/objects.h

Issue 2381843002: Add Smi::Zero and replace all Smi::FromInt(0) calls (Closed)
Patch Set: Mark Smi::kZero as V8_EXPORT_PRIVATE 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 unified diff | Download patch
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue); 1503 DCHECK_EQ(result, value >= kMinValue && value <= kMaxValue);
1504 return result; 1504 return result;
1505 } 1505 }
1506 1506
1507 DECLARE_CAST(Smi) 1507 DECLARE_CAST(Smi)
1508 1508
1509 // Dispatched behavior. 1509 // Dispatched behavior.
1510 void SmiPrint(std::ostream& os) const; // NOLINT 1510 void SmiPrint(std::ostream& os) const; // NOLINT
1511 DECLARE_VERIFIER(Smi) 1511 DECLARE_VERIFIER(Smi)
1512 1512
1513 V8_EXPORT_PRIVATE static Smi* const kZero;
1513 static const int kMinValue = 1514 static const int kMinValue =
1514 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); 1515 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
1515 static const int kMaxValue = -(kMinValue + 1); 1516 static const int kMaxValue = -(kMinValue + 1);
1516 1517
1517 private: 1518 private:
1518 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); 1519 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi);
1519 }; 1520 };
1520 1521
1521 1522
1522 // Heap objects typically have a map pointer in their first word. However, 1523 // Heap objects typically have a map pointer in their first word. However,
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 }; 2866 };
2866 2867
2867 template <class CompactionCallback> 2868 template <class CompactionCallback>
2868 void Compact(); 2869 void Compact();
2869 2870
2870 inline Object* Get(int index) const; 2871 inline Object* Get(int index) const;
2871 inline void Clear(int index); 2872 inline void Clear(int index);
2872 inline int Length() const; 2873 inline int Length() const;
2873 2874
2874 inline bool IsEmptySlot(int index) const; 2875 inline bool IsEmptySlot(int index) const;
2875 static Object* Empty() { return Smi::FromInt(0); } 2876 static Object* Empty() { return Smi::kZero; }
2876 2877
2877 class Iterator { 2878 class Iterator {
2878 public: 2879 public:
2879 explicit Iterator(Object* maybe_array) : list_(NULL) { Reset(maybe_array); } 2880 explicit Iterator(Object* maybe_array) : list_(NULL) { Reset(maybe_array); }
2880 void Reset(Object* maybe_array); 2881 void Reset(Object* maybe_array);
2881 2882
2882 template <class T> 2883 template <class T>
2883 inline T* Next(); 2884 inline T* Next();
2884 2885
2885 private: 2886 private:
(...skipping 8323 matching lines...) Expand 10 before | Expand all | Expand 10 after
11209 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position, 11210 static void SetBreakPoint(Handle<DebugInfo> debug_info, int source_position,
11210 Handle<Object> break_point_object); 11211 Handle<Object> break_point_object);
11211 // Get the break point objects for a source position. 11212 // Get the break point objects for a source position.
11212 Handle<Object> GetBreakPointObjects(int source_position); 11213 Handle<Object> GetBreakPointObjects(int source_position);
11213 // Find the break point info holding this break point object. 11214 // Find the break point info holding this break point object.
11214 static Handle<Object> FindBreakPointInfo(Handle<DebugInfo> debug_info, 11215 static Handle<Object> FindBreakPointInfo(Handle<DebugInfo> debug_info,
11215 Handle<Object> break_point_object); 11216 Handle<Object> break_point_object);
11216 // Get the number of break points for this function. 11217 // Get the number of break points for this function.
11217 int GetBreakPointCount(); 11218 int GetBreakPointCount();
11218 11219
11219 static Smi* uninitialized() { return Smi::FromInt(0); } 11220 static Smi* uninitialized() { return Smi::kZero; }
11220 11221
11221 inline bool HasDebugBytecodeArray(); 11222 inline bool HasDebugBytecodeArray();
11222 inline bool HasDebugCode(); 11223 inline bool HasDebugCode();
11223 11224
11224 inline BytecodeArray* OriginalBytecodeArray(); 11225 inline BytecodeArray* OriginalBytecodeArray();
11225 inline BytecodeArray* DebugBytecodeArray(); 11226 inline BytecodeArray* DebugBytecodeArray();
11226 inline Code* DebugCode(); 11227 inline Code* DebugCode();
11227 11228
11228 DECLARE_CAST(DebugInfo) 11229 DECLARE_CAST(DebugInfo)
11229 11230
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
11406 } 11407 }
11407 return value; 11408 return value;
11408 } 11409 }
11409 }; 11410 };
11410 11411
11411 11412
11412 } // NOLINT, false-positive due to second-order macros. 11413 } // NOLINT, false-positive due to second-order macros.
11413 } // NOLINT, false-positive due to second-order macros. 11414 } // NOLINT, false-positive due to second-order macros.
11414 11415
11415 #endif // V8_OBJECTS_H_ 11416 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698