Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 // Define this so that we can put assertions on discrete checks. | 770 // Define this so that we can put assertions on discrete checks. |
| 771 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 | 771 NUM_OF_CALLABLE_SPEC_OBJECT_TYPES = 2 |
| 772 }; | 772 }; |
| 773 | 773 |
| 774 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); | 774 STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType); |
| 775 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 775 STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
| 776 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); | 776 STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType); |
| 777 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); | 777 STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType); |
| 778 | 778 |
| 779 | 779 |
| 780 std::ostream& operator<<(std::ostream& os, InstanceType instance_type); | |
| 781 | |
| 782 | |
| 780 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ | 783 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ |
| 781 V(FAST_ELEMENTS_SUB_TYPE) \ | 784 V(FAST_ELEMENTS_SUB_TYPE) \ |
| 782 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ | 785 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ |
| 783 V(FAST_PROPERTIES_SUB_TYPE) \ | 786 V(FAST_PROPERTIES_SUB_TYPE) \ |
| 784 V(DICTIONARY_PROPERTIES_SUB_TYPE) \ | 787 V(DICTIONARY_PROPERTIES_SUB_TYPE) \ |
| 785 V(MAP_CODE_CACHE_SUB_TYPE) \ | 788 V(MAP_CODE_CACHE_SUB_TYPE) \ |
| 786 V(SCOPE_INFO_SUB_TYPE) \ | 789 V(SCOPE_INFO_SUB_TYPE) \ |
| 787 V(STRING_TABLE_SUB_TYPE) \ | 790 V(STRING_TABLE_SUB_TYPE) \ |
| 788 V(DESCRIPTOR_ARRAY_SUB_TYPE) \ | 791 V(DESCRIPTOR_ARRAY_SUB_TYPE) \ |
| 789 V(TRANSITION_ARRAY_SUB_TYPE) | 792 V(TRANSITION_ARRAY_SUB_TYPE) |
| (...skipping 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5498 // Builtins::kJSConstructStubGeneric stub. | 5501 // Builtins::kJSConstructStubGeneric stub. |
| 5499 // This counter is used for in-object slack tracking and for map aging. | 5502 // This counter is used for in-object slack tracking and for map aging. |
| 5500 // The in-object slack tracking is considered enabled when the counter is | 5503 // The in-object slack tracking is considered enabled when the counter is |
| 5501 // in the range [kSlackTrackingCounterStart, kSlackTrackingCounterEnd]. | 5504 // in the range [kSlackTrackingCounterStart, kSlackTrackingCounterEnd]. |
| 5502 class Counter : public BitField<int, 28, 4> {}; | 5505 class Counter : public BitField<int, 28, 4> {}; |
| 5503 static const int kSlackTrackingCounterStart = 14; | 5506 static const int kSlackTrackingCounterStart = 14; |
| 5504 static const int kSlackTrackingCounterEnd = 8; | 5507 static const int kSlackTrackingCounterEnd = 8; |
| 5505 static const int kRetainingCounterStart = kSlackTrackingCounterEnd - 1; | 5508 static const int kRetainingCounterStart = kSlackTrackingCounterEnd - 1; |
| 5506 static const int kRetainingCounterEnd = 0; | 5509 static const int kRetainingCounterEnd = 0; |
| 5507 | 5510 |
| 5511 // Starts the tracking by initializing object constructions countdown counter. | |
| 5512 void StartInobjectSlackTracking(); | |
| 5513 | |
| 5514 inline bool IsInobjectSlackTrackingInProgress(); | |
| 5515 | |
| 5516 // Does the tracking step. | |
| 5517 inline void InobjectSlackTrackingStep(); | |
| 5518 | |
| 5508 // Completes inobject slack tracking for the transition tree starting at this | 5519 // Completes inobject slack tracking for the transition tree starting at this |
| 5509 // initial map. | 5520 // initial map. |
| 5510 void CompleteInobjectSlackTracking(); | 5521 void CompleteInobjectSlackTracking(); |
| 5511 | 5522 |
| 5512 // Tells whether the object in the prototype property will be used | 5523 // Tells whether the object in the prototype property will be used |
| 5513 // for instances created from this function. If the prototype | 5524 // for instances created from this function. If the prototype |
| 5514 // property is set to a value that is not a JSObject, the prototype | 5525 // property is set to a value that is not a JSObject, the prototype |
| 5515 // property will not be used to create instances of the function. | 5526 // property will not be used to create instances of the function. |
| 5516 // See ECMA-262, 13.2.2. | 5527 // See ECMA-262, 13.2.2. |
| 5517 inline void set_non_instance_prototype(bool value); | 5528 inline void set_non_instance_prototype(bool value); |
| (...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7244 // of every map. Existing objects will resize automatically (they are | 7255 // of every map. Existing objects will resize automatically (they are |
| 7245 // filled with one_pointer_filler_map). All further allocations will | 7256 // filled with one_pointer_filler_map). All further allocations will |
| 7246 // use the adjusted instance size. | 7257 // use the adjusted instance size. |
| 7247 // - SharedFunctionInfo's expected_nof_properties left unmodified since | 7258 // - SharedFunctionInfo's expected_nof_properties left unmodified since |
| 7248 // allocations made using different closures could actually create different | 7259 // allocations made using different closures could actually create different |
| 7249 // kind of objects (see prototype inheritance pattern). | 7260 // kind of objects (see prototype inheritance pattern). |
| 7250 // | 7261 // |
| 7251 // Important: inobject slack tracking is not attempted during the snapshot | 7262 // Important: inobject slack tracking is not attempted during the snapshot |
| 7252 // creation. | 7263 // creation. |
| 7253 | 7264 |
| 7254 // True if the initial_map is set and the object constructions countdown | 7265 // True if the initial_map is set and the object constructions countdown |
|
Michael Starzinger
2015/12/02 18:41:57
nit: This comment applied to the predicate, looks
Igor Sheludko
2015/12/03 08:53:14
Thanks! I updated and moved both this comment and
| |
| 7255 // counter is not zero. | 7266 // counter is not zero. |
| 7256 static const int kGenerousAllocationCount = | 7267 static const int kGenerousAllocationCount = |
| 7257 Map::kSlackTrackingCounterStart - Map::kSlackTrackingCounterEnd + 1; | 7268 Map::kSlackTrackingCounterStart - Map::kSlackTrackingCounterEnd + 1; |
| 7258 inline bool IsInobjectSlackTrackingInProgress(); | |
| 7259 | 7269 |
| 7260 // Starts the tracking. | 7270 // Completes the tracking on initial map if it is active. |
| 7261 // Initializes object constructions countdown counter in the initial map. | 7271 inline void CompleteInobjectSlackTrackingIfActive(); |
| 7262 void StartInobjectSlackTracking(); | |
| 7263 | |
| 7264 // Completes the tracking. | |
| 7265 void CompleteInobjectSlackTracking(); | |
| 7266 | 7272 |
| 7267 // [literals_or_bindings]: Fixed array holding either | 7273 // [literals_or_bindings]: Fixed array holding either |
| 7268 // the materialized literals or the bindings of a bound function. | 7274 // the materialized literals or the bindings of a bound function. |
| 7269 // | 7275 // |
| 7270 // If the function contains object, regexp or array literals, the | 7276 // If the function contains object, regexp or array literals, the |
| 7271 // literals array prefix contains the object, regexp, and array | 7277 // literals array prefix contains the object, regexp, and array |
| 7272 // function to be used when creating these literals. This is | 7278 // function to be used when creating these literals. This is |
| 7273 // necessary so that we do not dynamically lookup the object, regexp | 7279 // necessary so that we do not dynamically lookup the object, regexp |
| 7274 // or array functions. Performing a dynamic lookup, we might end up | 7280 // or array functions. Performing a dynamic lookup, we might end up |
| 7275 // using the functions from a new context that we should not have | 7281 // using the functions from a new context that we should not have |
| (...skipping 3434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10710 } | 10716 } |
| 10711 return value; | 10717 return value; |
| 10712 } | 10718 } |
| 10713 }; | 10719 }; |
| 10714 | 10720 |
| 10715 | 10721 |
| 10716 } // NOLINT, false-positive due to second-order macros. | 10722 } // NOLINT, false-positive due to second-order macros. |
| 10717 } // NOLINT, false-positive due to second-order macros. | 10723 } // NOLINT, false-positive due to second-order macros. |
| 10718 | 10724 |
| 10719 #endif // V8_OBJECTS_H_ | 10725 #endif // V8_OBJECTS_H_ |
| OLD | NEW |