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

Side by Side Diff: src/objects.h

Issue 235923013: Handlify TypedArray setters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fixed comment Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 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 4899 matching lines...) Expand 10 before | Expand all | Expand 10 after
4910 public: 4910 public:
4911 inline uint8_t* external_uint8_clamped_pointer(); 4911 inline uint8_t* external_uint8_clamped_pointer();
4912 4912
4913 // Setter and getter. 4913 // Setter and getter.
4914 inline uint8_t get_scalar(int index); 4914 inline uint8_t get_scalar(int index);
4915 MUST_USE_RESULT inline Object* get(int index); 4915 MUST_USE_RESULT inline Object* get(int index);
4916 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array, 4916 static inline Handle<Object> get(Handle<ExternalUint8ClampedArray> array,
4917 int index); 4917 int index);
4918 inline void set(int index, uint8_t value); 4918 inline void set(int index, uint8_t value);
4919 4919
4920 // This accessor applies the correct conversion from Smi, HeapNumber and 4920 // This accessor applies the correct conversion from Smi, HeapNumber
4921 // undefined and clamps the converted value between 0 and 255. 4921 // and undefined and clamps the converted value between 0 and 255.
4922 Object* SetValue(uint32_t index, Object* value);
4923
4924 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array, 4922 static Handle<Object> SetValue(Handle<ExternalUint8ClampedArray> array,
4925 uint32_t index, 4923 uint32_t index,
4926 Handle<Object> value); 4924 Handle<Object> value);
4927 4925
4928 // Casting. 4926 // Casting.
4929 static inline ExternalUint8ClampedArray* cast(Object* obj); 4927 static inline ExternalUint8ClampedArray* cast(Object* obj);
4930 4928
4931 // Dispatched behavior. 4929 // Dispatched behavior.
4932 DECLARE_PRINTER(ExternalUint8ClampedArray) 4930 DECLARE_PRINTER(ExternalUint8ClampedArray)
4933 DECLARE_VERIFIER(ExternalUint8ClampedArray) 4931 DECLARE_VERIFIER(ExternalUint8ClampedArray)
4934 4932
4935 private: 4933 private:
4936 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray); 4934 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8ClampedArray);
4937 }; 4935 };
4938 4936
4939 4937
4940 class ExternalInt8Array: public ExternalArray { 4938 class ExternalInt8Array: public ExternalArray {
4941 public: 4939 public:
4942 // Setter and getter. 4940 // Setter and getter.
4943 inline int8_t get_scalar(int index); 4941 inline int8_t get_scalar(int index);
4944 MUST_USE_RESULT inline Object* get(int index); 4942 MUST_USE_RESULT inline Object* get(int index);
4945 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index); 4943 static inline Handle<Object> get(Handle<ExternalInt8Array> array, int index);
4946 inline void set(int index, int8_t value); 4944 inline void set(int index, int8_t value);
4947 4945
4946 // This accessor applies the correct conversion from Smi, HeapNumber
4947 // and undefined.
4948 static Handle<Object> SetValue(Handle<ExternalInt8Array> array, 4948 static Handle<Object> SetValue(Handle<ExternalInt8Array> array,
4949 uint32_t index, 4949 uint32_t index,
4950 Handle<Object> value); 4950 Handle<Object> value);
4951 4951
4952 // This accessor applies the correct conversion from Smi, HeapNumber
4953 // and undefined.
4954 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4955
4956 // Casting. 4952 // Casting.
4957 static inline ExternalInt8Array* cast(Object* obj); 4953 static inline ExternalInt8Array* cast(Object* obj);
4958 4954
4959 // Dispatched behavior. 4955 // Dispatched behavior.
4960 DECLARE_PRINTER(ExternalInt8Array) 4956 DECLARE_PRINTER(ExternalInt8Array)
4961 DECLARE_VERIFIER(ExternalInt8Array) 4957 DECLARE_VERIFIER(ExternalInt8Array)
4962 4958
4963 private: 4959 private:
4964 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array); 4960 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt8Array);
4965 }; 4961 };
4966 4962
4967 4963
4968 class ExternalUint8Array: public ExternalArray { 4964 class ExternalUint8Array: public ExternalArray {
4969 public: 4965 public:
4970 // Setter and getter. 4966 // Setter and getter.
4971 inline uint8_t get_scalar(int index); 4967 inline uint8_t get_scalar(int index);
4972 MUST_USE_RESULT inline Object* get(int index); 4968 MUST_USE_RESULT inline Object* get(int index);
4973 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index); 4969 static inline Handle<Object> get(Handle<ExternalUint8Array> array, int index);
4974 inline void set(int index, uint8_t value); 4970 inline void set(int index, uint8_t value);
4975 4971
4972 // This accessor applies the correct conversion from Smi, HeapNumber
4973 // and undefined.
4976 static Handle<Object> SetValue(Handle<ExternalUint8Array> array, 4974 static Handle<Object> SetValue(Handle<ExternalUint8Array> array,
4977 uint32_t index, 4975 uint32_t index,
4978 Handle<Object> value); 4976 Handle<Object> value);
4979 4977
4980 // This accessor applies the correct conversion from Smi, HeapNumber
4981 // and undefined.
4982 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4983
4984 // Casting. 4978 // Casting.
4985 static inline ExternalUint8Array* cast(Object* obj); 4979 static inline ExternalUint8Array* cast(Object* obj);
4986 4980
4987 // Dispatched behavior. 4981 // Dispatched behavior.
4988 DECLARE_PRINTER(ExternalUint8Array) 4982 DECLARE_PRINTER(ExternalUint8Array)
4989 DECLARE_VERIFIER(ExternalUint8Array) 4983 DECLARE_VERIFIER(ExternalUint8Array)
4990 4984
4991 private: 4985 private:
4992 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array); 4986 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint8Array);
4993 }; 4987 };
4994 4988
4995 4989
4996 class ExternalInt16Array: public ExternalArray { 4990 class ExternalInt16Array: public ExternalArray {
4997 public: 4991 public:
4998 // Setter and getter. 4992 // Setter and getter.
4999 inline int16_t get_scalar(int index); 4993 inline int16_t get_scalar(int index);
5000 MUST_USE_RESULT inline Object* get(int index); 4994 MUST_USE_RESULT inline Object* get(int index);
5001 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index); 4995 static inline Handle<Object> get(Handle<ExternalInt16Array> array, int index);
5002 inline void set(int index, int16_t value); 4996 inline void set(int index, int16_t value);
5003 4997
4998 // This accessor applies the correct conversion from Smi, HeapNumber
4999 // and undefined.
5004 static Handle<Object> SetValue(Handle<ExternalInt16Array> array, 5000 static Handle<Object> SetValue(Handle<ExternalInt16Array> array,
5005 uint32_t index, 5001 uint32_t index,
5006 Handle<Object> value); 5002 Handle<Object> value);
5007 5003
5008 // This accessor applies the correct conversion from Smi, HeapNumber
5009 // and undefined.
5010 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5011
5012 // Casting. 5004 // Casting.
5013 static inline ExternalInt16Array* cast(Object* obj); 5005 static inline ExternalInt16Array* cast(Object* obj);
5014 5006
5015 // Dispatched behavior. 5007 // Dispatched behavior.
5016 DECLARE_PRINTER(ExternalInt16Array) 5008 DECLARE_PRINTER(ExternalInt16Array)
5017 DECLARE_VERIFIER(ExternalInt16Array) 5009 DECLARE_VERIFIER(ExternalInt16Array)
5018 5010
5019 private: 5011 private:
5020 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array); 5012 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt16Array);
5021 }; 5013 };
5022 5014
5023 5015
5024 class ExternalUint16Array: public ExternalArray { 5016 class ExternalUint16Array: public ExternalArray {
5025 public: 5017 public:
5026 // Setter and getter. 5018 // Setter and getter.
5027 inline uint16_t get_scalar(int index); 5019 inline uint16_t get_scalar(int index);
5028 MUST_USE_RESULT inline Object* get(int index); 5020 MUST_USE_RESULT inline Object* get(int index);
5029 static inline Handle<Object> get(Handle<ExternalUint16Array> array, 5021 static inline Handle<Object> get(Handle<ExternalUint16Array> array,
5030 int index); 5022 int index);
5031 inline void set(int index, uint16_t value); 5023 inline void set(int index, uint16_t value);
5032 5024
5025 // This accessor applies the correct conversion from Smi, HeapNumber
5026 // and undefined.
5033 static Handle<Object> SetValue(Handle<ExternalUint16Array> array, 5027 static Handle<Object> SetValue(Handle<ExternalUint16Array> array,
5034 uint32_t index, 5028 uint32_t index,
5035 Handle<Object> value); 5029 Handle<Object> value);
5036 5030
5037 // This accessor applies the correct conversion from Smi, HeapNumber
5038 // and undefined.
5039 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5040
5041 // Casting. 5031 // Casting.
5042 static inline ExternalUint16Array* cast(Object* obj); 5032 static inline ExternalUint16Array* cast(Object* obj);
5043 5033
5044 // Dispatched behavior. 5034 // Dispatched behavior.
5045 DECLARE_PRINTER(ExternalUint16Array) 5035 DECLARE_PRINTER(ExternalUint16Array)
5046 DECLARE_VERIFIER(ExternalUint16Array) 5036 DECLARE_VERIFIER(ExternalUint16Array)
5047 5037
5048 private: 5038 private:
5049 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array); 5039 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint16Array);
5050 }; 5040 };
5051 5041
5052 5042
5053 class ExternalInt32Array: public ExternalArray { 5043 class ExternalInt32Array: public ExternalArray {
5054 public: 5044 public:
5055 // Setter and getter. 5045 // Setter and getter.
5056 inline int32_t get_scalar(int index); 5046 inline int32_t get_scalar(int index);
5057 MUST_USE_RESULT inline MaybeObject* get(int index); 5047 MUST_USE_RESULT inline MaybeObject* get(int index);
5058 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index); 5048 static inline Handle<Object> get(Handle<ExternalInt32Array> array, int index);
5059 inline void set(int index, int32_t value); 5049 inline void set(int index, int32_t value);
5060 5050
5051 // This accessor applies the correct conversion from Smi, HeapNumber
5052 // and undefined.
5061 static Handle<Object> SetValue(Handle<ExternalInt32Array> array, 5053 static Handle<Object> SetValue(Handle<ExternalInt32Array> array,
5062 uint32_t index, 5054 uint32_t index,
5063 Handle<Object> value); 5055 Handle<Object> value);
5064 5056
5065 // This accessor applies the correct conversion from Smi, HeapNumber
5066 // and undefined.
5067 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5068
5069 // Casting. 5057 // Casting.
5070 static inline ExternalInt32Array* cast(Object* obj); 5058 static inline ExternalInt32Array* cast(Object* obj);
5071 5059
5072 // Dispatched behavior. 5060 // Dispatched behavior.
5073 DECLARE_PRINTER(ExternalInt32Array) 5061 DECLARE_PRINTER(ExternalInt32Array)
5074 DECLARE_VERIFIER(ExternalInt32Array) 5062 DECLARE_VERIFIER(ExternalInt32Array)
5075 5063
5076 private: 5064 private:
5077 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array); 5065 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalInt32Array);
5078 }; 5066 };
5079 5067
5080 5068
5081 class ExternalUint32Array: public ExternalArray { 5069 class ExternalUint32Array: public ExternalArray {
5082 public: 5070 public:
5083 // Setter and getter. 5071 // Setter and getter.
5084 inline uint32_t get_scalar(int index); 5072 inline uint32_t get_scalar(int index);
5085 MUST_USE_RESULT inline MaybeObject* get(int index); 5073 MUST_USE_RESULT inline MaybeObject* get(int index);
5086 static inline Handle<Object> get(Handle<ExternalUint32Array> array, 5074 static inline Handle<Object> get(Handle<ExternalUint32Array> array,
5087 int index); 5075 int index);
5088 inline void set(int index, uint32_t value); 5076 inline void set(int index, uint32_t value);
5089 5077
5078 // This accessor applies the correct conversion from Smi, HeapNumber
5079 // and undefined.
5090 static Handle<Object> SetValue(Handle<ExternalUint32Array> array, 5080 static Handle<Object> SetValue(Handle<ExternalUint32Array> array,
5091 uint32_t index, 5081 uint32_t index,
5092 Handle<Object> value); 5082 Handle<Object> value);
5093 5083
5094 // This accessor applies the correct conversion from Smi, HeapNumber
5095 // and undefined.
5096 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5097
5098 // Casting. 5084 // Casting.
5099 static inline ExternalUint32Array* cast(Object* obj); 5085 static inline ExternalUint32Array* cast(Object* obj);
5100 5086
5101 // Dispatched behavior. 5087 // Dispatched behavior.
5102 DECLARE_PRINTER(ExternalUint32Array) 5088 DECLARE_PRINTER(ExternalUint32Array)
5103 DECLARE_VERIFIER(ExternalUint32Array) 5089 DECLARE_VERIFIER(ExternalUint32Array)
5104 5090
5105 private: 5091 private:
5106 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array); 5092 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUint32Array);
5107 }; 5093 };
5108 5094
5109 5095
5110 class ExternalFloat32Array: public ExternalArray { 5096 class ExternalFloat32Array: public ExternalArray {
5111 public: 5097 public:
5112 // Setter and getter. 5098 // Setter and getter.
5113 inline float get_scalar(int index); 5099 inline float get_scalar(int index);
5114 MUST_USE_RESULT inline MaybeObject* get(int index); 5100 MUST_USE_RESULT inline MaybeObject* get(int index);
5115 static inline Handle<Object> get(Handle<ExternalFloat32Array> array, 5101 static inline Handle<Object> get(Handle<ExternalFloat32Array> array,
5116 int index); 5102 int index);
5117 inline void set(int index, float value); 5103 inline void set(int index, float value);
5118 5104
5105 // This accessor applies the correct conversion from Smi, HeapNumber
5106 // and undefined.
5119 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array, 5107 static Handle<Object> SetValue(Handle<ExternalFloat32Array> array,
5120 uint32_t index, 5108 uint32_t index,
5121 Handle<Object> value); 5109 Handle<Object> value);
5122 5110
5123 // This accessor applies the correct conversion from Smi, HeapNumber
5124 // and undefined.
5125 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5126
5127 // Casting. 5111 // Casting.
5128 static inline ExternalFloat32Array* cast(Object* obj); 5112 static inline ExternalFloat32Array* cast(Object* obj);
5129 5113
5130 // Dispatched behavior. 5114 // Dispatched behavior.
5131 DECLARE_PRINTER(ExternalFloat32Array) 5115 DECLARE_PRINTER(ExternalFloat32Array)
5132 DECLARE_VERIFIER(ExternalFloat32Array) 5116 DECLARE_VERIFIER(ExternalFloat32Array)
5133 5117
5134 private: 5118 private:
5135 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array); 5119 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat32Array);
5136 }; 5120 };
5137 5121
5138 5122
5139 class ExternalFloat64Array: public ExternalArray { 5123 class ExternalFloat64Array: public ExternalArray {
5140 public: 5124 public:
5141 // Setter and getter. 5125 // Setter and getter.
5142 inline double get_scalar(int index); 5126 inline double get_scalar(int index);
5143 MUST_USE_RESULT inline MaybeObject* get(int index); 5127 MUST_USE_RESULT inline MaybeObject* get(int index);
5144 static inline Handle<Object> get(Handle<ExternalFloat64Array> array, 5128 static inline Handle<Object> get(Handle<ExternalFloat64Array> array,
5145 int index); 5129 int index);
5146 inline void set(int index, double value); 5130 inline void set(int index, double value);
5147 5131
5132 // This accessor applies the correct conversion from Smi, HeapNumber
5133 // and undefined.
5148 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array, 5134 static Handle<Object> SetValue(Handle<ExternalFloat64Array> array,
5149 uint32_t index, 5135 uint32_t index,
5150 Handle<Object> value); 5136 Handle<Object> value);
5151 5137
5152 // This accessor applies the correct conversion from Smi, HeapNumber
5153 // and undefined.
5154 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
5155
5156 // Casting. 5138 // Casting.
5157 static inline ExternalFloat64Array* cast(Object* obj); 5139 static inline ExternalFloat64Array* cast(Object* obj);
5158 5140
5159 // Dispatched behavior. 5141 // Dispatched behavior.
5160 DECLARE_PRINTER(ExternalFloat64Array) 5142 DECLARE_PRINTER(ExternalFloat64Array)
5161 DECLARE_VERIFIER(ExternalFloat64Array) 5143 DECLARE_VERIFIER(ExternalFloat64Array)
5162 5144
5163 private: 5145 private:
5164 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array); 5146 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloat64Array);
5165 }; 5147 };
(...skipping 5909 matching lines...) Expand 10 before | Expand all | Expand 10 after
11075 } else { 11057 } else {
11076 value &= ~(1 << bit_position); 11058 value &= ~(1 << bit_position);
11077 } 11059 }
11078 return value; 11060 return value;
11079 } 11061 }
11080 }; 11062 };
11081 11063
11082 } } // namespace v8::internal 11064 } } // namespace v8::internal
11083 11065
11084 #endif // V8_OBJECTS_H_ 11066 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698