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

Side by Side Diff: src/objects.h

Issue 16631002: Separate Cell and PropertyCell spaces (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove Mips changes 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/mksnapshot.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 // 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // - InternalizedString 112 // - InternalizedString
113 // - SeqInternalizedString 113 // - SeqInternalizedString
114 // - SeqOneByteInternalizedString 114 // - SeqOneByteInternalizedString
115 // - SeqTwoByteInternalizedString 115 // - SeqTwoByteInternalizedString
116 // - ConsInternalizedString 116 // - ConsInternalizedString
117 // - ExternalInternalizedString 117 // - ExternalInternalizedString
118 // - ExternalAsciiInternalizedString 118 // - ExternalAsciiInternalizedString
119 // - ExternalTwoByteInternalizedString 119 // - ExternalTwoByteInternalizedString
120 // - Symbol 120 // - Symbol
121 // - HeapNumber 121 // - HeapNumber
122 // - Cell
123 // - JSGlobalPropertyCell
122 // - Code 124 // - Code
123 // - Map 125 // - Map
124 // - Oddball 126 // - Oddball
125 // - Foreign 127 // - Foreign
126 // - SharedFunctionInfo 128 // - SharedFunctionInfo
127 // - Struct 129 // - Struct
128 // - Box 130 // - Box
129 // - DeclaredAccessorDescriptor 131 // - DeclaredAccessorDescriptor
130 // - AccessorInfo 132 // - AccessorInfo
131 // - DeclaredAccessorInfo 133 // - DeclaredAccessorInfo
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 343 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
342 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 344 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
343 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ 345 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
344 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 346 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
345 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 347 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
346 \ 348 \
347 V(SYMBOL_TYPE) \ 349 V(SYMBOL_TYPE) \
348 V(MAP_TYPE) \ 350 V(MAP_TYPE) \
349 V(CODE_TYPE) \ 351 V(CODE_TYPE) \
350 V(ODDBALL_TYPE) \ 352 V(ODDBALL_TYPE) \
351 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ 353 V(CELL_TYPE) \
354 V(PROPERTY_CELL_TYPE) \
352 V(BOX_TYPE) \ 355 V(BOX_TYPE) \
353 \ 356 \
354 V(HEAP_NUMBER_TYPE) \ 357 V(HEAP_NUMBER_TYPE) \
355 V(FOREIGN_TYPE) \ 358 V(FOREIGN_TYPE) \
356 V(BYTE_ARRAY_TYPE) \ 359 V(BYTE_ARRAY_TYPE) \
357 V(FREE_SPACE_TYPE) \ 360 V(FREE_SPACE_TYPE) \
358 /* Note: the order of these external array */ \ 361 /* Note: the order of these external array */ \
359 /* types is relied upon in */ \ 362 /* types is relied upon in */ \
360 /* Object::IsExternalArray(). */ \ 363 /* Object::IsExternalArray(). */ \
361 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 364 V(EXTERNAL_BYTE_ARRAY_TYPE) \
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = 665 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE =
663 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag, 666 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag,
664 667
665 // Non-string names 668 // Non-string names
666 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE 669 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE
667 670
668 // Objects allocated in their own spaces (never in new space). 671 // Objects allocated in their own spaces (never in new space).
669 MAP_TYPE, 672 MAP_TYPE,
670 CODE_TYPE, 673 CODE_TYPE,
671 ODDBALL_TYPE, 674 ODDBALL_TYPE,
672 JS_GLOBAL_PROPERTY_CELL_TYPE, 675 CELL_TYPE,
676 PROPERTY_CELL_TYPE,
673 BOX_TYPE, 677 BOX_TYPE,
674 678
675 // "Data", objects that cannot contain non-map-word pointers to heap 679 // "Data", objects that cannot contain non-map-word pointers to heap
676 // objects. 680 // objects.
677 HEAP_NUMBER_TYPE, 681 HEAP_NUMBER_TYPE,
678 FOREIGN_TYPE, 682 FOREIGN_TYPE,
679 BYTE_ARRAY_TYPE, 683 BYTE_ARRAY_TYPE,
680 FREE_SPACE_TYPE, 684 FREE_SPACE_TYPE,
681 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 685 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
682 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 686 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 838 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
835 839
836 840
837 class AccessorPair; 841 class AccessorPair;
838 class DictionaryElementsAccessor; 842 class DictionaryElementsAccessor;
839 class ElementsAccessor; 843 class ElementsAccessor;
840 class Failure; 844 class Failure;
841 class FixedArrayBase; 845 class FixedArrayBase;
842 class ObjectVisitor; 846 class ObjectVisitor;
843 class StringStream; 847 class StringStream;
848 class Type;
844 849
845 struct ValueInfo : public Malloced { 850 struct ValueInfo : public Malloced {
846 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } 851 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
847 InstanceType type; 852 InstanceType type;
848 Object* ptr; 853 Object* ptr;
849 const char* str; 854 const char* str;
850 double number; 855 double number;
851 }; 856 };
852 857
853 858
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 V(CodeCacheHashTable) \ 1009 V(CodeCacheHashTable) \
1005 V(PolymorphicCodeCacheHashTable) \ 1010 V(PolymorphicCodeCacheHashTable) \
1006 V(MapCache) \ 1011 V(MapCache) \
1007 V(Primitive) \ 1012 V(Primitive) \
1008 V(GlobalObject) \ 1013 V(GlobalObject) \
1009 V(JSGlobalObject) \ 1014 V(JSGlobalObject) \
1010 V(JSBuiltinsObject) \ 1015 V(JSBuiltinsObject) \
1011 V(JSGlobalProxy) \ 1016 V(JSGlobalProxy) \
1012 V(UndetectableObject) \ 1017 V(UndetectableObject) \
1013 V(AccessCheckNeeded) \ 1018 V(AccessCheckNeeded) \
1019 V(Cell) \
1014 V(JSGlobalPropertyCell) \ 1020 V(JSGlobalPropertyCell) \
1015 V(ObjectHashTable) \ 1021 V(ObjectHashTable) \
1016 1022
1017 1023
1018 // Object is the abstract superclass for all classes in the 1024 // Object is the abstract superclass for all classes in the
1019 // object hierarchy. 1025 // object hierarchy.
1020 // Object does not use any virtual functions to avoid the 1026 // Object does not use any virtual functions to avoid the
1021 // allocation of the C++ vtable. 1027 // allocation of the C++ vtable.
1022 // Since Smi and Failure are subclasses of Object no 1028 // Since Smi and Failure are subclasses of Object no
1023 // data members can be present in Object. 1029 // data members can be present in Object.
(...skipping 3347 matching lines...) Expand 10 before | Expand all | Expand 10 after
4371 // Casting. 4377 // Casting.
4372 static inline DeoptimizationOutputData* cast(Object* obj); 4378 static inline DeoptimizationOutputData* cast(Object* obj);
4373 4379
4374 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 4380 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
4375 void DeoptimizationOutputDataPrint(FILE* out); 4381 void DeoptimizationOutputDataPrint(FILE* out);
4376 #endif 4382 #endif
4377 }; 4383 };
4378 4384
4379 4385
4380 // Forward declaration. 4386 // Forward declaration.
4387 class Cell;
4381 class JSGlobalPropertyCell; 4388 class JSGlobalPropertyCell;
4382 4389
4383 // TypeFeedbackCells is a fixed array used to hold the association between 4390 // TypeFeedbackCells is a fixed array used to hold the association between
4384 // cache cells and AST ids for code generated by the full compiler. 4391 // cache cells and AST ids for code generated by the full compiler.
4385 // The format of the these objects is 4392 // The format of the these objects is
4386 // [i * 2]: Global property cell of ith cache cell. 4393 // [i * 2]: Global property cell of ith cache cell.
4387 // [i * 2 + 1]: Ast ID for ith cache cell. 4394 // [i * 2 + 1]: Ast ID for ith cache cell.
4388 class TypeFeedbackCells: public FixedArray { 4395 class TypeFeedbackCells: public FixedArray {
4389 public: 4396 public:
4390 int CellCount() { return length() / 2; } 4397 int CellCount() { return length() / 2; }
4391 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } 4398 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; }
4392 4399
4393 // Accessors for AST ids associated with cache values. 4400 // Accessors for AST ids associated with cache values.
4394 inline TypeFeedbackId AstId(int index); 4401 inline TypeFeedbackId AstId(int index);
4395 inline void SetAstId(int index, TypeFeedbackId id); 4402 inline void SetAstId(int index, TypeFeedbackId id);
4396 4403
4397 // Accessors for global property cells holding the cache values. 4404 // Accessors for global property cells holding the cache values.
4398 inline JSGlobalPropertyCell* Cell(int index); 4405 inline Cell* GetCell(int index);
4399 inline void SetCell(int index, JSGlobalPropertyCell* cell); 4406 inline void SetCell(int index, Cell* cell);
4400 4407
4401 // The object that indicates an uninitialized cache. 4408 // The object that indicates an uninitialized cache.
4402 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); 4409 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
4403 4410
4404 // The object that indicates a megamorphic state. 4411 // The object that indicates a megamorphic state.
4405 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); 4412 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
4406 4413
4407 // The object that indicates a monomorphic state of Array with 4414 // The object that indicates a monomorphic state of Array with
4408 // ElementsKind 4415 // ElementsKind
4409 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, 4416 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate,
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
5396 5403
5397 int NumberOfOwnDescriptors() { 5404 int NumberOfOwnDescriptors() {
5398 return NumberOfOwnDescriptorsBits::decode(bit_field3()); 5405 return NumberOfOwnDescriptorsBits::decode(bit_field3());
5399 } 5406 }
5400 5407
5401 void SetNumberOfOwnDescriptors(int number) { 5408 void SetNumberOfOwnDescriptors(int number) {
5402 ASSERT(number <= instance_descriptors()->number_of_descriptors()); 5409 ASSERT(number <= instance_descriptors()->number_of_descriptors());
5403 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); 5410 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
5404 } 5411 }
5405 5412
5406 inline JSGlobalPropertyCell* RetrieveDescriptorsPointer(); 5413 inline Cell* RetrieveDescriptorsPointer();
5407 5414
5408 int EnumLength() { 5415 int EnumLength() {
5409 return EnumLengthBits::decode(bit_field3()); 5416 return EnumLengthBits::decode(bit_field3());
5410 } 5417 }
5411 5418
5412 void SetEnumLength(int length) { 5419 void SetEnumLength(int length) {
5413 if (length != kInvalidEnumCache) { 5420 if (length != kInvalidEnumCache) {
5414 ASSERT(length >= 0); 5421 ASSERT(length >= 0);
5415 ASSERT(length == 0 || instance_descriptors()->HasEnumCache()); 5422 ASSERT(length == 0 || instance_descriptors()->HasEnumCache());
5416 ASSERT(length <= NumberOfOwnDescriptors()); 5423 ASSERT(length <= NumberOfOwnDescriptors());
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after
8550 8557
8551 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset); 8558 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset);
8552 STATIC_CHECK(kNull == Internals::kNullOddballKind); 8559 STATIC_CHECK(kNull == Internals::kNullOddballKind);
8553 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind); 8560 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind);
8554 8561
8555 private: 8562 private:
8556 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); 8563 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
8557 }; 8564 };
8558 8565
8559 8566
8560 class JSGlobalPropertyCell: public HeapObject { 8567 class Cell: public HeapObject {
8561 public: 8568 public:
8562 // [value]: value of the global property. 8569 // [value]: value of the global property.
8563 DECL_ACCESSORS(value, Object) 8570 DECL_ACCESSORS(value, Object)
8564 8571
8565 // Casting. 8572 // Casting.
8566 static inline JSGlobalPropertyCell* cast(Object* obj); 8573 static inline Cell* cast(Object* obj);
8567 8574
8568 static inline JSGlobalPropertyCell* FromValueAddress(Address value) { 8575 static inline Cell* FromValueAddress(Address value) {
8569 return cast(FromAddress(value - kValueOffset)); 8576 Object* result = FromAddress(value - kValueOffset);
8577 ASSERT(result->IsCell() || result->IsJSGlobalPropertyCell());
8578 return static_cast<Cell*>(result);
8570 } 8579 }
8571 8580
8572 inline Address ValueAddress() { 8581 inline Address ValueAddress() {
8573 return address() + kValueOffset; 8582 return address() + kValueOffset;
8574 } 8583 }
8575 8584
8576 // Dispatched behavior. 8585 // Dispatched behavior.
8577 DECLARE_PRINTER(JSGlobalPropertyCell) 8586 DECLARE_PRINTER(Cell)
8578 DECLARE_VERIFIER(JSGlobalPropertyCell) 8587 DECLARE_VERIFIER(Cell)
8579 8588
8580 // Layout description. 8589 // Layout description.
8581 static const int kValueOffset = HeapObject::kHeaderSize; 8590 static const int kValueOffset = HeapObject::kHeaderSize;
8582 static const int kSize = kValueOffset + kPointerSize; 8591 static const int kSize = kValueOffset + kPointerSize;
8583 8592
8584 typedef FixedBodyDescriptor<kValueOffset, 8593 typedef FixedBodyDescriptor<kValueOffset,
8585 kValueOffset + kPointerSize, 8594 kValueOffset + kPointerSize,
8586 kSize> BodyDescriptor; 8595 kSize> BodyDescriptor;
8587 8596
8588 private: 8597 private:
8598 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell);
8599 };
8600
8601
8602 class JSGlobalPropertyCell: public Cell {
8603 public:
8604 Type* type();
8605 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
8606
8607 // Casting.
8608 static inline JSGlobalPropertyCell* cast(Object* obj);
8609
8610 inline Address TypeAddress() {
8611 return address() + kTypeOffset;
8612 }
8613
8614 // Dispatched behavior.
8615 DECLARE_PRINTER(JSGlobalPropertyCell)
8616 DECLARE_VERIFIER(JSGlobalPropertyCell)
8617
8618 // Layout description.
8619 static const int kTypeOffset = kValueOffset + kPointerSize;
8620 static const int kSize = kTypeOffset + kPointerSize;
8621
8622 typedef FixedBodyDescriptor<
8623 kValueOffset,
8624 kTypeOffset + kPointerSize,
8625 JSGlobalPropertyCell::kSize> BodyDescriptor;
8626
8627 private:
8628 DECL_ACCESSORS(type_raw, Object)
8589 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); 8629 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell);
8590 }; 8630 };
8591 8631
8592 8632
8593 // The JSProxy describes EcmaScript Harmony proxies 8633 // The JSProxy describes EcmaScript Harmony proxies
8594 class JSProxy: public JSReceiver { 8634 class JSProxy: public JSReceiver {
8595 public: 8635 public:
8596 // [handler]: The handler property. 8636 // [handler]: The handler property.
8597 DECL_ACCESSORS(handler, Object) 8637 DECL_ACCESSORS(handler, Object)
8598 8638
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
9598 // To allow lazy clearing of inline caches the visitor has 9638 // To allow lazy clearing of inline caches the visitor has
9599 // a rich interface for iterating over Code objects.. 9639 // a rich interface for iterating over Code objects..
9600 9640
9601 // Visits a code target in the instruction stream. 9641 // Visits a code target in the instruction stream.
9602 virtual void VisitCodeTarget(RelocInfo* rinfo); 9642 virtual void VisitCodeTarget(RelocInfo* rinfo);
9603 9643
9604 // Visits a code entry in a JS function. 9644 // Visits a code entry in a JS function.
9605 virtual void VisitCodeEntry(Address entry_address); 9645 virtual void VisitCodeEntry(Address entry_address);
9606 9646
9607 // Visits a global property cell reference in the instruction stream. 9647 // Visits a global property cell reference in the instruction stream.
9608 virtual void VisitGlobalPropertyCell(RelocInfo* rinfo); 9648 virtual void VisitCell(RelocInfo* rinfo);
9609 9649
9610 // Visits a runtime entry in the instruction stream. 9650 // Visits a runtime entry in the instruction stream.
9611 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} 9651 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {}
9612 9652
9613 // Visits the resource of an ASCII or two-byte string. 9653 // Visits the resource of an ASCII or two-byte string.
9614 virtual void VisitExternalAsciiString( 9654 virtual void VisitExternalAsciiString(
9615 v8::String::ExternalAsciiStringResource** resource) {} 9655 v8::String::ExternalAsciiStringResource** resource) {}
9616 virtual void VisitExternalTwoByteString( 9656 virtual void VisitExternalTwoByteString(
9617 v8::String::ExternalStringResource** resource) {} 9657 v8::String::ExternalStringResource** resource) {}
9618 9658
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
9681 } else { 9721 } else {
9682 value &= ~(1 << bit_position); 9722 value &= ~(1 << bit_position);
9683 } 9723 }
9684 return value; 9724 return value;
9685 } 9725 }
9686 }; 9726 };
9687 9727
9688 } } // namespace v8::internal 9728 } } // namespace v8::internal
9689 9729
9690 #endif // V8_OBJECTS_H_ 9730 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mksnapshot.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698