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

Side by Side Diff: src/objects.h

Issue 1612323003: Introduce {FAST,SLOW}_STRING_WRAPPER_ELEMENTS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more DCHECK fix Created 4 years, 10 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
« no previous file with comments | « src/lookup.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1344
1345 // Tries to convert an object to an array length. Returns true and sets the 1345 // Tries to convert an object to an array length. Returns true and sets the
1346 // output parameter if it succeeds. 1346 // output parameter if it succeeds.
1347 inline bool ToArrayLength(uint32_t* index); 1347 inline bool ToArrayLength(uint32_t* index);
1348 1348
1349 // Tries to convert an object to an array index. Returns true and sets the 1349 // Tries to convert an object to an array index. Returns true and sets the
1350 // output parameter if it succeeds. Equivalent to ToArrayLength, but does not 1350 // output parameter if it succeeds. Equivalent to ToArrayLength, but does not
1351 // allow kMaxUInt32. 1351 // allow kMaxUInt32.
1352 inline bool ToArrayIndex(uint32_t* index); 1352 inline bool ToArrayIndex(uint32_t* index);
1353 1353
1354 // Returns true if this is a JSValue containing a string and the index is
1355 // < the length of the string. Used to implement [] on strings.
1356 inline bool IsStringObjectWithCharacterAt(uint32_t index);
1357
1358 DECLARE_VERIFIER(Object) 1354 DECLARE_VERIFIER(Object)
1359 #ifdef VERIFY_HEAP 1355 #ifdef VERIFY_HEAP
1360 // Verify a pointer is a valid object pointer. 1356 // Verify a pointer is a valid object pointer.
1361 static void VerifyPointer(Object* p); 1357 static void VerifyPointer(Object* p);
1362 #endif 1358 #endif
1363 1359
1364 inline void VerifyApiCallResultType(); 1360 inline void VerifyApiCallResultType();
1365 1361
1366 // ES6 19.1.3.6 Object.prototype.toString 1362 // ES6 19.1.3.6 Object.prototype.toString
1367 MUST_USE_RESULT static MaybeHandle<String> ObjectProtoToString( 1363 MUST_USE_RESULT static MaybeHandle<String> ObjectProtoToString(
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
2023 inline bool HasFastSmiOrObjectElements(); 2019 inline bool HasFastSmiOrObjectElements();
2024 // Returns true if an object has any of the fast elements kinds. 2020 // Returns true if an object has any of the fast elements kinds.
2025 inline bool HasFastElements(); 2021 inline bool HasFastElements();
2026 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS 2022 // Returns true if an object has elements of FAST_DOUBLE_ELEMENTS
2027 // ElementsKind. 2023 // ElementsKind.
2028 inline bool HasFastDoubleElements(); 2024 inline bool HasFastDoubleElements();
2029 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS 2025 // Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
2030 // ElementsKind. 2026 // ElementsKind.
2031 inline bool HasFastHoleyElements(); 2027 inline bool HasFastHoleyElements();
2032 inline bool HasSloppyArgumentsElements(); 2028 inline bool HasSloppyArgumentsElements();
2029 inline bool HasStringWrapperElements();
2033 inline bool HasDictionaryElements(); 2030 inline bool HasDictionaryElements();
2034 2031
2035 inline bool HasFixedTypedArrayElements(); 2032 inline bool HasFixedTypedArrayElements();
2036 2033
2037 inline bool HasFixedUint8ClampedElements(); 2034 inline bool HasFixedUint8ClampedElements();
2038 inline bool HasFixedArrayElements(); 2035 inline bool HasFixedArrayElements();
2039 inline bool HasFixedInt8Elements(); 2036 inline bool HasFixedInt8Elements();
2040 inline bool HasFixedUint8Elements(); 2037 inline bool HasFixedUint8Elements();
2041 inline bool HasFixedInt16Elements(); 2038 inline bool HasFixedInt16Elements();
2042 inline bool HasFixedUint16Elements(); 2039 inline bool HasFixedUint16Elements();
2043 inline bool HasFixedInt32Elements(); 2040 inline bool HasFixedInt32Elements();
2044 inline bool HasFixedUint32Elements(); 2041 inline bool HasFixedUint32Elements();
2045 inline bool HasFixedFloat32Elements(); 2042 inline bool HasFixedFloat32Elements();
2046 inline bool HasFixedFloat64Elements(); 2043 inline bool HasFixedFloat64Elements();
2047 2044
2048 inline bool HasFastArgumentsElements(); 2045 inline bool HasFastArgumentsElements();
2049 inline bool HasSlowArgumentsElements(); 2046 inline bool HasSlowArgumentsElements();
2047 inline bool HasFastStringWrapperElements();
2048 inline bool HasSlowStringWrapperElements();
2050 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. 2049 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements.
2051 2050
2052 // Requires: HasFastElements(). 2051 // Requires: HasFastElements().
2053 static Handle<FixedArray> EnsureWritableFastElements( 2052 static Handle<FixedArray> EnsureWritableFastElements(
2054 Handle<JSObject> object); 2053 Handle<JSObject> object);
2055 2054
2056 // Collects elements starting at index 0. 2055 // Collects elements starting at index 0.
2057 // Undefined values are placed after non-undefined values. 2056 // Undefined values are placed after non-undefined values.
2058 // Returns the number of non-undefined values. 2057 // Returns the number of non-undefined values.
2059 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, 2058 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object,
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 2626
2628 class FixedDoubleArray; 2627 class FixedDoubleArray;
2629 class IncrementalMarking; 2628 class IncrementalMarking;
2630 2629
2631 2630
2632 // FixedArray describes fixed-sized arrays with element type Object*. 2631 // FixedArray describes fixed-sized arrays with element type Object*.
2633 class FixedArray: public FixedArrayBase { 2632 class FixedArray: public FixedArrayBase {
2634 public: 2633 public:
2635 // Setter and getter for elements. 2634 // Setter and getter for elements.
2636 inline Object* get(int index) const; 2635 inline Object* get(int index) const;
2637 static inline Handle<Object> get(Handle<FixedArray> array, int index); 2636 static inline Handle<Object> get(FixedArray* array, int index,
2637 Isolate* isolate);
2638 // Setter that uses write barrier. 2638 // Setter that uses write barrier.
2639 inline void set(int index, Object* value); 2639 inline void set(int index, Object* value);
2640 inline bool is_the_hole(int index); 2640 inline bool is_the_hole(int index);
2641 2641
2642 // Setter that doesn't need write barrier. 2642 // Setter that doesn't need write barrier.
2643 inline void set(int index, Smi* value); 2643 inline void set(int index, Smi* value);
2644 // Setter with explicit barrier mode. 2644 // Setter with explicit barrier mode.
2645 inline void set(int index, Object* value, WriteBarrierMode mode); 2645 inline void set(int index, Object* value, WriteBarrierMode mode);
2646 2646
2647 // Setters for frequently used oddballs located in old space. 2647 // Setters for frequently used oddballs located in old space.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); 2714 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray);
2715 }; 2715 };
2716 2716
2717 2717
2718 // FixedDoubleArray describes fixed-sized arrays with element type double. 2718 // FixedDoubleArray describes fixed-sized arrays with element type double.
2719 class FixedDoubleArray: public FixedArrayBase { 2719 class FixedDoubleArray: public FixedArrayBase {
2720 public: 2720 public:
2721 // Setter and getter for elements. 2721 // Setter and getter for elements.
2722 inline double get_scalar(int index); 2722 inline double get_scalar(int index);
2723 inline uint64_t get_representation(int index); 2723 inline uint64_t get_representation(int index);
2724 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); 2724 static inline Handle<Object> get(FixedDoubleArray* array, int index,
2725 Isolate* isolate);
2725 inline void set(int index, double value); 2726 inline void set(int index, double value);
2726 inline void set_the_hole(int index); 2727 inline void set_the_hole(int index);
2727 2728
2728 // Checking for the hole. 2729 // Checking for the hole.
2729 inline bool is_the_hole(int index); 2730 inline bool is_the_hole(int index);
2730 2731
2731 // Garbage collection support. 2732 // Garbage collection support.
2732 inline static int SizeFor(int length) { 2733 inline static int SizeFor(int length) {
2733 return kHeaderSize + length * kDoubleSize; 2734 return kHeaderSize + length * kDoubleSize;
2734 } 2735 }
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
4552 4553
4553 template <class Traits> 4554 template <class Traits>
4554 class FixedTypedArray: public FixedTypedArrayBase { 4555 class FixedTypedArray: public FixedTypedArrayBase {
4555 public: 4556 public:
4556 typedef typename Traits::ElementType ElementType; 4557 typedef typename Traits::ElementType ElementType;
4557 static const InstanceType kInstanceType = Traits::kInstanceType; 4558 static const InstanceType kInstanceType = Traits::kInstanceType;
4558 4559
4559 DECLARE_CAST(FixedTypedArray<Traits>) 4560 DECLARE_CAST(FixedTypedArray<Traits>)
4560 4561
4561 inline ElementType get_scalar(int index); 4562 inline ElementType get_scalar(int index);
4562 static inline Handle<Object> get(Handle<FixedTypedArray> array, int index); 4563 static inline Handle<Object> get(FixedTypedArray* array, int index);
4563 inline void set(int index, ElementType value); 4564 inline void set(int index, ElementType value);
4564 4565
4565 static inline ElementType from_int(int value); 4566 static inline ElementType from_int(int value);
4566 static inline ElementType from_double(double value); 4567 static inline ElementType from_double(double value);
4567 4568
4568 // This accessor applies the correct conversion from Smi, HeapNumber 4569 // This accessor applies the correct conversion from Smi, HeapNumber
4569 // and undefined. 4570 // and undefined.
4570 inline void SetValue(uint32_t index, Object* value); 4571 inline void SetValue(uint32_t index, Object* value);
4571 4572
4572 DECLARE_PRINTER(FixedTypedArray) 4573 DECLARE_PRINTER(FixedTypedArray)
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
5668 5669
5669 // Tells whether the instance has fast elements that are only Smis. 5670 // Tells whether the instance has fast elements that are only Smis.
5670 inline bool has_fast_smi_elements(); 5671 inline bool has_fast_smi_elements();
5671 5672
5672 // Tells whether the instance has fast elements. 5673 // Tells whether the instance has fast elements.
5673 inline bool has_fast_object_elements(); 5674 inline bool has_fast_object_elements();
5674 inline bool has_fast_smi_or_object_elements(); 5675 inline bool has_fast_smi_or_object_elements();
5675 inline bool has_fast_double_elements(); 5676 inline bool has_fast_double_elements();
5676 inline bool has_fast_elements(); 5677 inline bool has_fast_elements();
5677 inline bool has_sloppy_arguments_elements(); 5678 inline bool has_sloppy_arguments_elements();
5679 inline bool has_fast_string_wrapper_elements();
5678 inline bool has_fixed_typed_array_elements(); 5680 inline bool has_fixed_typed_array_elements();
5679 inline bool has_dictionary_elements(); 5681 inline bool has_dictionary_elements();
5680 5682
5681 static bool IsValidElementsTransition(ElementsKind from_kind, 5683 static bool IsValidElementsTransition(ElementsKind from_kind,
5682 ElementsKind to_kind); 5684 ElementsKind to_kind);
5683 5685
5684 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a 5686 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a
5685 // map with DICTIONARY_ELEMENTS was found in the prototype chain. 5687 // map with DICTIONARY_ELEMENTS was found in the prototype chain.
5686 bool DictionaryElementsInPrototypeChainOnly(); 5688 bool DictionaryElementsInPrototypeChainOnly();
5687 5689
(...skipping 5115 matching lines...) Expand 10 before | Expand all | Expand 10 after
10803 } 10805 }
10804 return value; 10806 return value;
10805 } 10807 }
10806 }; 10808 };
10807 10809
10808 10810
10809 } // NOLINT, false-positive due to second-order macros. 10811 } // NOLINT, false-positive due to second-order macros.
10810 } // NOLINT, false-positive due to second-order macros. 10812 } // NOLINT, false-positive due to second-order macros.
10811 10813
10812 #endif // V8_OBJECTS_H_ 10814 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698