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