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

Side by Side Diff: src/objects.h

Issue 1371893002: objects-inl.h: Remove ACCESSORS_TO_SMI macro (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: undo last_script_id storage change Created 5 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/messages.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 // Result of an abstract relational comparison of x and y, implemented according 813 // Result of an abstract relational comparison of x and y, implemented according
814 // to ES6 section 7.2.11 Abstract Relational Comparison. 814 // to ES6 section 7.2.11 Abstract Relational Comparison.
815 enum class ComparisonResult { 815 enum class ComparisonResult {
816 kLessThan, // x < y 816 kLessThan, // x < y
817 kEqual, // x = y 817 kEqual, // x = y
818 kGreaterThan, // x > x 818 kGreaterThan, // x > x
819 kUndefined // at least one of x or y was undefined or NaN 819 kUndefined // at least one of x or y was undefined or NaN
820 }; 820 };
821 821
822 822
823 #define DECL_BOOLEAN_ACCESSORS(name) \ 823 #define DECL_BOOLEAN_ACCESSORS(name) \
824 inline bool name() const; \ 824 inline bool name() const; \
825 inline void set_##name(bool value); \ 825 inline void set_##name(bool value);
826
827 #define DECL_INT_ACCESSORS(name) \
828 inline int name() const; \
829 inline void set_##name(int value);
826 830
827 831
828 #define DECL_ACCESSORS(name, type) \ 832 #define DECL_ACCESSORS(name, type) \
829 inline type* name() const; \ 833 inline type* name() const; \
830 inline void set_##name(type* value, \ 834 inline void set_##name(type* value, \
831 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 835 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
832 836
833 837
834 #define DECLARE_CAST(type) \ 838 #define DECLARE_CAST(type) \
835 INLINE(static type* cast(Object* object)); \ 839 INLINE(static type* cast(Object* object)); \
(...skipping 5227 matching lines...) Expand 10 before | Expand all | Expand 10 after
6063 COMPILATION_STATE_COMPILED = 1 6067 COMPILATION_STATE_COMPILED = 1
6064 }; 6068 };
6065 6069
6066 // [source]: the script source. 6070 // [source]: the script source.
6067 DECL_ACCESSORS(source, Object) 6071 DECL_ACCESSORS(source, Object)
6068 6072
6069 // [name]: the script name. 6073 // [name]: the script name.
6070 DECL_ACCESSORS(name, Object) 6074 DECL_ACCESSORS(name, Object)
6071 6075
6072 // [id]: the script id. 6076 // [id]: the script id.
6073 DECL_ACCESSORS(id, Smi) 6077 DECL_INT_ACCESSORS(id)
6074 6078
6075 // [line_offset]: script line offset in resource from where it was extracted. 6079 // [line_offset]: script line offset in resource from where it was extracted.
6076 DECL_ACCESSORS(line_offset, Smi) 6080 DECL_INT_ACCESSORS(line_offset)
6077 6081
6078 // [column_offset]: script column offset in resource from where it was 6082 // [column_offset]: script column offset in resource from where it was
6079 // extracted. 6083 // extracted.
6080 DECL_ACCESSORS(column_offset, Smi) 6084 DECL_INT_ACCESSORS(column_offset)
6081 6085
6082 // [context_data]: context data for the context this script was compiled in. 6086 // [context_data]: context data for the context this script was compiled in.
6083 DECL_ACCESSORS(context_data, Object) 6087 DECL_ACCESSORS(context_data, Object)
6084 6088
6085 // [wrapper]: the wrapper cache. This is either undefined or a WeakCell. 6089 // [wrapper]: the wrapper cache. This is either undefined or a WeakCell.
6086 DECL_ACCESSORS(wrapper, HeapObject) 6090 DECL_ACCESSORS(wrapper, HeapObject)
6087 6091
6088 // [type]: the script type. 6092 // [type]: the script type.
6089 DECL_ACCESSORS(type, Smi) 6093 DECL_INT_ACCESSORS(type)
6090 6094
6091 // [line_ends]: FixedArray of line ends positions. 6095 // [line_ends]: FixedArray of line ends positions.
6092 DECL_ACCESSORS(line_ends, Object) 6096 DECL_ACCESSORS(line_ends, Object)
6093 6097
6094 // [eval_from_shared]: for eval scripts the shared funcion info for the 6098 // [eval_from_shared]: for eval scripts the shared funcion info for the
6095 // function from which eval was called. 6099 // function from which eval was called.
6096 DECL_ACCESSORS(eval_from_shared, Object) 6100 DECL_ACCESSORS(eval_from_shared, Object)
6097 6101
6098 // [eval_from_instructions_offset]: the instruction offset in the code for the 6102 // [eval_from_instructions_offset]: the instruction offset in the code for the
6099 // function from which eval was called where eval was called. 6103 // function from which eval was called where eval was called.
6100 DECL_ACCESSORS(eval_from_instructions_offset, Smi) 6104 DECL_INT_ACCESSORS(eval_from_instructions_offset)
6101 6105
6102 // [shared_function_infos]: weak fixed array containing all shared 6106 // [shared_function_infos]: weak fixed array containing all shared
6103 // function infos created from this script. 6107 // function infos created from this script.
6104 DECL_ACCESSORS(shared_function_infos, Object) 6108 DECL_ACCESSORS(shared_function_infos, Object)
6105 6109
6106 // [flags]: Holds an exciting bitfield. 6110 // [flags]: Holds an exciting bitfield.
6107 DECL_ACCESSORS(flags, Smi) 6111 DECL_INT_ACCESSORS(flags)
6108 6112
6109 // [source_url]: sourceURL from magic comment 6113 // [source_url]: sourceURL from magic comment
6110 DECL_ACCESSORS(source_url, Object) 6114 DECL_ACCESSORS(source_url, Object)
6111 6115
6112 // [source_url]: sourceMappingURL magic comment 6116 // [source_url]: sourceMappingURL magic comment
6113 DECL_ACCESSORS(source_mapping_url, Object) 6117 DECL_ACCESSORS(source_mapping_url, Object)
6114 6118
6115 // [compilation_type]: how the the script was compiled. Encoded in the 6119 // [compilation_type]: how the the script was compiled. Encoded in the
6116 // 'flags' field. 6120 // 'flags' field.
6117 inline CompilationType compilation_type(); 6121 inline CompilationType compilation_type();
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after
7914 kLastPretenureDecisionValue = kZombie 7918 kLastPretenureDecisionValue = kZombie
7915 }; 7919 };
7916 7920
7917 const char* PretenureDecisionName(PretenureDecision decision); 7921 const char* PretenureDecisionName(PretenureDecision decision);
7918 7922
7919 DECL_ACCESSORS(transition_info, Object) 7923 DECL_ACCESSORS(transition_info, Object)
7920 // nested_site threads a list of sites that represent nested literals 7924 // nested_site threads a list of sites that represent nested literals
7921 // walked in a particular order. So [[1, 2], 1, 2] will have one 7925 // walked in a particular order. So [[1, 2], 1, 2] will have one
7922 // nested_site, but [[1, 2], 3, [4]] will have a list of two. 7926 // nested_site, but [[1, 2], 3, [4]] will have a list of two.
7923 DECL_ACCESSORS(nested_site, Object) 7927 DECL_ACCESSORS(nested_site, Object)
7924 DECL_ACCESSORS(pretenure_data, Smi) 7928 DECL_INT_ACCESSORS(pretenure_data)
7925 DECL_ACCESSORS(pretenure_create_count, Smi) 7929 DECL_INT_ACCESSORS(pretenure_create_count)
7926 DECL_ACCESSORS(dependent_code, DependentCode) 7930 DECL_ACCESSORS(dependent_code, DependentCode)
7927 DECL_ACCESSORS(weak_next, Object) 7931 DECL_ACCESSORS(weak_next, Object)
7928 7932
7929 inline void Initialize(); 7933 inline void Initialize();
7930 7934
7931 // This method is expensive, it should only be called for reporting. 7935 // This method is expensive, it should only be called for reporting.
7932 bool IsNestedSite(); 7936 bool IsNestedSite();
7933 7937
7934 // transition_info bitfields, for constructed array transition info. 7938 // transition_info bitfields, for constructed array transition info.
7935 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {}; 7939 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {};
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
8304 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); 8308 DISALLOW_IMPLICIT_CONSTRUCTORS(Name);
8305 }; 8309 };
8306 8310
8307 8311
8308 // ES6 symbols. 8312 // ES6 symbols.
8309 class Symbol: public Name { 8313 class Symbol: public Name {
8310 public: 8314 public:
8311 // [name]: The print name of a symbol, or undefined if none. 8315 // [name]: The print name of a symbol, or undefined if none.
8312 DECL_ACCESSORS(name, Object) 8316 DECL_ACCESSORS(name, Object)
8313 8317
8314 DECL_ACCESSORS(flags, Smi) 8318 DECL_INT_ACCESSORS(flags)
8315 8319
8316 // [is_private]: Whether this is a private symbol. Private symbols can only 8320 // [is_private]: Whether this is a private symbol. Private symbols can only
8317 // be used to designate own properties of objects. 8321 // be used to designate own properties of objects.
8318 DECL_BOOLEAN_ACCESSORS(is_private) 8322 DECL_BOOLEAN_ACCESSORS(is_private)
8319 8323
8320 DECLARE_CAST(Symbol) 8324 DECLARE_CAST(Symbol)
8321 8325
8322 // Dispatched behavior. 8326 // Dispatched behavior.
8323 DECLARE_PRINTER(Symbol) 8327 DECLARE_PRINTER(Symbol)
8324 DECLARE_VERIFIER(Symbol) 8328 DECLARE_VERIFIER(Symbol)
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
9962 static const int kIndexIndex = 0; 9966 static const int kIndexIndex = 0;
9963 static const int kInputIndex = 1; 9967 static const int kInputIndex = 1;
9964 private: 9968 private:
9965 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult); 9969 DISALLOW_IMPLICIT_CONSTRUCTORS(JSRegExpResult);
9966 }; 9970 };
9967 9971
9968 9972
9969 class AccessorInfo: public Struct { 9973 class AccessorInfo: public Struct {
9970 public: 9974 public:
9971 DECL_ACCESSORS(name, Object) 9975 DECL_ACCESSORS(name, Object)
9972 DECL_ACCESSORS(flag, Smi) 9976 DECL_INT_ACCESSORS(flag)
9973 DECL_ACCESSORS(expected_receiver_type, Object) 9977 DECL_ACCESSORS(expected_receiver_type, Object)
9974 9978
9975 inline bool all_can_read(); 9979 inline bool all_can_read();
9976 inline void set_all_can_read(bool value); 9980 inline void set_all_can_read(bool value);
9977 9981
9978 inline bool all_can_write(); 9982 inline bool all_can_write();
9979 inline void set_all_can_write(bool value); 9983 inline void set_all_can_write(bool value);
9980 9984
9981 inline bool is_special_data_property(); 9985 inline bool is_special_data_property();
9982 inline void set_is_special_data_property(bool value); 9986 inline void set_is_special_data_property(bool value);
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
10210 DECL_ACCESSORS(call_code, Object) 10214 DECL_ACCESSORS(call_code, Object)
10211 DECL_ACCESSORS(prototype_template, Object) 10215 DECL_ACCESSORS(prototype_template, Object)
10212 DECL_ACCESSORS(parent_template, Object) 10216 DECL_ACCESSORS(parent_template, Object)
10213 DECL_ACCESSORS(named_property_handler, Object) 10217 DECL_ACCESSORS(named_property_handler, Object)
10214 DECL_ACCESSORS(indexed_property_handler, Object) 10218 DECL_ACCESSORS(indexed_property_handler, Object)
10215 DECL_ACCESSORS(instance_template, Object) 10219 DECL_ACCESSORS(instance_template, Object)
10216 DECL_ACCESSORS(class_name, Object) 10220 DECL_ACCESSORS(class_name, Object)
10217 DECL_ACCESSORS(signature, Object) 10221 DECL_ACCESSORS(signature, Object)
10218 DECL_ACCESSORS(instance_call_handler, Object) 10222 DECL_ACCESSORS(instance_call_handler, Object)
10219 DECL_ACCESSORS(access_check_info, Object) 10223 DECL_ACCESSORS(access_check_info, Object)
10220 DECL_ACCESSORS(flag, Smi) 10224 DECL_INT_ACCESSORS(flag)
10221 10225
10222 inline int length() const; 10226 inline int length() const;
10223 inline void set_length(int value); 10227 inline void set_length(int value);
10224 10228
10225 // Following properties use flag bits. 10229 // Following properties use flag bits.
10226 DECL_BOOLEAN_ACCESSORS(hidden_prototype) 10230 DECL_BOOLEAN_ACCESSORS(hidden_prototype)
10227 DECL_BOOLEAN_ACCESSORS(undetectable) 10231 DECL_BOOLEAN_ACCESSORS(undetectable)
10228 // If the bit is set, object instances created by this function 10232 // If the bit is set, object instances created by this function
10229 // requires access check. 10233 // requires access check.
10230 DECL_BOOLEAN_ACCESSORS(needs_access_check) 10234 DECL_BOOLEAN_ACCESSORS(needs_access_check)
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
10371 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo); 10375 DISALLOW_IMPLICIT_CONSTRUCTORS(DebugInfo);
10372 }; 10376 };
10373 10377
10374 10378
10375 // The BreakPointInfo class holds information for break points set in a 10379 // The BreakPointInfo class holds information for break points set in a
10376 // function. The DebugInfo object holds a BreakPointInfo object for each code 10380 // function. The DebugInfo object holds a BreakPointInfo object for each code
10377 // position with one or more break points. 10381 // position with one or more break points.
10378 class BreakPointInfo: public Struct { 10382 class BreakPointInfo: public Struct {
10379 public: 10383 public:
10380 // The position in the code for the break point. 10384 // The position in the code for the break point.
10381 DECL_ACCESSORS(code_position, Smi) 10385 DECL_INT_ACCESSORS(code_position)
10382 // The position in the source for the break position. 10386 // The position in the source for the break position.
10383 DECL_ACCESSORS(source_position, Smi) 10387 DECL_INT_ACCESSORS(source_position)
10384 // The position in the source for the last statement before this break 10388 // The position in the source for the last statement before this break
10385 // position. 10389 // position.
10386 DECL_ACCESSORS(statement_position, Smi) 10390 DECL_INT_ACCESSORS(statement_position)
10387 // List of related JavaScript break points. 10391 // List of related JavaScript break points.
10388 DECL_ACCESSORS(break_point_objects, Object) 10392 DECL_ACCESSORS(break_point_objects, Object)
10389 10393
10390 // Removes a break point. 10394 // Removes a break point.
10391 static void ClearBreakPoint(Handle<BreakPointInfo> info, 10395 static void ClearBreakPoint(Handle<BreakPointInfo> info,
10392 Handle<Object> break_point_object); 10396 Handle<Object> break_point_object);
10393 // Set a break point. 10397 // Set a break point.
10394 static void SetBreakPoint(Handle<BreakPointInfo> info, 10398 static void SetBreakPoint(Handle<BreakPointInfo> info,
10395 Handle<Object> break_point_object); 10399 Handle<Object> break_point_object);
10396 // Check if break point info has this break point object. 10400 // Check if break point info has this break point object.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
10520 }; 10524 };
10521 10525
10522 10526
10523 class StructBodyDescriptor : public 10527 class StructBodyDescriptor : public
10524 FlexibleBodyDescriptor<HeapObject::kHeaderSize> { 10528 FlexibleBodyDescriptor<HeapObject::kHeaderSize> {
10525 public: 10529 public:
10526 static inline int SizeOf(Map* map, HeapObject* object); 10530 static inline int SizeOf(Map* map, HeapObject* object);
10527 }; 10531 };
10528 10532
10529 10533
10530 // BooleanBit is a helper class for setting and getting a bit in an 10534 // BooleanBit is a helper class for setting and getting a bit in an integer.
10531 // integer or Smi.
10532 class BooleanBit : public AllStatic { 10535 class BooleanBit : public AllStatic {
10533 public: 10536 public:
10534 static inline bool get(Smi* smi, int bit_position) {
10535 return get(smi->value(), bit_position);
10536 }
10537
10538 static inline bool get(int value, int bit_position) { 10537 static inline bool get(int value, int bit_position) {
10539 return (value & (1 << bit_position)) != 0; 10538 return (value & (1 << bit_position)) != 0;
10540 } 10539 }
10541 10540
10542 static inline Smi* set(Smi* smi, int bit_position, bool v) {
10543 return Smi::FromInt(set(smi->value(), bit_position, v));
10544 }
10545
10546 static inline int set(int value, int bit_position, bool v) { 10541 static inline int set(int value, int bit_position, bool v) {
10547 if (v) { 10542 if (v) {
10548 value |= (1 << bit_position); 10543 value |= (1 << bit_position);
10549 } else { 10544 } else {
10550 value &= ~(1 << bit_position); 10545 value &= ~(1 << bit_position);
10551 } 10546 }
10552 return value; 10547 return value;
10553 } 10548 }
10554 }; 10549 };
10555 10550
(...skipping 16 matching lines...) Expand all
10572 10567
10573 Isolate* isolate_; 10568 Isolate* isolate_;
10574 Handle<FixedArray> keys_; 10569 Handle<FixedArray> keys_;
10575 Handle<OrderedHashSet> set_; 10570 Handle<OrderedHashSet> set_;
10576 int length_; 10571 int length_;
10577 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator); 10572 DISALLOW_COPY_AND_ASSIGN(KeyAccumulator);
10578 }; 10573 };
10579 } } // namespace v8::internal 10574 } } // namespace v8::internal
10580 10575
10581 #endif // V8_OBJECTS_H_ 10576 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698