OLD | NEW |
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 2553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 | 2564 |
2565 // FixedArray describes fixed-sized arrays with element type Object*. | 2565 // FixedArray describes fixed-sized arrays with element type Object*. |
2566 class FixedArray: public FixedArrayBase { | 2566 class FixedArray: public FixedArrayBase { |
2567 public: | 2567 public: |
2568 // Setter and getter for elements. | 2568 // Setter and getter for elements. |
2569 inline Object* get(int index); | 2569 inline Object* get(int index); |
2570 // Setter that uses write barrier. | 2570 // Setter that uses write barrier. |
2571 inline void set(int index, Object* value); | 2571 inline void set(int index, Object* value); |
2572 inline bool is_the_hole(int index); | 2572 inline bool is_the_hole(int index); |
2573 | 2573 |
2574 // Setter that doesn't need write barrier). | 2574 // Setter that doesn't need write barrier. |
2575 inline void set(int index, Smi* value); | 2575 inline void set(int index, Smi* value); |
2576 // Setter with explicit barrier mode. | 2576 // Setter with explicit barrier mode. |
2577 inline void set(int index, Object* value, WriteBarrierMode mode); | 2577 inline void set(int index, Object* value, WriteBarrierMode mode); |
2578 | 2578 |
2579 // Setters for frequently used oddballs located in old space. | 2579 // Setters for frequently used oddballs located in old space. |
2580 inline void set_undefined(int index); | 2580 inline void set_undefined(int index); |
2581 // TODO(isolates): duplicate. | 2581 // TODO(isolates): duplicate. |
2582 inline void set_undefined(Heap* heap, int index); | 2582 inline void set_undefined(Heap* heap, int index); |
2583 inline void set_null(int index); | 2583 inline void set_null(int index); |
2584 // TODO(isolates): duplicate. | 2584 // TODO(isolates): duplicate. |
2585 inline void set_null(Heap* heap, int index); | 2585 inline void set_null(Heap* heap, int index); |
2586 inline void set_the_hole(int index); | 2586 inline void set_the_hole(int index); |
2587 | 2587 |
2588 // Setters with less debug checks for the GC to use. | |
2589 inline void set_unchecked(int index, Smi* value); | |
2590 inline void set_null_unchecked(Heap* heap, int index); | |
2591 inline void set_unchecked(Heap* heap, int index, Object* value, | |
2592 WriteBarrierMode mode); | |
2593 | |
2594 inline Object** GetFirstElementAddress(); | 2588 inline Object** GetFirstElementAddress(); |
2595 inline bool ContainsOnlySmisOrHoles(); | 2589 inline bool ContainsOnlySmisOrHoles(); |
2596 | 2590 |
2597 // Gives access to raw memory which stores the array's data. | 2591 // Gives access to raw memory which stores the array's data. |
2598 inline Object** data_start(); | 2592 inline Object** data_start(); |
2599 | 2593 |
2600 // Copy operations. | 2594 // Copy operations. |
2601 MUST_USE_RESULT inline MaybeObject* Copy(); | 2595 MUST_USE_RESULT inline MaybeObject* Copy(); |
2602 MUST_USE_RESULT MaybeObject* CopySize(int new_length); | 2596 MUST_USE_RESULT MaybeObject* CopySize(int new_length); |
2603 | 2597 |
(...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4546 inline void set_ic_age(int count); | 4540 inline void set_ic_age(int count); |
4547 inline int ic_age(); | 4541 inline int ic_age(); |
4548 | 4542 |
4549 // [prologue_offset]: Offset of the function prologue, used for aging | 4543 // [prologue_offset]: Offset of the function prologue, used for aging |
4550 // FUNCTIONs and OPTIMIZED_FUNCTIONs. | 4544 // FUNCTIONs and OPTIMIZED_FUNCTIONs. |
4551 inline int prologue_offset(); | 4545 inline int prologue_offset(); |
4552 inline void set_prologue_offset(int offset); | 4546 inline void set_prologue_offset(int offset); |
4553 | 4547 |
4554 // Unchecked accessors to be used during GC. | 4548 // Unchecked accessors to be used during GC. |
4555 inline ByteArray* unchecked_relocation_info(); | 4549 inline ByteArray* unchecked_relocation_info(); |
4556 inline FixedArray* unchecked_deoptimization_data(); | |
4557 | 4550 |
4558 inline int relocation_size(); | 4551 inline int relocation_size(); |
4559 | 4552 |
4560 // [flags]: Various code flags. | 4553 // [flags]: Various code flags. |
4561 inline Flags flags(); | 4554 inline Flags flags(); |
4562 inline void set_flags(Flags flags); | 4555 inline void set_flags(Flags flags); |
4563 | 4556 |
4564 // [flags]: Access to specific code flags. | 4557 // [flags]: Access to specific code flags. |
4565 inline Kind kind(); | 4558 inline Kind kind(); |
4566 inline InlineCacheState ic_state(); // Only valid for IC stubs. | 4559 inline InlineCacheState ic_state(); // Only valid for IC stubs. |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5313 // properties. | 5306 // properties. |
5314 inline void set_is_access_check_needed(bool access_check_needed); | 5307 inline void set_is_access_check_needed(bool access_check_needed); |
5315 inline bool is_access_check_needed(); | 5308 inline bool is_access_check_needed(); |
5316 | 5309 |
5317 // [prototype]: implicit prototype object. | 5310 // [prototype]: implicit prototype object. |
5318 DECL_ACCESSORS(prototype, Object) | 5311 DECL_ACCESSORS(prototype, Object) |
5319 | 5312 |
5320 // [constructor]: points back to the function responsible for this map. | 5313 // [constructor]: points back to the function responsible for this map. |
5321 DECL_ACCESSORS(constructor, Object) | 5314 DECL_ACCESSORS(constructor, Object) |
5322 | 5315 |
5323 inline JSFunction* unchecked_constructor(); | |
5324 | |
5325 // [instance descriptors]: describes the object. | 5316 // [instance descriptors]: describes the object. |
5326 DECL_ACCESSORS(instance_descriptors, DescriptorArray) | 5317 DECL_ACCESSORS(instance_descriptors, DescriptorArray) |
5327 inline void InitializeDescriptors(DescriptorArray* descriptors); | 5318 inline void InitializeDescriptors(DescriptorArray* descriptors); |
5328 | 5319 |
5329 // [stub cache]: contains stubs compiled for this map. | 5320 // [stub cache]: contains stubs compiled for this map. |
5330 DECL_ACCESSORS(code_cache, Object) | 5321 DECL_ACCESSORS(code_cache, Object) |
5331 | 5322 |
5332 // [dependent code]: list of optimized codes that have this map embedded. | 5323 // [dependent code]: list of optimized codes that have this map embedded. |
5333 DECL_ACCESSORS(dependent_code, DependentCode) | 5324 DECL_ACCESSORS(dependent_code, DependentCode) |
5334 | 5325 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5366 inline int NumberOfProtoTransitions() { | 5357 inline int NumberOfProtoTransitions() { |
5367 FixedArray* cache = GetPrototypeTransitions(); | 5358 FixedArray* cache = GetPrototypeTransitions(); |
5368 if (cache->length() == 0) return 0; | 5359 if (cache->length() == 0) return 0; |
5369 return | 5360 return |
5370 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); | 5361 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
5371 } | 5362 } |
5372 | 5363 |
5373 inline void SetNumberOfProtoTransitions(int value) { | 5364 inline void SetNumberOfProtoTransitions(int value) { |
5374 FixedArray* cache = GetPrototypeTransitions(); | 5365 FixedArray* cache = GetPrototypeTransitions(); |
5375 ASSERT(cache->length() != 0); | 5366 ASSERT(cache->length() != 0); |
5376 cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset, | 5367 cache->set(kProtoTransitionNumberOfEntriesOffset, Smi::FromInt(value)); |
5377 Smi::FromInt(value)); | |
5378 } | 5368 } |
5379 | 5369 |
5380 // Lookup in the map's instance descriptors and fill out the result | 5370 // Lookup in the map's instance descriptors and fill out the result |
5381 // with the given holder if the name is found. The holder may be | 5371 // with the given holder if the name is found. The holder may be |
5382 // NULL when this function is used from the compiler. | 5372 // NULL when this function is used from the compiler. |
5383 inline void LookupDescriptor(JSObject* holder, | 5373 inline void LookupDescriptor(JSObject* holder, |
5384 Name* name, | 5374 Name* name, |
5385 LookupResult* result); | 5375 LookupResult* result); |
5386 | 5376 |
5387 inline void LookupTransition(JSObject* holder, | 5377 inline void LookupTransition(JSObject* holder, |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5933 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize; | 5923 static const int kFirstCodeSlot = FixedArray::kHeaderSize + 2 * kPointerSize; |
5934 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; | 5924 static const int kSecondEntryIndex = kEntryLength + kEntriesStart; |
5935 static const int kInitialLength = kEntriesStart + kEntryLength; | 5925 static const int kInitialLength = kEntriesStart + kEntryLength; |
5936 | 5926 |
5937 // [scope_info]: Scope info. | 5927 // [scope_info]: Scope info. |
5938 DECL_ACCESSORS(scope_info, ScopeInfo) | 5928 DECL_ACCESSORS(scope_info, ScopeInfo) |
5939 | 5929 |
5940 // [construct stub]: Code stub for constructing instances of this function. | 5930 // [construct stub]: Code stub for constructing instances of this function. |
5941 DECL_ACCESSORS(construct_stub, Code) | 5931 DECL_ACCESSORS(construct_stub, Code) |
5942 | 5932 |
5943 inline Code* unchecked_code(); | |
5944 | |
5945 // Returns if this function has been compiled to native code yet. | 5933 // Returns if this function has been compiled to native code yet. |
5946 inline bool is_compiled(); | 5934 inline bool is_compiled(); |
5947 | 5935 |
5948 // [length]: The function length - usually the number of declared parameters. | 5936 // [length]: The function length - usually the number of declared parameters. |
5949 // Use up to 2^30 parameters. | 5937 // Use up to 2^30 parameters. |
5950 inline int length(); | 5938 inline int length(); |
5951 inline void set_length(int value); | 5939 inline void set_length(int value); |
5952 | 5940 |
5953 // [formal parameter count]: The declared number of parameters. | 5941 // [formal parameter count]: The declared number of parameters. |
5954 inline int formal_parameter_count(); | 5942 inline int formal_parameter_count(); |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7125 DECL_ACCESSORS(data, Object) | 7113 DECL_ACCESSORS(data, Object) |
7126 | 7114 |
7127 inline Type TypeTag(); | 7115 inline Type TypeTag(); |
7128 inline int CaptureCount(); | 7116 inline int CaptureCount(); |
7129 inline Flags GetFlags(); | 7117 inline Flags GetFlags(); |
7130 inline String* Pattern(); | 7118 inline String* Pattern(); |
7131 inline Object* DataAt(int index); | 7119 inline Object* DataAt(int index); |
7132 // Set implementation data after the object has been prepared. | 7120 // Set implementation data after the object has been prepared. |
7133 inline void SetDataAt(int index, Object* value); | 7121 inline void SetDataAt(int index, Object* value); |
7134 | 7122 |
7135 // Used during GC when flushing code or setting age. | |
7136 inline Object* DataAtUnchecked(int index); | |
7137 inline void SetDataAtUnchecked(int index, Object* value, Heap* heap); | |
7138 inline Type TypeTagUnchecked(); | |
7139 | |
7140 static int code_index(bool is_ascii) { | 7123 static int code_index(bool is_ascii) { |
7141 if (is_ascii) { | 7124 if (is_ascii) { |
7142 return kIrregexpASCIICodeIndex; | 7125 return kIrregexpASCIICodeIndex; |
7143 } else { | 7126 } else { |
7144 return kIrregexpUC16CodeIndex; | 7127 return kIrregexpUC16CodeIndex; |
7145 } | 7128 } |
7146 } | 7129 } |
7147 | 7130 |
7148 static int saved_code_index(bool is_ascii) { | 7131 static int saved_code_index(bool is_ascii) { |
7149 if (is_ascii) { | 7132 if (is_ascii) { |
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9717 } else { | 9700 } else { |
9718 value &= ~(1 << bit_position); | 9701 value &= ~(1 << bit_position); |
9719 } | 9702 } |
9720 return value; | 9703 return value; |
9721 } | 9704 } |
9722 }; | 9705 }; |
9723 | 9706 |
9724 } } // namespace v8::internal | 9707 } } // namespace v8::internal |
9725 | 9708 |
9726 #endif // V8_OBJECTS_H_ | 9709 #endif // V8_OBJECTS_H_ |
OLD | NEW |