Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1087 static inline HeapNumber* cast(Object* obj); | 1087 static inline HeapNumber* cast(Object* obj); |
| 1088 | 1088 |
| 1089 // Dispatched behavior. | 1089 // Dispatched behavior. |
| 1090 Object* HeapNumberToBoolean(); | 1090 Object* HeapNumberToBoolean(); |
| 1091 void HeapNumberPrint(); | 1091 void HeapNumberPrint(); |
| 1092 void HeapNumberPrint(StringStream* accumulator); | 1092 void HeapNumberPrint(StringStream* accumulator); |
| 1093 #ifdef DEBUG | 1093 #ifdef DEBUG |
| 1094 void HeapNumberVerify(); | 1094 void HeapNumberVerify(); |
| 1095 #endif | 1095 #endif |
| 1096 | 1096 |
| 1097 inline int get_exponent(); | |
| 1098 inline int get_sign(); | |
| 1099 | |
| 1097 // Layout description. | 1100 // Layout description. |
| 1098 static const int kValueOffset = HeapObject::kHeaderSize; | 1101 static const int kValueOffset = HeapObject::kHeaderSize; |
| 1099 // IEEE doubles are two 32 bit words. The first is just mantissa, the second | 1102 // IEEE doubles are two 32 bit words. The first is just mantissa, the second |
| 1100 // is a mixture of sign, exponent and mantissa. Our current platforms are all | 1103 // is a mixture of sign, exponent and mantissa. Our current platforms are all |
| 1101 // little endian apart from non-EABI arm which is little endian with big | 1104 // little endian apart from non-EABI arm which is little endian with big |
| 1102 // endian floating point word ordering! | 1105 // endian floating point word ordering! |
| 1103 #if !defined(V8_HOST_ARCH_ARM) || defined(USE_ARM_EABI) | 1106 #if !defined(V8_HOST_ARCH_ARM) || defined(USE_ARM_EABI) |
| 1104 static const int kMantissaOffset = kValueOffset; | 1107 static const int kMantissaOffset = kValueOffset; |
| 1105 static const int kExponentOffset = kValueOffset + 4; | 1108 static const int kExponentOffset = kValueOffset + 4; |
| 1106 #else | 1109 #else |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2131 template <typename Shape, typename Key> | 2134 template <typename Shape, typename Key> |
| 2132 class Dictionary: public HashTable<Shape, Key> { | 2135 class Dictionary: public HashTable<Shape, Key> { |
| 2133 public: | 2136 public: |
| 2134 | 2137 |
| 2135 static inline Dictionary<Shape, Key>* cast(Object* obj) { | 2138 static inline Dictionary<Shape, Key>* cast(Object* obj) { |
| 2136 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); | 2139 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); |
| 2137 } | 2140 } |
| 2138 | 2141 |
| 2139 // Returns the value at entry. | 2142 // Returns the value at entry. |
| 2140 Object* ValueAt(int entry) { | 2143 Object* ValueAt(int entry) { |
| 2141 return get(HashTable<Shape, Key>::EntryToIndex(entry)+1); | 2144 return this->get(HashTable<Shape, Key>::EntryToIndex(entry)+1); |
| 2142 } | 2145 } |
| 2143 | 2146 |
| 2144 // Set the value for entry. | 2147 // Set the value for entry. |
| 2145 void ValueAtPut(int entry, Object* value) { | 2148 void ValueAtPut(int entry, Object* value) { |
| 2146 set(HashTable<Shape, Key>::EntryToIndex(entry)+1, value); | 2149 this->set(HashTable<Shape, Key>::EntryToIndex(entry)+1, value); |
| 2147 } | 2150 } |
| 2148 | 2151 |
| 2149 // Returns the property details for the property at entry. | 2152 // Returns the property details for the property at entry. |
| 2150 PropertyDetails DetailsAt(int entry) { | 2153 PropertyDetails DetailsAt(int entry) { |
| 2151 ASSERT(entry >= 0); // Not found is -1, which is not caught by get(). | 2154 ASSERT(entry >= 0); // Not found is -1, which is not caught by get(). |
| 2152 return PropertyDetails( | 2155 return PropertyDetails( |
| 2153 Smi::cast(get(HashTable<Shape, Key>::EntryToIndex(entry) + 2))); | 2156 Smi::cast(this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 2))); |
| 2154 } | 2157 } |
| 2155 | 2158 |
| 2156 // Set the details for entry. | 2159 // Set the details for entry. |
| 2157 void DetailsAtPut(int entry, PropertyDetails value) { | 2160 void DetailsAtPut(int entry, PropertyDetails value) { |
| 2158 set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi()); | 2161 this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi()); |
| 2159 } | 2162 } |
| 2160 | 2163 |
| 2161 // Sorting support | 2164 // Sorting support |
| 2162 void CopyValuesTo(FixedArray* elements); | 2165 void CopyValuesTo(FixedArray* elements); |
| 2163 | 2166 |
| 2164 // Delete a property from the dictionary. | 2167 // Delete a property from the dictionary. |
| 2165 Object* DeleteProperty(int entry, JSObject::DeleteMode mode); | 2168 Object* DeleteProperty(int entry, JSObject::DeleteMode mode); |
| 2166 | 2169 |
| 2167 // Returns the number of elements in the dictionary filtering out properties | 2170 // Returns the number of elements in the dictionary filtering out properties |
| 2168 // with the specified attributes. | 2171 // with the specified attributes. |
| 2169 int NumberOfElementsFilterAttributes(PropertyAttributes filter); | 2172 int NumberOfElementsFilterAttributes(PropertyAttributes filter); |
| 2170 | 2173 |
| 2171 // Returns the number of enumerable elements in the dictionary. | 2174 // Returns the number of enumerable elements in the dictionary. |
| 2172 int NumberOfEnumElements(); | 2175 int NumberOfEnumElements(); |
| 2173 | 2176 |
| 2174 // Copies keys to preallocated fixed array. | 2177 // Copies keys to preallocated fixed array. |
| 2175 void CopyKeysTo(FixedArray* storage, PropertyAttributes filter); | 2178 void CopyKeysTo(FixedArray* storage, PropertyAttributes filter); |
| 2176 // Fill in details for properties into storage. | 2179 // Fill in details for properties into storage. |
| 2177 void CopyKeysTo(FixedArray* storage); | 2180 void CopyKeysTo(FixedArray* storage); |
| 2178 | 2181 |
| 2179 // Accessors for next enumeration index. | 2182 // Accessors for next enumeration index. |
| 2180 void SetNextEnumerationIndex(int index) { | 2183 void SetNextEnumerationIndex(int index) { |
| 2181 fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); | 2184 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); |
| 2182 } | 2185 } |
| 2183 | 2186 |
| 2184 int NextEnumerationIndex() { | 2187 int NextEnumerationIndex() { |
| 2185 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 2188 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
| 2186 } | 2189 } |
| 2187 | 2190 |
| 2188 // Returns a new array for dictionary usage. Might return Failure. | 2191 // Returns a new array for dictionary usage. Might return Failure. |
| 2189 static Object* Allocate(int at_least_space_for); | 2192 static Object* Allocate(int at_least_space_for); |
| 2190 | 2193 |
| 2191 // Ensure enough space for n additional elements. | 2194 // Ensure enough space for n additional elements. |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3148 // called without using argument adaptor frames. | 3151 // called without using argument adaptor frames. |
| 3149 inline void DontAdaptArguments(); | 3152 inline void DontAdaptArguments(); |
| 3150 | 3153 |
| 3151 // [expected_nof_properties]: Expected number of properties for the function. | 3154 // [expected_nof_properties]: Expected number of properties for the function. |
| 3152 inline int expected_nof_properties(); | 3155 inline int expected_nof_properties(); |
| 3153 inline void set_expected_nof_properties(int value); | 3156 inline void set_expected_nof_properties(int value); |
| 3154 | 3157 |
| 3155 // [instance class name]: class name for instances. | 3158 // [instance class name]: class name for instances. |
| 3156 DECL_ACCESSORS(instance_class_name, Object) | 3159 DECL_ACCESSORS(instance_class_name, Object) |
| 3157 | 3160 |
| 3158 // [function data]: This field has been added for make benefit the API. | 3161 // [function data]: This field holds some additional data for function. |
| 3162 // Currently it either has FunctionTemplateInfo to make benefit the API | |
|
Erik Corry
2010/03/23 10:12:44
Somehow, attempting to fix the Borat quotes isn't
| |
| 3163 // or Proxy wrapping CustomCallGenerator. | |
| 3159 // In the long run we don't want all functions to have this field but | 3164 // In the long run we don't want all functions to have this field but |
| 3160 // we can fix that when we have a better model for storing hidden data | 3165 // we can fix that when we have a better model for storing hidden data |
| 3161 // on objects. | 3166 // on objects. |
| 3162 DECL_ACCESSORS(function_data, Object) | 3167 DECL_ACCESSORS(function_data, Object) |
| 3163 | 3168 |
| 3169 inline bool IsApiFunction(); | |
| 3170 inline FunctionTemplateInfo* get_api_func_data(); | |
| 3171 inline bool HasCustomCallGenerator(); | |
| 3172 | |
| 3164 // [script info]: Script from which the function originates. | 3173 // [script info]: Script from which the function originates. |
| 3165 DECL_ACCESSORS(script, Object) | 3174 DECL_ACCESSORS(script, Object) |
| 3166 | 3175 |
| 3167 // [start_position_and_type]: Field used to store both the source code | 3176 // [start_position_and_type]: Field used to store both the source code |
| 3168 // position, whether or not the function is a function expression, | 3177 // position, whether or not the function is a function expression, |
| 3169 // and whether or not the function is a toplevel function. The two | 3178 // and whether or not the function is a toplevel function. The two |
| 3170 // least significants bit indicates whether the function is an | 3179 // least significants bit indicates whether the function is an |
| 3171 // expression and the rest contains the source code position. | 3180 // expression and the rest contains the source code position. |
| 3172 inline int start_position_and_type(); | 3181 inline int start_position_and_type(); |
| 3173 inline void set_start_position_and_type(int value); | 3182 inline void set_start_position_and_type(int value); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3261 // Constants. | 3270 // Constants. |
| 3262 static const int kDontAdaptArgumentsSentinel = -1; | 3271 static const int kDontAdaptArgumentsSentinel = -1; |
| 3263 | 3272 |
| 3264 // Layout description. | 3273 // Layout description. |
| 3265 // Pointer fields. | 3274 // Pointer fields. |
| 3266 static const int kNameOffset = HeapObject::kHeaderSize; | 3275 static const int kNameOffset = HeapObject::kHeaderSize; |
| 3267 static const int kCodeOffset = kNameOffset + kPointerSize; | 3276 static const int kCodeOffset = kNameOffset + kPointerSize; |
| 3268 static const int kConstructStubOffset = kCodeOffset + kPointerSize; | 3277 static const int kConstructStubOffset = kCodeOffset + kPointerSize; |
| 3269 static const int kInstanceClassNameOffset = | 3278 static const int kInstanceClassNameOffset = |
| 3270 kConstructStubOffset + kPointerSize; | 3279 kConstructStubOffset + kPointerSize; |
| 3271 static const int kExternalReferenceDataOffset = | 3280 static const int kFunctionDataOffset = |
| 3272 kInstanceClassNameOffset + kPointerSize; | 3281 kInstanceClassNameOffset + kPointerSize; |
| 3273 static const int kScriptOffset = kExternalReferenceDataOffset + kPointerSize; | 3282 static const int kScriptOffset = kFunctionDataOffset + kPointerSize; |
| 3274 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; | 3283 static const int kDebugInfoOffset = kScriptOffset + kPointerSize; |
| 3275 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; | 3284 static const int kInferredNameOffset = kDebugInfoOffset + kPointerSize; |
| 3276 static const int kThisPropertyAssignmentsOffset = | 3285 static const int kThisPropertyAssignmentsOffset = |
| 3277 kInferredNameOffset + kPointerSize; | 3286 kInferredNameOffset + kPointerSize; |
| 3278 // Integer fields. | 3287 // Integer fields. |
| 3279 static const int kLengthOffset = | 3288 static const int kLengthOffset = |
| 3280 kThisPropertyAssignmentsOffset + kPointerSize; | 3289 kThisPropertyAssignmentsOffset + kPointerSize; |
| 3281 static const int kFormalParameterCountOffset = kLengthOffset + kIntSize; | 3290 static const int kFormalParameterCountOffset = kLengthOffset + kIntSize; |
| 3282 static const int kExpectedNofPropertiesOffset = | 3291 static const int kExpectedNofPropertiesOffset = |
| 3283 kFormalParameterCountOffset + kIntSize; | 3292 kFormalParameterCountOffset + kIntSize; |
| (...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5052 } else { | 5061 } else { |
| 5053 value &= ~(1 << bit_position); | 5062 value &= ~(1 << bit_position); |
| 5054 } | 5063 } |
| 5055 return value; | 5064 return value; |
| 5056 } | 5065 } |
| 5057 }; | 5066 }; |
| 5058 | 5067 |
| 5059 } } // namespace v8::internal | 5068 } } // namespace v8::internal |
| 5060 | 5069 |
| 5061 #endif // V8_OBJECTS_H_ | 5070 #endif // V8_OBJECTS_H_ |
| OLD | NEW |