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

Side by Side Diff: src/objects.h

Issue 1182303004: All private symbols are own symbols (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Fix nits Created 5 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 unified diff | Download patch
« no previous file with comments | « src/messages.js ('k') | src/objects-inl.h » ('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 8550 matching lines...) Expand 10 before | Expand all | Expand 10 after
8561 // Returns a hash value used for the property table 8561 // Returns a hash value used for the property table
8562 inline uint32_t Hash(); 8562 inline uint32_t Hash();
8563 8563
8564 // Equality operations. 8564 // Equality operations.
8565 inline bool Equals(Name* other); 8565 inline bool Equals(Name* other);
8566 inline static bool Equals(Handle<Name> one, Handle<Name> two); 8566 inline static bool Equals(Handle<Name> one, Handle<Name> two);
8567 8567
8568 // Conversion. 8568 // Conversion.
8569 inline bool AsArrayIndex(uint32_t* index); 8569 inline bool AsArrayIndex(uint32_t* index);
8570 8570
8571 // Whether name can only name own properties. 8571 // If the name is private, it can only name own properties.
8572 inline bool IsOwn(); 8572 inline bool IsPrivate();
8573 8573
8574 DECLARE_CAST(Name) 8574 DECLARE_CAST(Name)
8575 8575
8576 DECLARE_PRINTER(Name) 8576 DECLARE_PRINTER(Name)
8577 #if TRACE_MAPS 8577 #if TRACE_MAPS
8578 void NameShortPrint(); 8578 void NameShortPrint();
8579 int NameShortPrint(Vector<char> str); 8579 int NameShortPrint(Vector<char> str);
8580 #endif 8580 #endif
8581 8581
8582 // Layout description. 8582 // Layout description.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
8640 static inline bool IsHashFieldComputed(uint32_t field); 8640 static inline bool IsHashFieldComputed(uint32_t field);
8641 8641
8642 private: 8642 private:
8643 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); 8643 DISALLOW_IMPLICIT_CONSTRUCTORS(Name);
8644 }; 8644 };
8645 8645
8646 8646
8647 // ES6 symbols. 8647 // ES6 symbols.
8648 class Symbol: public Name { 8648 class Symbol: public Name {
8649 public: 8649 public:
8650 // [name]: the print name of a symbol, or undefined if none. 8650 // [name]: The print name of a symbol, or undefined if none.
8651 DECL_ACCESSORS(name, Object) 8651 DECL_ACCESSORS(name, Object)
8652 8652
8653 DECL_ACCESSORS(flags, Smi) 8653 DECL_ACCESSORS(flags, Smi)
8654 8654
8655 // [is_private]: whether this is a private symbol. 8655 // [is_private]: Whether this is a private symbol. Private symbols can only
8656 // be used to designate own properties of objects.
8656 DECL_BOOLEAN_ACCESSORS(is_private) 8657 DECL_BOOLEAN_ACCESSORS(is_private)
8657 8658
8658 // [is_own]: whether this is an own symbol, that is, only used to designate
8659 // own properties of objects.
8660 DECL_BOOLEAN_ACCESSORS(is_own)
8661
8662 DECLARE_CAST(Symbol) 8659 DECLARE_CAST(Symbol)
8663 8660
8664 // Dispatched behavior. 8661 // Dispatched behavior.
8665 DECLARE_PRINTER(Symbol) 8662 DECLARE_PRINTER(Symbol)
8666 DECLARE_VERIFIER(Symbol) 8663 DECLARE_VERIFIER(Symbol)
8667 8664
8668 // Layout description. 8665 // Layout description.
8669 static const int kNameOffset = Name::kSize; 8666 static const int kNameOffset = Name::kSize;
8670 static const int kFlagsOffset = kNameOffset + kPointerSize; 8667 static const int kFlagsOffset = kNameOffset + kPointerSize;
8671 static const int kSize = kFlagsOffset + kPointerSize; 8668 static const int kSize = kFlagsOffset + kPointerSize;
8672 8669
8673 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor; 8670 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor;
8674 8671
8675 void SymbolShortPrint(std::ostream& os); 8672 void SymbolShortPrint(std::ostream& os);
8676 8673
8677 private: 8674 private:
8678 static const int kPrivateBit = 0; 8675 static const int kPrivateBit = 0;
8679 static const int kOwnBit = 1;
8680 8676
8681 const char* PrivateSymbolToName() const; 8677 const char* PrivateSymbolToName() const;
8682 8678
8683 #if TRACE_MAPS 8679 #if TRACE_MAPS
8684 friend class Name; // For PrivateSymbolToName. 8680 friend class Name; // For PrivateSymbolToName.
8685 #endif 8681 #endif
8686 8682
8687 DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol); 8683 DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol);
8688 }; 8684 };
8689 8685
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after
10850 } else { 10846 } else {
10851 value &= ~(1 << bit_position); 10847 value &= ~(1 << bit_position);
10852 } 10848 }
10853 return value; 10849 return value;
10854 } 10850 }
10855 }; 10851 };
10856 10852
10857 } } // namespace v8::internal 10853 } } // namespace v8::internal
10858 10854
10859 #endif // V8_OBJECTS_H_ 10855 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698