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

Unified Diff: src/objects.h

Issue 7527001: Encapsulate element handling into a class keyed on ElementsKind (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge with tot Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index ba690ecab52c1cfafbe4a2e511134fc247a4328d..27082f7799350a1a74f8457a7ee5cde00c952d2e 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -71,17 +71,19 @@
// - ExternalIntArray
// - ExternalUnsignedIntArray
// - ExternalFloatArray
-// - FixedArray
-// - DescriptorArray
-// - HashTable
-// - Dictionary
-// - SymbolTable
-// - CompilationCacheTable
-// - CodeCacheHashTable
-// - MapCache
-// - Context
-// - JSFunctionResultCache
-// - SerializedScopeInfo
+// - FixedArrayBase
+// - FixedArray
+// - DescriptorArray
+// - HashTable
+// - Dictionary
+// - SymbolTable
+// - CompilationCacheTable
+// - CodeCacheHashTable
+// - MapCache
+// - Context
+// - JSFunctionResultCache
+// - SerializedScopeInfo
+// - FixedDoubleArray
// - String
// - SeqString
// - SeqAsciiString
@@ -630,8 +632,10 @@ enum CompareResult {
WriteBarrierMode mode = UPDATE_WRITE_BARRIER); \
+class ElementsAccessor;
class StringStream;
class ObjectVisitor;
+class DictionaryElementsAccessor;
struct ValueInfo : public Malloced {
ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { }
@@ -1488,6 +1492,7 @@ class JSObject: public JSReceiver {
inline void initialize_elements();
MUST_USE_RESULT inline MaybeObject* ResetElements();
inline ElementsKind GetElementsKind();
+ inline ElementsAccessor* GetElementsAccessor();
inline bool HasFastElements();
inline bool HasFastDoubleElements();
inline bool HasDictionaryElements();
@@ -1733,11 +1738,6 @@ class JSObject: public JSReceiver {
MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
- // Get external element value at index if there is one and undefined
- // otherwise. Can return a failure if allocation of a heap number
- // failed.
- MaybeObject* GetExternalElement(uint32_t index);
-
// Replace the elements' backing store with fast elements of the given
// capacity. Update the length for JSArrays. Returns the new backing
// store.
@@ -2001,6 +2001,8 @@ class JSObject: public JSReceiver {
};
private:
+ friend class DictionaryElementsAccessor;
+
MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
Object* structure,
uint32_t index,
@@ -2021,8 +2023,6 @@ class JSObject: public JSReceiver {
StrictModeFlag strict_mode,
bool check_prototype);
- MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
-
MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
DeleteMode mode);
MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
@@ -2092,6 +2092,7 @@ class FixedArray: public FixedArrayBase {
inline Object* get(int index);
// Setter that uses write barrier.
inline void set(int index, Object* value);
+ inline bool is_the_hole(int index);
// Setter that doesn't need write barrier).
inline void set(int index, Smi* value);
@@ -2197,7 +2198,8 @@ class FixedDoubleArray: public FixedArrayBase {
inline void Initialize(NumberDictionary* from);
// Setter and getter for elements.
- inline double get(int index);
+ inline double get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, double value);
inline void set_the_hole(int index);
@@ -3129,6 +3131,8 @@ class ExternalArray: public HeapObject {
inline int length();
inline void set_length(int value);
+ inline bool is_the_hole(int index) { return false; }
+
// [external_pointer]: The pointer to the external memory area backing this
// external array.
DECL_ACCESSORS(external_pointer, void) // Pointer to the data store.
@@ -3164,7 +3168,8 @@ class ExternalPixelArray: public ExternalArray {
inline uint8_t* external_pixel_pointer();
// Setter and getter.
- inline uint8_t get(int index);
+ inline uint8_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, uint8_t value);
// This accessor applies the correct conversion from Smi, HeapNumber and
@@ -3192,7 +3197,8 @@ class ExternalPixelArray: public ExternalArray {
class ExternalByteArray: public ExternalArray {
public:
// Setter and getter.
- inline int8_t get(int index);
+ inline int8_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, int8_t value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3220,7 +3226,8 @@ class ExternalByteArray: public ExternalArray {
class ExternalUnsignedByteArray: public ExternalArray {
public:
// Setter and getter.
- inline uint8_t get(int index);
+ inline uint8_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, uint8_t value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3248,7 +3255,8 @@ class ExternalUnsignedByteArray: public ExternalArray {
class ExternalShortArray: public ExternalArray {
public:
// Setter and getter.
- inline int16_t get(int index);
+ inline int16_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, int16_t value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3276,7 +3284,8 @@ class ExternalShortArray: public ExternalArray {
class ExternalUnsignedShortArray: public ExternalArray {
public:
// Setter and getter.
- inline uint16_t get(int index);
+ inline uint16_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, uint16_t value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3304,7 +3313,8 @@ class ExternalUnsignedShortArray: public ExternalArray {
class ExternalIntArray: public ExternalArray {
public:
// Setter and getter.
- inline int32_t get(int index);
+ inline int32_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, int32_t value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3332,7 +3342,8 @@ class ExternalIntArray: public ExternalArray {
class ExternalUnsignedIntArray: public ExternalArray {
public:
// Setter and getter.
- inline uint32_t get(int index);
+ inline uint32_t get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, uint32_t value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3360,7 +3371,8 @@ class ExternalUnsignedIntArray: public ExternalArray {
class ExternalFloatArray: public ExternalArray {
public:
// Setter and getter.
- inline float get(int index);
+ inline float get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, float value);
// This accessor applies the correct conversion from Smi, HeapNumber
@@ -3388,7 +3400,8 @@ class ExternalFloatArray: public ExternalArray {
class ExternalDoubleArray: public ExternalArray {
public:
// Setter and getter.
- inline double get(int index);
+ inline double get_scalar(int index);
+ inline MaybeObject* get(int index);
inline void set(int index, double value);
// This accessor applies the correct conversion from Smi, HeapNumber
« no previous file with comments | « src/elements.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698