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 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 static Handle<Object> GetElementWithInterceptor(Handle<JSObject> object, | 2485 static Handle<Object> GetElementWithInterceptor(Handle<JSObject> object, |
2486 Handle<Object> receiver, | 2486 Handle<Object> receiver, |
2487 uint32_t index); | 2487 uint32_t index); |
2488 | 2488 |
2489 enum SetFastElementsCapacitySmiMode { | 2489 enum SetFastElementsCapacitySmiMode { |
2490 kAllowSmiElements, | 2490 kAllowSmiElements, |
2491 kForceSmiElements, | 2491 kForceSmiElements, |
2492 kDontAllowSmiElements | 2492 kDontAllowSmiElements |
2493 }; | 2493 }; |
2494 | 2494 |
| 2495 // Replace the elements' backing store with fast elements of the given |
| 2496 // capacity. Update the length for JSArrays. Returns the new backing |
| 2497 // store. |
2495 static Handle<FixedArray> SetFastElementsCapacityAndLength( | 2498 static Handle<FixedArray> SetFastElementsCapacityAndLength( |
2496 Handle<JSObject> object, | 2499 Handle<JSObject> object, |
2497 int capacity, | 2500 int capacity, |
2498 int length, | 2501 int length, |
2499 SetFastElementsCapacitySmiMode smi_mode); | 2502 SetFastElementsCapacitySmiMode smi_mode); |
2500 // Replace the elements' backing store with fast elements of the given | |
2501 // capacity. Update the length for JSArrays. Returns the new backing | |
2502 // store. | |
2503 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( | |
2504 int capacity, | |
2505 int length, | |
2506 SetFastElementsCapacitySmiMode smi_mode); | |
2507 static void SetFastDoubleElementsCapacityAndLength( | 2503 static void SetFastDoubleElementsCapacityAndLength( |
2508 Handle<JSObject> object, | 2504 Handle<JSObject> object, |
2509 int capacity, | 2505 int capacity, |
2510 int length); | 2506 int length); |
2511 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( | 2507 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( |
2512 int capacity, | 2508 int capacity, |
2513 int length); | 2509 int length); |
2514 | 2510 |
2515 // Lookup interceptors are used for handling properties controlled by host | 2511 // Lookup interceptors are used for handling properties controlled by host |
2516 // objects. | 2512 // objects. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 ElementsKind to_kind); | 2565 ElementsKind to_kind); |
2570 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2566 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2571 Isolate* isolate, | 2567 Isolate* isolate, |
2572 ElementsKind elements_kind); | 2568 ElementsKind elements_kind); |
2573 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2569 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2574 ElementsKind elements_kind); | 2570 ElementsKind elements_kind); |
2575 | 2571 |
2576 static void TransitionElementsKind(Handle<JSObject> object, | 2572 static void TransitionElementsKind(Handle<JSObject> object, |
2577 ElementsKind to_kind); | 2573 ElementsKind to_kind); |
2578 | 2574 |
2579 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | |
2580 | |
2581 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). | 2575 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). |
2582 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); | 2576 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); |
2583 static void GeneralizeFieldRepresentation(Handle<JSObject> object, | 2577 static void GeneralizeFieldRepresentation(Handle<JSObject> object, |
2584 int modify_index, | 2578 int modify_index, |
2585 Representation new_representation, | 2579 Representation new_representation, |
2586 StoreMode store_mode); | 2580 StoreMode store_mode); |
2587 | 2581 |
2588 // Convert the object to use the canonical dictionary | 2582 // Convert the object to use the canonical dictionary |
2589 // representation. If the object is expected to have additional properties | 2583 // representation. If the object is expected to have additional properties |
2590 // added this number can be indicated to have the backing store allocated to | 2584 // added this number can be indicated to have the backing store allocated to |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2662 // Dispatched behavior. | 2656 // Dispatched behavior. |
2663 void JSObjectShortPrint(StringStream* accumulator); | 2657 void JSObjectShortPrint(StringStream* accumulator); |
2664 DECLARE_PRINTER(JSObject) | 2658 DECLARE_PRINTER(JSObject) |
2665 DECLARE_VERIFIER(JSObject) | 2659 DECLARE_VERIFIER(JSObject) |
2666 #ifdef OBJECT_PRINT | 2660 #ifdef OBJECT_PRINT |
2667 void PrintProperties(FILE* out = stdout); | 2661 void PrintProperties(FILE* out = stdout); |
2668 void PrintElements(FILE* out = stdout); | 2662 void PrintElements(FILE* out = stdout); |
2669 void PrintTransitions(FILE* out = stdout); | 2663 void PrintTransitions(FILE* out = stdout); |
2670 #endif | 2664 #endif |
2671 | 2665 |
2672 void PrintElementsTransition( | 2666 static void PrintElementsTransition( |
2673 FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements, | 2667 FILE* file, Handle<JSObject> object, |
2674 ElementsKind to_kind, FixedArrayBase* to_elements); | 2668 ElementsKind from_kind, Handle<FixedArrayBase> from_elements, |
| 2669 ElementsKind to_kind, Handle<FixedArrayBase> to_elements); |
2675 | 2670 |
2676 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); | 2671 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); |
2677 | 2672 |
2678 #ifdef DEBUG | 2673 #ifdef DEBUG |
2679 // Structure for collecting spill information about JSObjects. | 2674 // Structure for collecting spill information about JSObjects. |
2680 class SpillInformation { | 2675 class SpillInformation { |
2681 public: | 2676 public: |
2682 void Clear(); | 2677 void Clear(); |
2683 void Print(); | 2678 void Print(); |
2684 int number_of_objects_; | 2679 int number_of_objects_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2761 Handle<Name> name, | 2756 Handle<Name> name, |
2762 Handle<Object> old_value); | 2757 Handle<Object> old_value); |
2763 | 2758 |
2764 private: | 2759 private: |
2765 friend class DictionaryElementsAccessor; | 2760 friend class DictionaryElementsAccessor; |
2766 friend class JSReceiver; | 2761 friend class JSReceiver; |
2767 friend class Object; | 2762 friend class Object; |
2768 | 2763 |
2769 static void UpdateAllocationSite(Handle<JSObject> object, | 2764 static void UpdateAllocationSite(Handle<JSObject> object, |
2770 ElementsKind to_kind); | 2765 ElementsKind to_kind); |
2771 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); | |
2772 | 2766 |
2773 // Used from Object::GetProperty(). | 2767 // Used from Object::GetProperty(). |
2774 static Handle<Object> GetPropertyWithFailedAccessCheck( | 2768 static Handle<Object> GetPropertyWithFailedAccessCheck( |
2775 Handle<JSObject> object, | 2769 Handle<JSObject> object, |
2776 Handle<Object> receiver, | 2770 Handle<Object> receiver, |
2777 LookupResult* result, | 2771 LookupResult* result, |
2778 Handle<Name> name, | 2772 Handle<Name> name, |
2779 PropertyAttributes* attributes); | 2773 PropertyAttributes* attributes); |
2780 | 2774 |
2781 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2775 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
(...skipping 5580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8362 SKIP_WRITE_BARRIER); | 8356 SKIP_WRITE_BARRIER); |
8363 } | 8357 } |
8364 | 8358 |
8365 bool SitePointsToLiteral() { | 8359 bool SitePointsToLiteral() { |
8366 // If transition_info is a smi, then it represents an ElementsKind | 8360 // If transition_info is a smi, then it represents an ElementsKind |
8367 // for a constructed array. Otherwise, it must be a boilerplate | 8361 // for a constructed array. Otherwise, it must be a boilerplate |
8368 // for an object or array literal. | 8362 // for an object or array literal. |
8369 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); | 8363 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); |
8370 } | 8364 } |
8371 | 8365 |
8372 MaybeObject* DigestTransitionFeedback(ElementsKind to_kind); | 8366 static void DigestTransitionFeedback(Handle<AllocationSite> site, |
| 8367 ElementsKind to_kind); |
8373 | 8368 |
8374 enum Reason { | 8369 enum Reason { |
8375 TENURING, | 8370 TENURING, |
8376 TRANSITIONS | 8371 TRANSITIONS |
8377 }; | 8372 }; |
8378 | 8373 |
8379 static void AddDependentCompilationInfo(Handle<AllocationSite> site, | 8374 static void AddDependentCompilationInfo(Handle<AllocationSite> site, |
8380 Reason reason, | 8375 Reason reason, |
8381 CompilationInfo* info); | 8376 CompilationInfo* info); |
8382 | 8377 |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10791 } else { | 10786 } else { |
10792 value &= ~(1 << bit_position); | 10787 value &= ~(1 << bit_position); |
10793 } | 10788 } |
10794 return value; | 10789 return value; |
10795 } | 10790 } |
10796 }; | 10791 }; |
10797 | 10792 |
10798 } } // namespace v8::internal | 10793 } } // namespace v8::internal |
10799 | 10794 |
10800 #endif // V8_OBJECTS_H_ | 10795 #endif // V8_OBJECTS_H_ |
OLD | NEW |