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

Side by Side Diff: src/objects.h

Issue 16562003: Allow smis for singleton types (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/heap.cc ('k') | src/objects-debug.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 // 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // - ExternalAsciiInternalizedString 118 // - ExternalAsciiInternalizedString
119 // - ExternalTwoByteInternalizedString 119 // - ExternalTwoByteInternalizedString
120 // - Symbol 120 // - Symbol
121 // - HeapNumber 121 // - HeapNumber
122 // - Code 122 // - Code
123 // - Map 123 // - Map
124 // - Oddball 124 // - Oddball
125 // - Foreign 125 // - Foreign
126 // - SharedFunctionInfo 126 // - SharedFunctionInfo
127 // - Struct 127 // - Struct
128 // - Box
128 // - DeclaredAccessorDescriptor 129 // - DeclaredAccessorDescriptor
129 // - AccessorInfo 130 // - AccessorInfo
130 // - DeclaredAccessorInfo 131 // - DeclaredAccessorInfo
131 // - ExecutableAccessorInfo 132 // - ExecutableAccessorInfo
132 // - AccessorPair 133 // - AccessorPair
133 // - AccessCheckInfo 134 // - AccessCheckInfo
134 // - InterceptorInfo 135 // - InterceptorInfo
135 // - CallHandlerInfo 136 // - CallHandlerInfo
136 // - TemplateInfo 137 // - TemplateInfo
137 // - FunctionTemplateInfo 138 // - FunctionTemplateInfo
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 342 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
342 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ 343 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
343 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 344 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
344 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 345 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
345 \ 346 \
346 V(SYMBOL_TYPE) \ 347 V(SYMBOL_TYPE) \
347 V(MAP_TYPE) \ 348 V(MAP_TYPE) \
348 V(CODE_TYPE) \ 349 V(CODE_TYPE) \
349 V(ODDBALL_TYPE) \ 350 V(ODDBALL_TYPE) \
350 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ 351 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
352 V(BOX_TYPE) \
351 \ 353 \
352 V(HEAP_NUMBER_TYPE) \ 354 V(HEAP_NUMBER_TYPE) \
353 V(FOREIGN_TYPE) \ 355 V(FOREIGN_TYPE) \
354 V(BYTE_ARRAY_TYPE) \ 356 V(BYTE_ARRAY_TYPE) \
355 V(FREE_SPACE_TYPE) \ 357 V(FREE_SPACE_TYPE) \
356 /* Note: the order of these external array */ \ 358 /* Note: the order of these external array */ \
357 /* types is relied upon in */ \ 359 /* types is relied upon in */ \
358 /* Object::IsExternalArray(). */ \ 360 /* Object::IsExternalArray(). */ \
359 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 361 V(EXTERNAL_BYTE_ARRAY_TYPE) \
360 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ 362 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 // A struct is a simple object a set of object-valued fields. Including an 521 // A struct is a simple object a set of object-valued fields. Including an
520 // object type in this causes the compiler to generate most of the boilerplate 522 // object type in this causes the compiler to generate most of the boilerplate
521 // code for the class including allocation and garbage collection routines, 523 // code for the class including allocation and garbage collection routines,
522 // casts and predicates. All you need to define is the class, methods and 524 // casts and predicates. All you need to define is the class, methods and
523 // object verification routines. Easy, no? 525 // object verification routines. Easy, no?
524 // 526 //
525 // Note that for subtle reasons related to the ordering or numerical values of 527 // Note that for subtle reasons related to the ordering or numerical values of
526 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST 528 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST
527 // manually. 529 // manually.
528 #define STRUCT_LIST_ALL(V) \ 530 #define STRUCT_LIST_ALL(V) \
531 V(BOX, Box, box) \
529 V(DECLARED_ACCESSOR_DESCRIPTOR, \ 532 V(DECLARED_ACCESSOR_DESCRIPTOR, \
530 DeclaredAccessorDescriptor, \ 533 DeclaredAccessorDescriptor, \
531 declared_accessor_descriptor) \ 534 declared_accessor_descriptor) \
532 V(DECLARED_ACCESSOR_INFO, DeclaredAccessorInfo, declared_accessor_info) \ 535 V(DECLARED_ACCESSOR_INFO, DeclaredAccessorInfo, declared_accessor_info) \
533 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ 536 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\
534 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ 537 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
535 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ 538 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
536 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ 539 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
537 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ 540 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
538 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ 541 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag, 663 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag,
661 664
662 // Non-string names 665 // Non-string names
663 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE 666 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE
664 667
665 // Objects allocated in their own spaces (never in new space). 668 // Objects allocated in their own spaces (never in new space).
666 MAP_TYPE, 669 MAP_TYPE,
667 CODE_TYPE, 670 CODE_TYPE,
668 ODDBALL_TYPE, 671 ODDBALL_TYPE,
669 JS_GLOBAL_PROPERTY_CELL_TYPE, 672 JS_GLOBAL_PROPERTY_CELL_TYPE,
673 BOX_TYPE,
670 674
671 // "Data", objects that cannot contain non-map-word pointers to heap 675 // "Data", objects that cannot contain non-map-word pointers to heap
672 // objects. 676 // objects.
673 HEAP_NUMBER_TYPE, 677 HEAP_NUMBER_TYPE,
674 FOREIGN_TYPE, 678 FOREIGN_TYPE,
675 BYTE_ARRAY_TYPE, 679 BYTE_ARRAY_TYPE,
676 FREE_SPACE_TYPE, 680 FREE_SPACE_TYPE,
677 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 681 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
678 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 682 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
679 EXTERNAL_SHORT_ARRAY_TYPE, 683 EXTERNAL_SHORT_ARRAY_TYPE,
(...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after
5678 // An abstract superclass, a marker class really, for simple structure classes. 5682 // An abstract superclass, a marker class really, for simple structure classes.
5679 // It doesn't carry much functionality but allows struct classes to be 5683 // It doesn't carry much functionality but allows struct classes to be
5680 // identified in the type system. 5684 // identified in the type system.
5681 class Struct: public HeapObject { 5685 class Struct: public HeapObject {
5682 public: 5686 public:
5683 inline void InitializeBody(int object_size); 5687 inline void InitializeBody(int object_size);
5684 static inline Struct* cast(Object* that); 5688 static inline Struct* cast(Object* that);
5685 }; 5689 };
5686 5690
5687 5691
5692 // A simple one-element struct, useful where smis need to be boxed.
5693 class Box : public Struct {
5694 public:
5695 // [value]: the boxed contents.
5696 DECL_ACCESSORS(value, Object)
5697
5698 static inline Box* cast(Object* obj);
5699
5700 // Dispatched behavior.
5701 DECLARE_PRINTER(Box)
5702 DECLARE_VERIFIER(Box)
5703
5704 static const int kValueOffset = HeapObject::kHeaderSize;
5705 static const int kSize = kValueOffset + kPointerSize;
5706
5707 private:
5708 DISALLOW_IMPLICIT_CONSTRUCTORS(Box);
5709 };
5710
5711
5688 // Script describes a script which has been added to the VM. 5712 // Script describes a script which has been added to the VM.
5689 class Script: public Struct { 5713 class Script: public Struct {
5690 public: 5714 public:
5691 // Script types. 5715 // Script types.
5692 enum Type { 5716 enum Type {
5693 TYPE_NATIVE = 0, 5717 TYPE_NATIVE = 0,
5694 TYPE_EXTENSION = 1, 5718 TYPE_EXTENSION = 1,
5695 TYPE_NORMAL = 2 5719 TYPE_NORMAL = 2
5696 }; 5720 };
5697 5721
(...skipping 3920 matching lines...) Expand 10 before | Expand all | Expand 10 after
9618 } else { 9642 } else {
9619 value &= ~(1 << bit_position); 9643 value &= ~(1 << bit_position);
9620 } 9644 }
9621 return value; 9645 return value;
9622 } 9646 }
9623 }; 9647 };
9624 9648
9625 } } // namespace v8::internal 9649 } } // namespace v8::internal
9626 9650
9627 #endif // V8_OBJECTS_H_ 9651 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698