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

Side by Side Diff: src/objects.h

Issue 48923002: Provide private symbols through internal APIs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Make privates a non-value; comments Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // - ExternalTwoByteString 116 // - ExternalTwoByteString
117 // - InternalizedString 117 // - InternalizedString
118 // - SeqInternalizedString 118 // - SeqInternalizedString
119 // - SeqOneByteInternalizedString 119 // - SeqOneByteInternalizedString
120 // - SeqTwoByteInternalizedString 120 // - SeqTwoByteInternalizedString
121 // - ConsInternalizedString 121 // - ConsInternalizedString
122 // - ExternalInternalizedString 122 // - ExternalInternalizedString
123 // - ExternalAsciiInternalizedString 123 // - ExternalAsciiInternalizedString
124 // - ExternalTwoByteInternalizedString 124 // - ExternalTwoByteInternalizedString
125 // - Symbol 125 // - Symbol
126 // - Private
126 // - HeapNumber 127 // - HeapNumber
127 // - Cell 128 // - Cell
128 // - PropertyCell 129 // - PropertyCell
129 // - Code 130 // - Code
130 // - Map 131 // - Map
131 // - Oddball 132 // - Oddball
132 // - Foreign 133 // - Foreign
133 // - SharedFunctionInfo 134 // - SharedFunctionInfo
134 // - Struct 135 // - Struct
135 // - Box 136 // - Box
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 V(CONS_INTERNALIZED_STRING_TYPE) \ 353 V(CONS_INTERNALIZED_STRING_TYPE) \
353 V(CONS_ASCII_INTERNALIZED_STRING_TYPE) \ 354 V(CONS_ASCII_INTERNALIZED_STRING_TYPE) \
354 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ 355 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \
355 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 356 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
356 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 357 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
357 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ 358 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
358 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 359 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
359 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 360 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
360 \ 361 \
361 V(SYMBOL_TYPE) \ 362 V(SYMBOL_TYPE) \
363 \
Yang 2013/10/29 12:47:26 stray edit?
rossberg 2013/10/29 15:08:19 On purpose. :)
362 V(MAP_TYPE) \ 364 V(MAP_TYPE) \
363 V(CODE_TYPE) \ 365 V(CODE_TYPE) \
364 V(ODDBALL_TYPE) \ 366 V(ODDBALL_TYPE) \
365 V(CELL_TYPE) \ 367 V(CELL_TYPE) \
366 V(PROPERTY_CELL_TYPE) \ 368 V(PROPERTY_CELL_TYPE) \
367 \ 369 \
368 V(HEAP_NUMBER_TYPE) \ 370 V(HEAP_NUMBER_TYPE) \
369 V(FOREIGN_TYPE) \ 371 V(FOREIGN_TYPE) \
370 V(BYTE_ARRAY_TYPE) \ 372 V(BYTE_ARRAY_TYPE) \
371 V(FREE_SPACE_TYPE) \ 373 V(FREE_SPACE_TYPE) \
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 | kNotInternalizedTag, 686 | kNotInternalizedTag,
685 SHORT_EXTERNAL_STRING_TYPE = 687 SHORT_EXTERNAL_STRING_TYPE =
686 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, 688 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
687 SHORT_EXTERNAL_ASCII_STRING_TYPE = 689 SHORT_EXTERNAL_ASCII_STRING_TYPE =
688 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, 690 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
689 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = 691 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE =
690 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE 692 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE
691 | kNotInternalizedTag, 693 | kNotInternalizedTag,
692 694
693 // Non-string names 695 // Non-string names
694 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE 696 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE
695 697
696 // Objects allocated in their own spaces (never in new space). 698 // Objects allocated in their own spaces (never in new space).
697 MAP_TYPE, 699 MAP_TYPE,
698 CODE_TYPE, 700 CODE_TYPE,
699 ODDBALL_TYPE, 701 ODDBALL_TYPE,
700 CELL_TYPE, 702 CELL_TYPE,
701 PROPERTY_CELL_TYPE, 703 PROPERTY_CELL_TYPE,
702 704
703 // "Data", objects that cannot contain non-map-word pointers to heap 705 // "Data", objects that cannot contain non-map-word pointers to heap
704 // objects. 706 // objects.
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 INLINE(bool IsSpecObject()); 1379 INLINE(bool IsSpecObject());
1378 INLINE(bool IsSpecFunction()); 1380 INLINE(bool IsSpecFunction());
1379 1381
1380 // Oddball testing. 1382 // Oddball testing.
1381 INLINE(bool IsUndefined()); 1383 INLINE(bool IsUndefined());
1382 INLINE(bool IsNull()); 1384 INLINE(bool IsNull());
1383 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation. 1385 INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation.
1384 INLINE(bool IsUninitialized()); 1386 INLINE(bool IsUninitialized());
1385 INLINE(bool IsTrue()); 1387 INLINE(bool IsTrue());
1386 INLINE(bool IsFalse()); 1388 INLINE(bool IsFalse());
1389 INLINE(bool IsPrivate());
1387 inline bool IsArgumentsMarker(); 1390 inline bool IsArgumentsMarker();
1388 inline bool NonFailureIsHeapObject(); 1391 inline bool NonFailureIsHeapObject();
1389 1392
1390 // Filler objects (fillers and free space objects). 1393 // Filler objects (fillers and free space objects).
1391 inline bool IsFiller(); 1394 inline bool IsFiller();
1392 1395
1393 // Extract the number. 1396 // Extract the number.
1394 inline double Number(); 1397 inline double Number();
1395 inline bool IsNaN(); 1398 inline bool IsNaN();
1396 bool ToInt32(int32_t* value); 1399 bool ToInt32(int32_t* value);
(...skipping 6926 matching lines...) Expand 10 before | Expand all | Expand 10 after
8323 kIsNotArrayIndexMask | kHashNotComputedMask; 8326 kIsNotArrayIndexMask | kHashNotComputedMask;
8324 8327
8325 protected: 8328 protected:
8326 static inline bool IsHashFieldComputed(uint32_t field); 8329 static inline bool IsHashFieldComputed(uint32_t field);
8327 8330
8328 private: 8331 private:
8329 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); 8332 DISALLOW_IMPLICIT_CONSTRUCTORS(Name);
8330 }; 8333 };
8331 8334
8332 8335
8333 // ES6 symbols. 8336 // ES6 unique symbols.
8334 class Symbol: public Name { 8337 class Symbol: public Name {
8335 public: 8338 public:
8336 // [name]: the print name of a symbol, or undefined if none. 8339 // [name]: the print name of a symbol, or undefined if none,
8340 // or for private symbols, a Box containing one of those.
8337 DECL_ACCESSORS(name, Object) 8341 DECL_ACCESSORS(name, Object)
8338 8342
8339 // Casting. 8343 // Casting.
8340 static inline Symbol* cast(Object* obj); 8344 static inline Symbol* cast(Object* obj);
8341 8345
8342 // Dispatched behavior. 8346 // Dispatched behavior.
8343 DECLARE_PRINTER(Symbol) 8347 DECLARE_PRINTER(Symbol)
8344 DECLARE_VERIFIER(Symbol) 8348 DECLARE_VERIFIER(Symbol)
8345 8349
8346 // Layout description. 8350 // Layout description.
8347 static const int kNameOffset = Name::kSize; 8351 static const int kNameOffset = Name::kSize;
8348 static const int kSize = kNameOffset + kPointerSize; 8352 static const int kSize = kNameOffset + kPointerSize;
8349 8353
8350 typedef FixedBodyDescriptor<kNameOffset, kNameOffset + kPointerSize, kSize> 8354 typedef FixedBodyDescriptor<kNameOffset, kNameOffset + kPointerSize, kSize>
8351 BodyDescriptor; 8355 BodyDescriptor;
8352 8356
8353 private: 8357 private:
8354 DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol); 8358 DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol);
8355 }; 8359 };
8356 8360
8357 8361
8362 // Private symbols.
8363 class Private: public Symbol {
8364 public:
8365 // The print name of a private symbol, or undefined if none.
8366 DECL_ACCESSORS(name, Object)
8367
8368 // Casting.
8369 static inline Private* cast(Object* obj);
8370
8371 private:
8372 DISALLOW_IMPLICIT_CONSTRUCTORS(Private);
8373 };
8374
8375
8358 class ConsString; 8376 class ConsString;
8359 8377
8360 // The String abstract class captures JavaScript string values: 8378 // The String abstract class captures JavaScript string values:
8361 // 8379 //
8362 // Ecma-262: 8380 // Ecma-262:
8363 // 4.3.16 String Value 8381 // 4.3.16 String Value
8364 // A string value is a member of the type String and is a finite 8382 // A string value is a member of the type String and is a finite
8365 // ordered sequence of zero or more 16-bit unsigned integer values. 8383 // ordered sequence of zero or more 16-bit unsigned integer values.
8366 // 8384 //
8367 // All string values have a length field. 8385 // All string values have a length field.
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
10437 } else { 10455 } else {
10438 value &= ~(1 << bit_position); 10456 value &= ~(1 << bit_position);
10439 } 10457 }
10440 return value; 10458 return value;
10441 } 10459 }
10442 }; 10460 };
10443 10461
10444 } } // namespace v8::internal 10462 } } // namespace v8::internal
10445 10463
10446 #endif // V8_OBJECTS_H_ 10464 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698