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

Unified Diff: src/objects.h

Issue 349623002: Make object accessors more const-correct. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « no previous file | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index fbc2ed7d7932c84ae08d66a500e84e01f61930f4..850a854c119c50a11c0ea32e74cb8c48787034ac 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -845,12 +845,12 @@ enum CompareResult {
#define DECL_BOOLEAN_ACCESSORS(name) \
- inline bool name(); \
+ inline bool name() const; \
inline void set_##name(bool value); \
#define DECL_ACCESSORS(name, type) \
- inline type* name(); \
+ inline type* name() const; \
inline void set_##name(type* value, \
Benedikt Meurer 2014/06/20 09:45:20 I guess it's not yet possible to say "const type*
Sven Panne 2014/06/20 10:21:58 Nope, you would need const-correct IsFOO for that
WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
@@ -1576,7 +1576,7 @@ class Object {
class Smi: public Object {
public:
// Returns the integer value.
- inline int value();
+ inline int value() const;
// Convert a value to a Smi object.
static inline Smi* FromInt(int value);
@@ -1613,7 +1613,7 @@ class MapWord BASE_EMBEDDED {
// Normal state: the map word contains a map pointer.
// Create a map word from a map pointer.
- static inline MapWord FromMap(Map* map);
+ static inline MapWord FromMap(const Map* map);
// View this map word as a map pointer.
inline Map* ToMap();
@@ -1657,7 +1657,7 @@ class HeapObject: public Object {
public:
// [map]: Contains a map which contains the object's reflective
// information.
- inline Map* map();
+ inline Map* map() const;
inline void set_map(Map* value);
// The no-write-barrier version. This is OK if the object is white and in
// new space, or if the value is an immortal immutable object, like the maps
@@ -1666,7 +1666,7 @@ class HeapObject: public Object {
// Get the map using acquire load.
inline Map* synchronized_map();
- inline MapWord synchronized_map_word();
+ inline MapWord synchronized_map_word() const;
// Set the map using release store
inline void synchronized_set_map(Map* value);
@@ -1675,11 +1675,11 @@ class HeapObject: public Object {
// During garbage collection, the map word of a heap object does not
// necessarily contain a map pointer.
- inline MapWord map_word();
+ inline MapWord map_word() const;
inline void set_map_word(MapWord map_word);
// The Heap the object was allocated in. Used also to access Isolate.
- inline Heap* GetHeap();
+ inline Heap* GetHeap() const;
// Convenience method to get current isolate.
inline Isolate* GetIsolate();
@@ -2870,11 +2870,11 @@ class JSObject: public JSReceiver {
class FixedArrayBase: public HeapObject {
public:
// [length]: length of the array.
- inline int length();
+ inline int length() const;
inline void set_length(int value);
// Get and set the length using acquire loads and release stores.
- inline int synchronized_length();
+ inline int synchronized_length() const;
inline void synchronized_set_length(int value);
inline static FixedArrayBase* cast(Object* object);
@@ -4893,10 +4893,10 @@ class ByteArray: public FixedArrayBase {
class FreeSpace: public HeapObject {
public:
// [size]: size of the free space including the header.
- inline int size();
+ inline int size() const;
inline void set_size(int value);
- inline int nobarrier_size();
+ inline int nobarrier_size() const;
inline void nobarrier_set_size(int value);
inline int Size() { return size(); }
@@ -5487,7 +5487,7 @@ class Code: public HeapObject {
#endif // ENABLE_DISASSEMBLER
// [instruction_size]: Size of the native instructions
- inline int instruction_size();
+ inline int instruction_size() const;
inline void set_instruction_size(int value);
// [relocation_info]: Code relocation information
@@ -5524,11 +5524,11 @@ class Code: public HeapObject {
// [ic_age]: Inline caching age: the value of the Heap::global_ic_age
// at the moment when this object was created.
inline void set_ic_age(int count);
- inline int ic_age();
+ inline int ic_age() const;
// [prologue_offset]: Offset of the function prologue, used for aging
// FUNCTIONs and OPTIMIZED_FUNCTIONs.
- inline int prologue_offset();
+ inline int prologue_offset() const;
inline void set_prologue_offset(int offset);
// Unchecked accessors to be used during GC.
@@ -6289,7 +6289,7 @@ class Map: public HeapObject {
// map with DICTIONARY_ELEMENTS was found in the prototype chain.
bool DictionaryElementsInPrototypeChainOnly();
- inline bool HasTransitionArray();
+ inline bool HasTransitionArray() const;
inline bool HasElementsTransition();
inline Map* elements_transition_map();
static Handle<TransitionArray> SetElementsTransitionMap(
@@ -7108,11 +7108,11 @@ class SharedFunctionInfo: public HeapObject {
// [length]: The function length - usually the number of declared parameters.
// Use up to 2^30 parameters.
- inline int length();
+ inline int length() const;
inline void set_length(int value);
// [formal parameter count]: The declared number of parameters.
- inline int formal_parameter_count();
+ inline int formal_parameter_count() const;
inline void set_formal_parameter_count(int value);
// Set the formal parameter count so the function code will be
@@ -7120,7 +7120,7 @@ class SharedFunctionInfo: public HeapObject {
inline void DontAdaptArguments();
// [expected_nof_properties]: Expected number of properties for the function.
- inline int expected_nof_properties();
+ inline int expected_nof_properties() const;
inline void set_expected_nof_properties(int value);
// [feedback_vector] - accumulates ast node feedback from full-codegen and
@@ -7149,7 +7149,7 @@ class SharedFunctionInfo: public HeapObject {
DECL_ACCESSORS(script, Object)
// [num_literals]: Number of literals used by this function.
- inline int num_literals();
+ inline int num_literals() const;
inline void set_num_literals(int value);
// [start_position_and_type]: Field used to store both the source code
@@ -7157,7 +7157,7 @@ class SharedFunctionInfo: public HeapObject {
// and whether or not the function is a toplevel function. The two
// least significants bit indicates whether the function is an
// expression and the rest contains the source code position.
- inline int start_position_and_type();
+ inline int start_position_and_type() const;
inline void set_start_position_and_type(int value);
// [debug info]: Debug information.
@@ -7174,7 +7174,7 @@ class SharedFunctionInfo: public HeapObject {
String* DebugName();
// Position of the 'function' token in the script source.
- inline int function_token_position();
+ inline int function_token_position() const;
inline void set_function_token_position(int function_token_position);
// Position of this function in the script source.
@@ -7182,7 +7182,7 @@ class SharedFunctionInfo: public HeapObject {
inline void set_start_position(int start_position);
// End position of this function in the script source.
- inline int end_position();
+ inline int end_position() const;
inline void set_end_position(int end_position);
// Is this function a function expression in the source code.
@@ -7193,13 +7193,13 @@ class SharedFunctionInfo: public HeapObject {
// Bit field containing various information collected by the compiler to
// drive optimization.
- inline int compiler_hints();
+ inline int compiler_hints() const;
inline void set_compiler_hints(int value);
- inline int ast_node_count();
+ inline int ast_node_count() const;
inline void set_ast_node_count(int count);
- inline int profiler_ticks();
+ inline int profiler_ticks() const;
inline void set_profiler_ticks(int ticks);
// Inline cache age is used to infer whether the function survived a context
@@ -7315,11 +7315,11 @@ class SharedFunctionInfo: public HeapObject {
// Stores deopt_count, opt_reenable_tries and ic_age as bit-fields.
inline void set_counters(int value);
- inline int counters();
+ inline int counters() const;
// Stores opt_count and bailout_reason as bit-fields.
inline void set_opt_count_and_bailout_reason(int value);
- inline int opt_count_and_bailout_reason();
+ inline int opt_count_and_bailout_reason() const;
void set_bailout_reason(BailoutReason reason) {
set_opt_count_and_bailout_reason(
@@ -7551,7 +7551,7 @@ class JSGeneratorObject: public JSObject {
// A positive offset indicates a suspended generator. The special
// kGeneratorExecuting and kGeneratorClosed values indicate that a generator
// cannot be resumed.
- inline int continuation();
+ inline int continuation() const;
inline void set_continuation(int continuation);
inline bool is_closed();
inline bool is_executing();
@@ -7562,7 +7562,7 @@ class JSGeneratorObject: public JSObject {
// [stack_handler_index]: Index of first stack handler in operand_stack, or -1
// if the captured activation had no stack handler.
- inline int stack_handler_index();
+ inline int stack_handler_index() const;
inline void set_stack_handler_index(int stack_handler_index);
// Casting.
@@ -8123,11 +8123,11 @@ class JSMessageObject: public JSObject {
DECL_ACCESSORS(stack_frames, Object)
// [start_position]: the start position in the script for the error message.
- inline int start_position();
+ inline int start_position() const;
inline void set_start_position(int value);
// [end_position]: the end position in the script for the error message.
- inline int end_position();
+ inline int end_position() const;
inline void set_end_position(int value);
// Casting.
@@ -8781,7 +8781,7 @@ class AllocationMemento: public Struct {
// - all attributes are available as part if the property details
class AliasedArgumentsEntry: public Struct {
public:
- inline int aliased_context_slot();
+ inline int aliased_context_slot() const;
inline void set_aliased_context_slot(int count);
static inline AliasedArgumentsEntry* cast(Object* obj);
@@ -9118,12 +9118,12 @@ class String: public Name {
};
// Get and set the length of the string.
- inline int length();
+ inline int length() const;
inline void set_length(int value);
// Get and set the length of the string using acquire loads and release
// stores.
- inline int synchronized_length();
+ inline int synchronized_length() const;
inline void synchronized_set_length(int value);
// Returns whether this string has only ASCII chars, i.e. all of them can
@@ -9521,7 +9521,7 @@ class SlicedString: public String {
inline String* parent();
inline void set_parent(String* parent,
WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
- inline int offset();
+ inline int offset() const;
inline void set_offset(int offset);
// Dispatched behavior.
@@ -10903,7 +10903,7 @@ class FunctionTemplateInfo: public TemplateInfo {
DECL_ACCESSORS(access_check_info, Object)
DECL_ACCESSORS(flag, Smi)
- inline int length();
+ inline int length() const;
inline void set_length(int value);
// Following properties use flag bits.
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698