| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1439 | 1439 |
| 1440 // Element with given index is stored in slow backing store. | 1440 // Element with given index is stored in slow backing store. |
| 1441 DICTIONARY_ELEMENT | 1441 DICTIONARY_ELEMENT |
| 1442 }; | 1442 }; |
| 1443 | 1443 |
| 1444 LocalElementType HasLocalElement(uint32_t index); | 1444 LocalElementType HasLocalElement(uint32_t index); |
| 1445 | 1445 |
| 1446 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index); | 1446 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index); |
| 1447 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index); | 1447 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index); |
| 1448 | 1448 |
| 1449 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, Object* value); | 1449 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, |
| 1450 Object* value, |
| 1451 bool check_prototype = true); |
| 1450 | 1452 |
| 1451 // Set the index'th array element. | 1453 // Set the index'th array element. |
| 1452 // A Failure object is returned if GC is needed. | 1454 // A Failure object is returned if GC is needed. |
| 1453 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, Object* value); | 1455 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
| 1456 Object* value, |
| 1457 bool check_prototype = true); |
| 1454 | 1458 |
| 1455 // Returns the index'th element. | 1459 // Returns the index'th element. |
| 1456 // The undefined object if index is out of bounds. | 1460 // The undefined object if index is out of bounds. |
| 1457 MaybeObject* GetElementWithReceiver(JSObject* receiver, uint32_t index); | 1461 MaybeObject* GetElementWithReceiver(JSObject* receiver, uint32_t index); |
| 1458 MaybeObject* GetElementWithInterceptor(JSObject* receiver, uint32_t index); | 1462 MaybeObject* GetElementWithInterceptor(JSObject* receiver, uint32_t index); |
| 1459 | 1463 |
| 1460 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, | 1464 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, |
| 1461 int length); | 1465 int length); |
| 1462 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); | 1466 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); |
| 1463 | 1467 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1697 private: | 1701 private: |
| 1698 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 1702 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
| 1699 Object* structure, | 1703 Object* structure, |
| 1700 uint32_t index, | 1704 uint32_t index, |
| 1701 Object* holder); | 1705 Object* holder); |
| 1702 MaybeObject* SetElementWithCallback(Object* structure, | 1706 MaybeObject* SetElementWithCallback(Object* structure, |
| 1703 uint32_t index, | 1707 uint32_t index, |
| 1704 Object* value, | 1708 Object* value, |
| 1705 JSObject* holder); | 1709 JSObject* holder); |
| 1706 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(uint32_t index, | 1710 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(uint32_t index, |
| 1707 Object* value); | 1711 Object* value, |
| 1708 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor(uint32_t index, | 1712 bool check_prototype); |
| 1709 Object* value); | 1713 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( |
| 1714 uint32_t index, |
| 1715 Object* value, |
| 1716 bool check_prototype); |
| 1710 | 1717 |
| 1711 MaybeObject* GetElementPostInterceptor(JSObject* receiver, uint32_t index); | 1718 MaybeObject* GetElementPostInterceptor(JSObject* receiver, uint32_t index); |
| 1712 | 1719 |
| 1713 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, | 1720 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, |
| 1714 DeleteMode mode); | 1721 DeleteMode mode); |
| 1715 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); | 1722 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); |
| 1716 | 1723 |
| 1717 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, | 1724 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, |
| 1718 DeleteMode mode); | 1725 DeleteMode mode); |
| 1719 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); | 1726 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 // | 2268 // |
| 2262 // No special elements in the prefix and the element size is 1 | 2269 // No special elements in the prefix and the element size is 1 |
| 2263 // because only the symbol itself (the key) needs to be stored. | 2270 // because only the symbol itself (the key) needs to be stored. |
| 2264 class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> { | 2271 class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> { |
| 2265 public: | 2272 public: |
| 2266 // Find symbol in the symbol table. If it is not there yet, it is | 2273 // Find symbol in the symbol table. If it is not there yet, it is |
| 2267 // added. The return value is the symbol table which might have | 2274 // added. The return value is the symbol table which might have |
| 2268 // been enlarged. If the return value is not a failure, the symbol | 2275 // been enlarged. If the return value is not a failure, the symbol |
| 2269 // pointer *s is set to the symbol found. | 2276 // pointer *s is set to the symbol found. |
| 2270 MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str, Object** s); | 2277 MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str, Object** s); |
| 2278 MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str, |
| 2279 Object** s); |
| 2280 MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str, |
| 2281 Object** s); |
| 2271 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); | 2282 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); |
| 2272 | 2283 |
| 2273 // Looks up a symbol that is equal to the given string and returns | 2284 // Looks up a symbol that is equal to the given string and returns |
| 2274 // true if it is found, assigning the symbol to the given output | 2285 // true if it is found, assigning the symbol to the given output |
| 2275 // parameter. | 2286 // parameter. |
| 2276 bool LookupSymbolIfExists(String* str, String** symbol); | 2287 bool LookupSymbolIfExists(String* str, String** symbol); |
| 2277 bool LookupTwoCharsSymbolIfExists(uint32_t c1, uint32_t c2, String** symbol); | 2288 bool LookupTwoCharsSymbolIfExists(uint32_t c1, uint32_t c2, String** symbol); |
| 2278 | 2289 |
| 2279 // Casting. | 2290 // Casting. |
| 2280 static inline SymbolTable* cast(Object* obj); | 2291 static inline SymbolTable* cast(Object* obj); |
| (...skipping 2727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5008 bool MarkAsUndetectable(); | 5019 bool MarkAsUndetectable(); |
| 5009 | 5020 |
| 5010 // Return a substring. | 5021 // Return a substring. |
| 5011 MUST_USE_RESULT MaybeObject* SubString(int from, | 5022 MUST_USE_RESULT MaybeObject* SubString(int from, |
| 5012 int to, | 5023 int to, |
| 5013 PretenureFlag pretenure = NOT_TENURED); | 5024 PretenureFlag pretenure = NOT_TENURED); |
| 5014 | 5025 |
| 5015 // String equality operations. | 5026 // String equality operations. |
| 5016 inline bool Equals(String* other); | 5027 inline bool Equals(String* other); |
| 5017 bool IsEqualTo(Vector<const char> str); | 5028 bool IsEqualTo(Vector<const char> str); |
| 5029 bool IsAsciiEqualTo(Vector<const char> str); |
| 5030 bool IsTwoByteEqualTo(Vector<const uc16> str); |
| 5018 | 5031 |
| 5019 // Return a UTF8 representation of the string. The string is null | 5032 // Return a UTF8 representation of the string. The string is null |
| 5020 // terminated but may optionally contain nulls. Length is returned | 5033 // terminated but may optionally contain nulls. Length is returned |
| 5021 // in length_output if length_output is not a null pointer The string | 5034 // in length_output if length_output is not a null pointer The string |
| 5022 // should be nearly flat, otherwise the performance of this method may | 5035 // should be nearly flat, otherwise the performance of this method may |
| 5023 // be very slow (quadratic in the length). Setting robustness_flag to | 5036 // be very slow (quadratic in the length). Setting robustness_flag to |
| 5024 // ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it | 5037 // ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it |
| 5025 // handles unexpected data without causing assert failures and it does not | 5038 // handles unexpected data without causing assert failures and it does not |
| 5026 // do any heap allocations. This is useful when printing stack traces. | 5039 // do any heap allocations. This is useful when printing stack traces. |
| 5027 SmartPointer<char> ToCString(AllowNullsFlag allow_nulls, | 5040 SmartPointer<char> ToCString(AllowNullsFlag allow_nulls, |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5179 unsigned* remaining, | 5192 unsigned* remaining, |
| 5180 unsigned* offset); | 5193 unsigned* offset); |
| 5181 | 5194 |
| 5182 // Helper function for flattening strings. | 5195 // Helper function for flattening strings. |
| 5183 template <typename sinkchar> | 5196 template <typename sinkchar> |
| 5184 static void WriteToFlat(String* source, | 5197 static void WriteToFlat(String* source, |
| 5185 sinkchar* sink, | 5198 sinkchar* sink, |
| 5186 int from, | 5199 int from, |
| 5187 int to); | 5200 int to); |
| 5188 | 5201 |
| 5202 static inline bool IsAscii(const char* chars, int length) { |
| 5203 const char* limit = chars + length; |
| 5204 #ifdef V8_HOST_CAN_READ_UNALIGNED |
| 5205 ASSERT(kMaxAsciiCharCode == 0x7F); |
| 5206 const uintptr_t non_ascii_mask = kUintptrAllBitsSet / 0xFF * 0x80; |
| 5207 while (chars <= limit - sizeof(uintptr_t)) { |
| 5208 if (*reinterpret_cast<const uintptr_t*>(chars) & non_ascii_mask) { |
| 5209 return false; |
| 5210 } |
| 5211 chars += sizeof(uintptr_t); |
| 5212 } |
| 5213 #endif |
| 5214 while (chars < limit) { |
| 5215 if (static_cast<uint8_t>(*chars) > kMaxAsciiCharCodeU) return false; |
| 5216 ++chars; |
| 5217 } |
| 5218 return true; |
| 5219 } |
| 5220 |
| 5221 static inline bool IsAscii(const uc16* chars, int length) { |
| 5222 const uc16* limit = chars + length; |
| 5223 while (chars < limit) { |
| 5224 if (*chars > kMaxAsciiCharCodeU) return false; |
| 5225 ++chars; |
| 5226 } |
| 5227 return true; |
| 5228 } |
| 5229 |
| 5189 protected: | 5230 protected: |
| 5190 class ReadBlockBuffer { | 5231 class ReadBlockBuffer { |
| 5191 public: | 5232 public: |
| 5192 ReadBlockBuffer(unibrow::byte* util_buffer_, | 5233 ReadBlockBuffer(unibrow::byte* util_buffer_, |
| 5193 unsigned cursor_, | 5234 unsigned cursor_, |
| 5194 unsigned capacity_, | 5235 unsigned capacity_, |
| 5195 unsigned remaining_) : | 5236 unsigned remaining_) : |
| 5196 util_buffer(util_buffer_), | 5237 util_buffer(util_buffer_), |
| 5197 cursor(cursor_), | 5238 cursor(cursor_), |
| 5198 capacity(capacity_), | 5239 capacity(capacity_), |
| (...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6289 } else { | 6330 } else { |
| 6290 value &= ~(1 << bit_position); | 6331 value &= ~(1 << bit_position); |
| 6291 } | 6332 } |
| 6292 return value; | 6333 return value; |
| 6293 } | 6334 } |
| 6294 }; | 6335 }; |
| 6295 | 6336 |
| 6296 } } // namespace v8::internal | 6337 } } // namespace v8::internal |
| 6297 | 6338 |
| 6298 #endif // V8_OBJECTS_H_ | 6339 #endif // V8_OBJECTS_H_ |
| OLD | NEW |