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

Side by Side Diff: src/objects.h

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // - InternalizedString 114 // - InternalizedString
115 // - SeqInternalizedString 115 // - SeqInternalizedString
116 // - SeqOneByteInternalizedString 116 // - SeqOneByteInternalizedString
117 // - SeqTwoByteInternalizedString 117 // - SeqTwoByteInternalizedString
118 // - ConsInternalizedString 118 // - ConsInternalizedString
119 // - ExternalInternalizedString 119 // - ExternalInternalizedString
120 // - ExternalAsciiInternalizedString 120 // - ExternalAsciiInternalizedString
121 // - ExternalTwoByteInternalizedString 121 // - ExternalTwoByteInternalizedString
122 // - Symbol 122 // - Symbol
123 // - HeapNumber 123 // - HeapNumber
124 // - Cell
125 // - PropertyCell
124 // - Code 126 // - Code
125 // - Map 127 // - Map
126 // - Oddball 128 // - Oddball
127 // - Foreign 129 // - Foreign
128 // - SharedFunctionInfo 130 // - SharedFunctionInfo
129 // - Struct 131 // - Struct
130 // - Box 132 // - Box
131 // - DeclaredAccessorDescriptor 133 // - DeclaredAccessorDescriptor
132 // - AccessorInfo 134 // - AccessorInfo
133 // - DeclaredAccessorInfo 135 // - DeclaredAccessorInfo
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 345 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
344 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 346 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
345 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ 347 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \
346 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ 348 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \
347 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ 349 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \
348 \ 350 \
349 V(SYMBOL_TYPE) \ 351 V(SYMBOL_TYPE) \
350 V(MAP_TYPE) \ 352 V(MAP_TYPE) \
351 V(CODE_TYPE) \ 353 V(CODE_TYPE) \
352 V(ODDBALL_TYPE) \ 354 V(ODDBALL_TYPE) \
353 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ 355 V(CELL_TYPE) \
356 V(PROPERTY_CELL_TYPE) \
354 V(BOX_TYPE) \ 357 V(BOX_TYPE) \
355 \ 358 \
356 V(HEAP_NUMBER_TYPE) \ 359 V(HEAP_NUMBER_TYPE) \
357 V(FOREIGN_TYPE) \ 360 V(FOREIGN_TYPE) \
358 V(BYTE_ARRAY_TYPE) \ 361 V(BYTE_ARRAY_TYPE) \
359 V(FREE_SPACE_TYPE) \ 362 V(FREE_SPACE_TYPE) \
360 /* Note: the order of these external array */ \ 363 /* Note: the order of these external array */ \
361 /* types is relied upon in */ \ 364 /* types is relied upon in */ \
362 /* Object::IsExternalArray(). */ \ 365 /* Object::IsExternalArray(). */ \
363 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 366 V(EXTERNAL_BYTE_ARRAY_TYPE) \
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = 667 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE =
665 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag, 668 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE | kInternalizedTag,
666 669
667 // Non-string names 670 // Non-string names
668 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE 671 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE
669 672
670 // Objects allocated in their own spaces (never in new space). 673 // Objects allocated in their own spaces (never in new space).
671 MAP_TYPE, 674 MAP_TYPE,
672 CODE_TYPE, 675 CODE_TYPE,
673 ODDBALL_TYPE, 676 ODDBALL_TYPE,
674 JS_GLOBAL_PROPERTY_CELL_TYPE, 677 CELL_TYPE,
678 PROPERTY_CELL_TYPE,
675 BOX_TYPE, 679 BOX_TYPE,
676 680
677 // "Data", objects that cannot contain non-map-word pointers to heap 681 // "Data", objects that cannot contain non-map-word pointers to heap
678 // objects. 682 // objects.
679 HEAP_NUMBER_TYPE, 683 HEAP_NUMBER_TYPE,
680 FOREIGN_TYPE, 684 FOREIGN_TYPE,
681 BYTE_ARRAY_TYPE, 685 BYTE_ARRAY_TYPE,
682 FREE_SPACE_TYPE, 686 FREE_SPACE_TYPE,
683 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 687 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
684 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 688 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \ 840 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
837 841
838 842
839 class AccessorPair; 843 class AccessorPair;
840 class DictionaryElementsAccessor; 844 class DictionaryElementsAccessor;
841 class ElementsAccessor; 845 class ElementsAccessor;
842 class Failure; 846 class Failure;
843 class FixedArrayBase; 847 class FixedArrayBase;
844 class ObjectVisitor; 848 class ObjectVisitor;
845 class StringStream; 849 class StringStream;
850 class Type;
846 851
847 struct ValueInfo : public Malloced { 852 struct ValueInfo : public Malloced {
848 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } 853 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
849 InstanceType type; 854 InstanceType type;
850 Object* ptr; 855 Object* ptr;
851 const char* str; 856 const char* str;
852 double number; 857 double number;
853 }; 858 };
854 859
855 860
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 V(CodeCacheHashTable) \ 1011 V(CodeCacheHashTable) \
1007 V(PolymorphicCodeCacheHashTable) \ 1012 V(PolymorphicCodeCacheHashTable) \
1008 V(MapCache) \ 1013 V(MapCache) \
1009 V(Primitive) \ 1014 V(Primitive) \
1010 V(GlobalObject) \ 1015 V(GlobalObject) \
1011 V(JSGlobalObject) \ 1016 V(JSGlobalObject) \
1012 V(JSBuiltinsObject) \ 1017 V(JSBuiltinsObject) \
1013 V(JSGlobalProxy) \ 1018 V(JSGlobalProxy) \
1014 V(UndetectableObject) \ 1019 V(UndetectableObject) \
1015 V(AccessCheckNeeded) \ 1020 V(AccessCheckNeeded) \
1016 V(JSGlobalPropertyCell) \ 1021 V(Cell) \
1022 V(PropertyCell) \
1017 V(ObjectHashTable) \ 1023 V(ObjectHashTable) \
1018 1024
1019 1025
1020 // Object is the abstract superclass for all classes in the 1026 // Object is the abstract superclass for all classes in the
1021 // object hierarchy. 1027 // object hierarchy.
1022 // Object does not use any virtual functions to avoid the 1028 // Object does not use any virtual functions to avoid the
1023 // allocation of the C++ vtable. 1029 // allocation of the C++ vtable.
1024 // Since Smi and Failure are subclasses of Object no 1030 // Since Smi and Failure are subclasses of Object no
1025 // data members can be present in Object. 1031 // data members can be present in Object.
1026 class Object : public MaybeObject { 1032 class Object : public MaybeObject {
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 2566
2561 // FixedArray describes fixed-sized arrays with element type Object*. 2567 // FixedArray describes fixed-sized arrays with element type Object*.
2562 class FixedArray: public FixedArrayBase { 2568 class FixedArray: public FixedArrayBase {
2563 public: 2569 public:
2564 // Setter and getter for elements. 2570 // Setter and getter for elements.
2565 inline Object* get(int index); 2571 inline Object* get(int index);
2566 // Setter that uses write barrier. 2572 // Setter that uses write barrier.
2567 inline void set(int index, Object* value); 2573 inline void set(int index, Object* value);
2568 inline bool is_the_hole(int index); 2574 inline bool is_the_hole(int index);
2569 2575
2570 // Setter that doesn't need write barrier). 2576 // Setter that doesn't need write barrier.
2571 inline void set(int index, Smi* value); 2577 inline void set(int index, Smi* value);
2572 // Setter with explicit barrier mode. 2578 // Setter with explicit barrier mode.
2573 inline void set(int index, Object* value, WriteBarrierMode mode); 2579 inline void set(int index, Object* value, WriteBarrierMode mode);
2574 2580
2575 // Setters for frequently used oddballs located in old space. 2581 // Setters for frequently used oddballs located in old space.
2576 inline void set_undefined(int index); 2582 inline void set_undefined(int index);
2577 // TODO(isolates): duplicate. 2583 // TODO(isolates): duplicate.
2578 inline void set_undefined(Heap* heap, int index); 2584 inline void set_undefined(Heap* heap, int index);
2579 inline void set_null(int index); 2585 inline void set_null(int index);
2580 // TODO(isolates): duplicate. 2586 // TODO(isolates): duplicate.
2581 inline void set_null(Heap* heap, int index); 2587 inline void set_null(Heap* heap, int index);
2582 inline void set_the_hole(int index); 2588 inline void set_the_hole(int index);
2583 2589
2584 // Setters with less debug checks for the GC to use.
2585 inline void set_unchecked(int index, Smi* value);
2586 inline void set_null_unchecked(Heap* heap, int index);
2587 inline void set_unchecked(Heap* heap, int index, Object* value,
2588 WriteBarrierMode mode);
2589
2590 inline Object** GetFirstElementAddress(); 2590 inline Object** GetFirstElementAddress();
2591 inline bool ContainsOnlySmisOrHoles(); 2591 inline bool ContainsOnlySmisOrHoles();
2592 2592
2593 // Gives access to raw memory which stores the array's data. 2593 // Gives access to raw memory which stores the array's data.
2594 inline Object** data_start(); 2594 inline Object** data_start();
2595 2595
2596 // Copy operations. 2596 // Copy operations.
2597 MUST_USE_RESULT inline MaybeObject* Copy(); 2597 MUST_USE_RESULT inline MaybeObject* Copy();
2598 MUST_USE_RESULT MaybeObject* CopySize(int new_length); 2598 MUST_USE_RESULT MaybeObject* CopySize(int new_length);
2599 2599
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 // Casting. 4373 // Casting.
4374 static inline DeoptimizationOutputData* cast(Object* obj); 4374 static inline DeoptimizationOutputData* cast(Object* obj);
4375 4375
4376 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 4376 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
4377 void DeoptimizationOutputDataPrint(FILE* out); 4377 void DeoptimizationOutputDataPrint(FILE* out);
4378 #endif 4378 #endif
4379 }; 4379 };
4380 4380
4381 4381
4382 // Forward declaration. 4382 // Forward declaration.
4383 class JSGlobalPropertyCell; 4383 class Cell;
4384 class PropertyCell;
4384 4385
4385 // TypeFeedbackCells is a fixed array used to hold the association between 4386 // TypeFeedbackCells is a fixed array used to hold the association between
4386 // cache cells and AST ids for code generated by the full compiler. 4387 // cache cells and AST ids for code generated by the full compiler.
4387 // The format of the these objects is 4388 // The format of the these objects is
4388 // [i * 2]: Global property cell of ith cache cell. 4389 // [i * 2]: Global property cell of ith cache cell.
4389 // [i * 2 + 1]: Ast ID for ith cache cell. 4390 // [i * 2 + 1]: Ast ID for ith cache cell.
4390 class TypeFeedbackCells: public FixedArray { 4391 class TypeFeedbackCells: public FixedArray {
4391 public: 4392 public:
4392 int CellCount() { return length() / 2; } 4393 int CellCount() { return length() / 2; }
4393 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; } 4394 static int LengthOfFixedArray(int cell_count) { return cell_count * 2; }
4394 4395
4395 // Accessors for AST ids associated with cache values. 4396 // Accessors for AST ids associated with cache values.
4396 inline TypeFeedbackId AstId(int index); 4397 inline TypeFeedbackId AstId(int index);
4397 inline void SetAstId(int index, TypeFeedbackId id); 4398 inline void SetAstId(int index, TypeFeedbackId id);
4398 4399
4399 // Accessors for global property cells holding the cache values. 4400 // Accessors for global property cells holding the cache values.
4400 inline JSGlobalPropertyCell* Cell(int index); 4401 inline Cell* GetCell(int index);
4401 inline void SetCell(int index, JSGlobalPropertyCell* cell); 4402 inline void SetCell(int index, Cell* cell);
4402 4403
4403 // The object that indicates an uninitialized cache. 4404 // The object that indicates an uninitialized cache.
4404 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); 4405 static inline Handle<Object> UninitializedSentinel(Isolate* isolate);
4405 4406
4406 // The object that indicates a megamorphic state. 4407 // The object that indicates a megamorphic state.
4407 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); 4408 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate);
4408 4409
4409 // The object that indicates a monomorphic state of Array with 4410 // The object that indicates a monomorphic state of Array with
4410 // ElementsKind 4411 // ElementsKind
4411 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, 4412 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4541 inline void set_ic_age(int count); 4542 inline void set_ic_age(int count);
4542 inline int ic_age(); 4543 inline int ic_age();
4543 4544
4544 // [prologue_offset]: Offset of the function prologue, used for aging 4545 // [prologue_offset]: Offset of the function prologue, used for aging
4545 // FUNCTIONs and OPTIMIZED_FUNCTIONs. 4546 // FUNCTIONs and OPTIMIZED_FUNCTIONs.
4546 inline int prologue_offset(); 4547 inline int prologue_offset();
4547 inline void set_prologue_offset(int offset); 4548 inline void set_prologue_offset(int offset);
4548 4549
4549 // Unchecked accessors to be used during GC. 4550 // Unchecked accessors to be used during GC.
4550 inline ByteArray* unchecked_relocation_info(); 4551 inline ByteArray* unchecked_relocation_info();
4551 inline FixedArray* unchecked_deoptimization_data();
4552 4552
4553 inline int relocation_size(); 4553 inline int relocation_size();
4554 4554
4555 // [flags]: Various code flags. 4555 // [flags]: Various code flags.
4556 inline Flags flags(); 4556 inline Flags flags();
4557 inline void set_flags(Flags flags); 4557 inline void set_flags(Flags flags);
4558 4558
4559 // [flags]: Access to specific code flags. 4559 // [flags]: Access to specific code flags.
4560 inline Kind kind(); 4560 inline Kind kind();
4561 inline InlineCacheState ic_state(); // Only valid for IC stubs. 4561 inline InlineCacheState ic_state(); // Only valid for IC stubs.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
4657 inline void set_check_type(CheckType value); 4657 inline void set_check_type(CheckType value);
4658 4658
4659 // [type-recording unary op type]: For kind UNARY_OP_IC. 4659 // [type-recording unary op type]: For kind UNARY_OP_IC.
4660 inline byte unary_op_type(); 4660 inline byte unary_op_type();
4661 inline void set_unary_op_type(byte value); 4661 inline void set_unary_op_type(byte value);
4662 4662
4663 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. 4663 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in.
4664 inline byte to_boolean_state(); 4664 inline byte to_boolean_state();
4665 4665
4666 // [compare_nil]: For kind COMPARE_NIL_IC tells what state the stub is in. 4666 // [compare_nil]: For kind COMPARE_NIL_IC tells what state the stub is in.
4667 byte compare_nil_types(); 4667 byte compare_nil_state();
4668 4668
4669 // [has_function_cache]: For kind STUB tells whether there is a function 4669 // [has_function_cache]: For kind STUB tells whether there is a function
4670 // cache is passed to the stub. 4670 // cache is passed to the stub.
4671 inline bool has_function_cache(); 4671 inline bool has_function_cache();
4672 inline void set_has_function_cache(bool flag); 4672 inline void set_has_function_cache(bool flag);
4673 4673
4674 4674
4675 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether 4675 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether
4676 // the code is going to be deoptimized because of dead embedded maps. 4676 // the code is going to be deoptimized because of dead embedded maps.
4677 inline bool marked_for_deoptimization(); 4677 inline bool marked_for_deoptimization();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
4820 kLastCodeAge = kAfterLastCodeAge - 1, 4820 kLastCodeAge = kAfterLastCodeAge - 1,
4821 kCodeAgeCount = kAfterLastCodeAge - 1 4821 kCodeAgeCount = kAfterLastCodeAge - 1
4822 }; 4822 };
4823 #undef DECLARE_CODE_AGE_ENUM 4823 #undef DECLARE_CODE_AGE_ENUM
4824 4824
4825 // Code aging 4825 // Code aging
4826 static void MakeCodeAgeSequenceYoung(byte* sequence); 4826 static void MakeCodeAgeSequenceYoung(byte* sequence);
4827 void MakeOlder(MarkingParity); 4827 void MakeOlder(MarkingParity);
4828 static bool IsYoungSequence(byte* sequence); 4828 static bool IsYoungSequence(byte* sequence);
4829 bool IsOld(); 4829 bool IsOld();
4830 int GetAge();
4830 4831
4831 void PrintDeoptLocation(int bailout_id); 4832 void PrintDeoptLocation(int bailout_id);
4832 4833
4833 #ifdef VERIFY_HEAP 4834 #ifdef VERIFY_HEAP
4834 void VerifyEmbeddedMapsDependency(); 4835 void VerifyEmbeddedMapsDependency();
4835 #endif 4836 #endif
4836 4837
4837 // Max loop nesting marker used to postpose OSR. We don't take loop 4838 // Max loop nesting marker used to postpose OSR. We don't take loop
4838 // nesting that is deeper than 5 levels into account. 4839 // nesting that is deeper than 5 levels into account.
4839 static const int kMaxLoopNestingMarker = 6; 4840 static const int kMaxLoopNestingMarker = 6;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4961 4962
4962 // This constant should be encodable in an ARM instruction. 4963 // This constant should be encodable in an ARM instruction.
4963 static const int kFlagsNotUsedInLookup = 4964 static const int kFlagsNotUsedInLookup =
4964 TypeField::kMask | CacheHolderField::kMask; 4965 TypeField::kMask | CacheHolderField::kMask;
4965 4966
4966 private: 4967 private:
4967 friend class RelocIterator; 4968 friend class RelocIterator;
4968 4969
4969 // Code aging 4970 // Code aging
4970 byte* FindCodeAgeSequence(); 4971 byte* FindCodeAgeSequence();
4971 static void GetCodeAgeAndParity(Code* code, Age* age, 4972 static void GetCodeAgeAndParity(Code* code, Age* age,
4972 MarkingParity* parity); 4973 MarkingParity* parity);
4973 static void GetCodeAgeAndParity(byte* sequence, Age* age, 4974 static void GetCodeAgeAndParity(byte* sequence, Age* age,
4974 MarkingParity* parity); 4975 MarkingParity* parity);
4975 static Code* GetCodeAgeStub(Age age, MarkingParity parity); 4976 static Code* GetCodeAgeStub(Age age, MarkingParity parity);
4976 4977
4977 // Code aging -- platform-specific 4978 // Code aging -- platform-specific
4978 static void PatchPlatformCodeAge(byte* sequence, Age age, 4979 static void PatchPlatformCodeAge(byte* sequence, Age age,
4979 MarkingParity parity); 4980 MarkingParity parity);
4980 4981
4981 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 4982 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
4982 }; 4983 };
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
5307 // properties. 5308 // properties.
5308 inline void set_is_access_check_needed(bool access_check_needed); 5309 inline void set_is_access_check_needed(bool access_check_needed);
5309 inline bool is_access_check_needed(); 5310 inline bool is_access_check_needed();
5310 5311
5311 // [prototype]: implicit prototype object. 5312 // [prototype]: implicit prototype object.
5312 DECL_ACCESSORS(prototype, Object) 5313 DECL_ACCESSORS(prototype, Object)
5313 5314
5314 // [constructor]: points back to the function responsible for this map. 5315 // [constructor]: points back to the function responsible for this map.
5315 DECL_ACCESSORS(constructor, Object) 5316 DECL_ACCESSORS(constructor, Object)
5316 5317
5317 inline JSFunction* unchecked_constructor();
5318
5319 // [instance descriptors]: describes the object. 5318 // [instance descriptors]: describes the object.
5320 DECL_ACCESSORS(instance_descriptors, DescriptorArray) 5319 DECL_ACCESSORS(instance_descriptors, DescriptorArray)
5321 inline void InitializeDescriptors(DescriptorArray* descriptors); 5320 inline void InitializeDescriptors(DescriptorArray* descriptors);
5322 5321
5323 // [stub cache]: contains stubs compiled for this map. 5322 // [stub cache]: contains stubs compiled for this map.
5324 DECL_ACCESSORS(code_cache, Object) 5323 DECL_ACCESSORS(code_cache, Object)
5325 5324
5326 // [dependent code]: list of optimized codes that have this map embedded. 5325 // [dependent code]: list of optimized codes that have this map embedded.
5327 DECL_ACCESSORS(dependent_code, DependentCode) 5326 DECL_ACCESSORS(dependent_code, DependentCode)
5328 5327
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
5360 inline int NumberOfProtoTransitions() { 5359 inline int NumberOfProtoTransitions() {
5361 FixedArray* cache = GetPrototypeTransitions(); 5360 FixedArray* cache = GetPrototypeTransitions();
5362 if (cache->length() == 0) return 0; 5361 if (cache->length() == 0) return 0;
5363 return 5362 return
5364 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); 5363 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value();
5365 } 5364 }
5366 5365
5367 inline void SetNumberOfProtoTransitions(int value) { 5366 inline void SetNumberOfProtoTransitions(int value) {
5368 FixedArray* cache = GetPrototypeTransitions(); 5367 FixedArray* cache = GetPrototypeTransitions();
5369 ASSERT(cache->length() != 0); 5368 ASSERT(cache->length() != 0);
5370 cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset, 5369 cache->set(kProtoTransitionNumberOfEntriesOffset, Smi::FromInt(value));
5371 Smi::FromInt(value));
5372 } 5370 }
5373 5371
5374 // Lookup in the map's instance descriptors and fill out the result 5372 // Lookup in the map's instance descriptors and fill out the result
5375 // with the given holder if the name is found. The holder may be 5373 // with the given holder if the name is found. The holder may be
5376 // NULL when this function is used from the compiler. 5374 // NULL when this function is used from the compiler.
5377 inline void LookupDescriptor(JSObject* holder, 5375 inline void LookupDescriptor(JSObject* holder,
5378 Name* name, 5376 Name* name,
5379 LookupResult* result); 5377 LookupResult* result);
5380 5378
5381 inline void LookupTransition(JSObject* holder, 5379 inline void LookupTransition(JSObject* holder,
(...skipping 13 matching lines...) Expand all
5395 5393
5396 int NumberOfOwnDescriptors() { 5394 int NumberOfOwnDescriptors() {
5397 return NumberOfOwnDescriptorsBits::decode(bit_field3()); 5395 return NumberOfOwnDescriptorsBits::decode(bit_field3());
5398 } 5396 }
5399 5397
5400 void SetNumberOfOwnDescriptors(int number) { 5398 void SetNumberOfOwnDescriptors(int number) {
5401 ASSERT(number <= instance_descriptors()->number_of_descriptors()); 5399 ASSERT(number <= instance_descriptors()->number_of_descriptors());
5402 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); 5400 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
5403 } 5401 }
5404 5402
5405 inline JSGlobalPropertyCell* RetrieveDescriptorsPointer(); 5403 inline Cell* RetrieveDescriptorsPointer();
5406 5404
5407 int EnumLength() { 5405 int EnumLength() {
5408 return EnumLengthBits::decode(bit_field3()); 5406 return EnumLengthBits::decode(bit_field3());
5409 } 5407 }
5410 5408
5411 void SetEnumLength(int length) { 5409 void SetEnumLength(int length) {
5412 if (length != kInvalidEnumCache) { 5410 if (length != kInvalidEnumCache) {
5413 ASSERT(length >= 0); 5411 ASSERT(length >= 0);
5414 ASSERT(length == 0 || instance_descriptors()->HasEnumCache()); 5412 ASSERT(length == 0 || instance_descriptors()->HasEnumCache());
5415 ASSERT(length <= NumberOfOwnDescriptors()); 5413 ASSERT(length <= NumberOfOwnDescriptors());
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 V(Math, acos, MathACos) \ 5855 V(Math, acos, MathACos) \
5858 V(Math, atan, MathATan) \ 5856 V(Math, atan, MathATan) \
5859 V(Math, exp, MathExp) \ 5857 V(Math, exp, MathExp) \
5860 V(Math, sqrt, MathSqrt) \ 5858 V(Math, sqrt, MathSqrt) \
5861 V(Math, pow, MathPow) \ 5859 V(Math, pow, MathPow) \
5862 V(Math, random, MathRandom) \ 5860 V(Math, random, MathRandom) \
5863 V(Math, max, MathMax) \ 5861 V(Math, max, MathMax) \
5864 V(Math, min, MathMin) \ 5862 V(Math, min, MathMin) \
5865 V(Math, imul, MathImul) 5863 V(Math, imul, MathImul)
5866 5864
5867
5868 enum BuiltinFunctionId { 5865 enum BuiltinFunctionId {
5866 kArrayCode,
5869 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ 5867 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \
5870 k##name, 5868 k##name,
5871 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) 5869 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID)
5872 #undef DECLARE_FUNCTION_ID 5870 #undef DECLARE_FUNCTION_ID
5873 // Fake id for a special case of Math.pow. Note, it continues the 5871 // Fake id for a special case of Math.pow. Note, it continues the
5874 // list of math functions. 5872 // list of math functions.
5875 kMathPowHalf, 5873 kMathPowHalf,
5876 kFirstMathFunctionId = kMathFloor 5874 kFirstMathFunctionId = kMathFloor
5877 }; 5875 };
5878 5876
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
5927 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize; 5925 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize;
5928 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; 5926 static const int kSecondEntryIndex = kEntryLength + kEntriesStart;
5929 static const int kInitialLength = kEntriesStart + kEntryLength; 5927 static const int kInitialLength = kEntriesStart + kEntryLength;
5930 5928
5931 // [scope_info]: Scope info. 5929 // [scope_info]: Scope info.
5932 DECL_ACCESSORS(scope_info, ScopeInfo) 5930 DECL_ACCESSORS(scope_info, ScopeInfo)
5933 5931
5934 // [construct stub]: Code stub for constructing instances of this function. 5932 // [construct stub]: Code stub for constructing instances of this function.
5935 DECL_ACCESSORS(construct_stub, Code) 5933 DECL_ACCESSORS(construct_stub, Code)
5936 5934
5937 inline Code* unchecked_code();
5938
5939 // Returns if this function has been compiled to native code yet. 5935 // Returns if this function has been compiled to native code yet.
5940 inline bool is_compiled(); 5936 inline bool is_compiled();
5941 5937
5942 // [length]: The function length - usually the number of declared parameters. 5938 // [length]: The function length - usually the number of declared parameters.
5943 // Use up to 2^30 parameters. 5939 // Use up to 2^30 parameters.
5944 inline int length(); 5940 inline int length();
5945 inline void set_length(int value); 5941 inline void set_length(int value);
5946 5942
5947 // [formal parameter count]: The declared number of parameters. 5943 // [formal parameter count]: The declared number of parameters.
5948 inline int formal_parameter_count(); 5944 inline int formal_parameter_count();
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
6575 // JSFunction describes JavaScript functions. 6571 // JSFunction describes JavaScript functions.
6576 class JSFunction: public JSObject { 6572 class JSFunction: public JSObject {
6577 public: 6573 public:
6578 // [prototype_or_initial_map]: 6574 // [prototype_or_initial_map]:
6579 DECL_ACCESSORS(prototype_or_initial_map, Object) 6575 DECL_ACCESSORS(prototype_or_initial_map, Object)
6580 6576
6581 // [shared]: The information about the function that 6577 // [shared]: The information about the function that
6582 // can be shared by instances. 6578 // can be shared by instances.
6583 DECL_ACCESSORS(shared, SharedFunctionInfo) 6579 DECL_ACCESSORS(shared, SharedFunctionInfo)
6584 6580
6585 inline SharedFunctionInfo* unchecked_shared();
6586
6587 // [context]: The context for this function. 6581 // [context]: The context for this function.
6588 inline Context* context(); 6582 inline Context* context();
6589 inline Object* unchecked_context(); 6583 inline Object* unchecked_context();
6590 inline void set_context(Object* context); 6584 inline void set_context(Object* context);
6591 6585
6592 // [code]: The generated code object for this function. Executed 6586 // [code]: The generated code object for this function. Executed
6593 // when the function is invoked, e.g. foo() or new foo(). See 6587 // when the function is invoked, e.g. foo() or new foo(). See
6594 // [[Call]] and [[Construct]] description in ECMA-262, section 6588 // [[Call]] and [[Construct]] description in ECMA-262, section
6595 // 8.6.2, page 27. 6589 // 8.6.2, page 27.
6596 inline Code* code(); 6590 inline Code* code();
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
6810 // [native context]: the natives corresponding to this global object. 6804 // [native context]: the natives corresponding to this global object.
6811 DECL_ACCESSORS(native_context, Context) 6805 DECL_ACCESSORS(native_context, Context)
6812 6806
6813 // [global context]: the most recent (i.e. innermost) global context. 6807 // [global context]: the most recent (i.e. innermost) global context.
6814 DECL_ACCESSORS(global_context, Context) 6808 DECL_ACCESSORS(global_context, Context)
6815 6809
6816 // [global receiver]: the global receiver object of the context 6810 // [global receiver]: the global receiver object of the context
6817 DECL_ACCESSORS(global_receiver, JSObject) 6811 DECL_ACCESSORS(global_receiver, JSObject)
6818 6812
6819 // Retrieve the property cell used to store a property. 6813 // Retrieve the property cell used to store a property.
6820 JSGlobalPropertyCell* GetPropertyCell(LookupResult* result); 6814 PropertyCell* GetPropertyCell(LookupResult* result);
6821 6815
6822 // This is like GetProperty, but is used when you know the lookup won't fail 6816 // This is like GetProperty, but is used when you know the lookup won't fail
6823 // by throwing an exception. This is for the debug and builtins global 6817 // by throwing an exception. This is for the debug and builtins global
6824 // objects, where it is known which properties can be expected to be present 6818 // objects, where it is known which properties can be expected to be present
6825 // on the object. 6819 // on the object.
6826 Object* GetPropertyNoExceptionThrown(Name* key) { 6820 Object* GetPropertyNoExceptionThrown(Name* key) {
6827 Object* answer = GetProperty(key)->ToObjectUnchecked(); 6821 Object* answer = GetProperty(key)->ToObjectUnchecked();
6828 return answer; 6822 return answer;
6829 } 6823 }
6830 6824
6831 // Ensure that the global object has a cell for the given property name. 6825 // Ensure that the global object has a cell for the given property name.
6832 static Handle<JSGlobalPropertyCell> EnsurePropertyCell( 6826 static Handle<PropertyCell> EnsurePropertyCell(
6833 Handle<GlobalObject> global, 6827 Handle<GlobalObject> global,
6834 Handle<Name> name); 6828 Handle<Name> name);
6835 // TODO(kmillikin): This function can be eliminated once the stub cache is 6829 // TODO(kmillikin): This function can be eliminated once the stub cache is
6836 // fully handlified (and the static helper can be written directly). 6830 // fully handlified (and the static helper can be written directly).
6837 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(Name* name); 6831 MUST_USE_RESULT MaybeObject* EnsurePropertyCell(Name* name);
6838 6832
6839 // Casting. 6833 // Casting.
6840 static inline GlobalObject* cast(Object* obj); 6834 static inline GlobalObject* cast(Object* obj);
6841 6835
6842 // Layout description. 6836 // Layout description.
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
7121 DECL_ACCESSORS(data, Object) 7115 DECL_ACCESSORS(data, Object)
7122 7116
7123 inline Type TypeTag(); 7117 inline Type TypeTag();
7124 inline int CaptureCount(); 7118 inline int CaptureCount();
7125 inline Flags GetFlags(); 7119 inline Flags GetFlags();
7126 inline String* Pattern(); 7120 inline String* Pattern();
7127 inline Object* DataAt(int index); 7121 inline Object* DataAt(int index);
7128 // Set implementation data after the object has been prepared. 7122 // Set implementation data after the object has been prepared.
7129 inline void SetDataAt(int index, Object* value); 7123 inline void SetDataAt(int index, Object* value);
7130 7124
7131 // Used during GC when flushing code or setting age.
7132 inline Object* DataAtUnchecked(int index);
7133 inline void SetDataAtUnchecked(int index, Object* value, Heap* heap);
7134 inline Type TypeTagUnchecked();
7135
7136 static int code_index(bool is_ascii) { 7125 static int code_index(bool is_ascii) {
7137 if (is_ascii) { 7126 if (is_ascii) {
7138 return kIrregexpASCIICodeIndex; 7127 return kIrregexpASCIICodeIndex;
7139 } else { 7128 } else {
7140 return kIrregexpUC16CodeIndex; 7129 return kIrregexpUC16CodeIndex;
7141 } 7130 }
7142 } 7131 }
7143 7132
7144 static int saved_code_index(bool is_ascii) { 7133 static int saved_code_index(bool is_ascii) {
7145 if (is_ascii) { 7134 if (is_ascii) {
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
8549 8538
8550 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset); 8539 STATIC_CHECK(kKindOffset == Internals::kOddballKindOffset);
8551 STATIC_CHECK(kNull == Internals::kNullOddballKind); 8540 STATIC_CHECK(kNull == Internals::kNullOddballKind);
8552 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind); 8541 STATIC_CHECK(kUndefined == Internals::kUndefinedOddballKind);
8553 8542
8554 private: 8543 private:
8555 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball); 8544 DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
8556 }; 8545 };
8557 8546
8558 8547
8559 class JSGlobalPropertyCell: public HeapObject { 8548 class Cell: public HeapObject {
8560 public: 8549 public:
8561 // [value]: value of the global property. 8550 // [value]: value of the global property.
8562 DECL_ACCESSORS(value, Object) 8551 DECL_ACCESSORS(value, Object)
8563 8552
8564 // Casting. 8553 // Casting.
8565 static inline JSGlobalPropertyCell* cast(Object* obj); 8554 static inline Cell* cast(Object* obj);
8566 8555
8567 static inline JSGlobalPropertyCell* FromValueAddress(Address value) { 8556 static inline Cell* FromValueAddress(Address value) {
8568 return cast(FromAddress(value - kValueOffset)); 8557 Object* result = FromAddress(value - kValueOffset);
8558 ASSERT(result->IsCell() || result->IsPropertyCell());
8559 return static_cast<Cell*>(result);
8569 } 8560 }
8570 8561
8571 inline Address ValueAddress() { 8562 inline Address ValueAddress() {
8572 return address() + kValueOffset; 8563 return address() + kValueOffset;
8573 } 8564 }
8574 8565
8575 // Dispatched behavior. 8566 // Dispatched behavior.
8576 DECLARE_PRINTER(JSGlobalPropertyCell) 8567 DECLARE_PRINTER(Cell)
8577 DECLARE_VERIFIER(JSGlobalPropertyCell) 8568 DECLARE_VERIFIER(Cell)
8578 8569
8579 // Layout description. 8570 // Layout description.
8580 static const int kValueOffset = HeapObject::kHeaderSize; 8571 static const int kValueOffset = HeapObject::kHeaderSize;
8581 static const int kSize = kValueOffset + kPointerSize; 8572 static const int kSize = kValueOffset + kPointerSize;
8582 8573
8583 typedef FixedBodyDescriptor<kValueOffset, 8574 typedef FixedBodyDescriptor<kValueOffset,
8584 kValueOffset + kPointerSize, 8575 kValueOffset + kPointerSize,
8585 kSize> BodyDescriptor; 8576 kSize> BodyDescriptor;
8586 8577
8587 private: 8578 private:
8588 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); 8579 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell);
8589 }; 8580 };
8590 8581
8591 8582
8583 class PropertyCell: public Cell {
8584 public:
8585 Type* type();
8586 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
8587
8588 // Casting.
8589 static inline PropertyCell* cast(Object* obj);
8590
8591 inline Address TypeAddress() {
8592 return address() + kTypeOffset;
8593 }
8594
8595 // Dispatched behavior.
8596 DECLARE_PRINTER(PropertyCell)
8597 DECLARE_VERIFIER(PropertyCell)
8598
8599 // Layout description.
8600 static const int kTypeOffset = kValueOffset + kPointerSize;
8601 static const int kSize = kTypeOffset + kPointerSize;
8602
8603 typedef FixedBodyDescriptor<
8604 kValueOffset,
8605 kTypeOffset + kPointerSize,
8606 PropertyCell::kSize> BodyDescriptor;
8607
8608 private:
8609 DECL_ACCESSORS(type_raw, Object)
8610 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell);
8611 };
8612
8613
8592 // The JSProxy describes EcmaScript Harmony proxies 8614 // The JSProxy describes EcmaScript Harmony proxies
8593 class JSProxy: public JSReceiver { 8615 class JSProxy: public JSReceiver {
8594 public: 8616 public:
8595 // [handler]: The handler property. 8617 // [handler]: The handler property.
8596 DECL_ACCESSORS(handler, Object) 8618 DECL_ACCESSORS(handler, Object)
8597 8619
8598 // [hash]: The hash code property (undefined if not initialized yet). 8620 // [hash]: The hash code property (undefined if not initialized yet).
8599 DECL_ACCESSORS(hash, Object) 8621 DECL_ACCESSORS(hash, Object)
8600 8622
8601 // Casting. 8623 // Casting.
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
9597 // To allow lazy clearing of inline caches the visitor has 9619 // To allow lazy clearing of inline caches the visitor has
9598 // a rich interface for iterating over Code objects.. 9620 // a rich interface for iterating over Code objects..
9599 9621
9600 // Visits a code target in the instruction stream. 9622 // Visits a code target in the instruction stream.
9601 virtual void VisitCodeTarget(RelocInfo* rinfo); 9623 virtual void VisitCodeTarget(RelocInfo* rinfo);
9602 9624
9603 // Visits a code entry in a JS function. 9625 // Visits a code entry in a JS function.
9604 virtual void VisitCodeEntry(Address entry_address); 9626 virtual void VisitCodeEntry(Address entry_address);
9605 9627
9606 // Visits a global property cell reference in the instruction stream. 9628 // Visits a global property cell reference in the instruction stream.
9607 virtual void VisitGlobalPropertyCell(RelocInfo* rinfo); 9629 virtual void VisitCell(RelocInfo* rinfo);
9608 9630
9609 // Visits a runtime entry in the instruction stream. 9631 // Visits a runtime entry in the instruction stream.
9610 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} 9632 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {}
9611 9633
9612 // Visits the resource of an ASCII or two-byte string. 9634 // Visits the resource of an ASCII or two-byte string.
9613 virtual void VisitExternalAsciiString( 9635 virtual void VisitExternalAsciiString(
9614 v8::String::ExternalAsciiStringResource** resource) {} 9636 v8::String::ExternalAsciiStringResource** resource) {}
9615 virtual void VisitExternalTwoByteString( 9637 virtual void VisitExternalTwoByteString(
9616 v8::String::ExternalStringResource** resource) {} 9638 v8::String::ExternalStringResource** resource) {}
9617 9639
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
9680 } else { 9702 } else {
9681 value &= ~(1 << bit_position); 9703 value &= ~(1 << bit_position);
9682 } 9704 }
9683 return value; 9705 return value;
9684 } 9706 }
9685 }; 9707 };
9686 9708
9687 } } // namespace v8::internal 9709 } } // namespace v8::internal
9688 9710
9689 #endif // V8_OBJECTS_H_ 9711 #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