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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 | 1360 |
1361 Object* SetFastElement(uint32_t index, Object* value); | 1361 Object* SetFastElement(uint32_t index, Object* value); |
1362 | 1362 |
1363 // Set the index'th array element. | 1363 // Set the index'th array element. |
1364 // A Failure object is returned if GC is needed. | 1364 // A Failure object is returned if GC is needed. |
1365 Object* SetElement(uint32_t index, Object* value); | 1365 Object* SetElement(uint32_t index, Object* value); |
1366 | 1366 |
1367 // Returns the index'th element. | 1367 // Returns the index'th element. |
1368 // The undefined object if index is out of bounds. | 1368 // The undefined object if index is out of bounds. |
1369 Object* GetElementWithReceiver(JSObject* receiver, uint32_t index); | 1369 Object* GetElementWithReceiver(JSObject* receiver, uint32_t index); |
| 1370 Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index); |
1370 | 1371 |
1371 Object* SetFastElementsCapacityAndLength(int capacity, int length); | 1372 Object* SetFastElementsCapacityAndLength(int capacity, int length); |
1372 Object* SetSlowElements(Object* length); | 1373 Object* SetSlowElements(Object* length); |
1373 | 1374 |
1374 // Lookup interceptors are used for handling properties controlled by host | 1375 // Lookup interceptors are used for handling properties controlled by host |
1375 // objects. | 1376 // objects. |
1376 inline bool HasNamedInterceptor(); | 1377 inline bool HasNamedInterceptor(); |
1377 inline bool HasIndexedInterceptor(); | 1378 inline bool HasIndexedInterceptor(); |
1378 | 1379 |
1379 // Support functions for v8 api (needed for correct interceptor behavior). | 1380 // Support functions for v8 api (needed for correct interceptor behavior). |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 int number_of_fast_used_elements_; | 1541 int number_of_fast_used_elements_; |
1541 int number_of_fast_unused_elements_; | 1542 int number_of_fast_unused_elements_; |
1542 int number_of_slow_used_elements_; | 1543 int number_of_slow_used_elements_; |
1543 int number_of_slow_unused_elements_; | 1544 int number_of_slow_unused_elements_; |
1544 }; | 1545 }; |
1545 | 1546 |
1546 void IncrementSpillStatistics(SpillInformation* info); | 1547 void IncrementSpillStatistics(SpillInformation* info); |
1547 #endif | 1548 #endif |
1548 Object* SlowReverseLookup(Object* value); | 1549 Object* SlowReverseLookup(Object* value); |
1549 | 1550 |
| 1551 // Maximal number of fast properties for the JSObject. Used to |
| 1552 // restrict the number of map transitions to avoid an explosion in |
| 1553 // the number of maps for objects used as dictionaries. |
| 1554 inline int MaxFastProperties(); |
| 1555 |
1550 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 1556 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
1551 // Also maximal value of JSArray's length property. | 1557 // Also maximal value of JSArray's length property. |
1552 static const uint32_t kMaxElementCount = 0xffffffffu; | 1558 static const uint32_t kMaxElementCount = 0xffffffffu; |
1553 | 1559 |
1554 static const uint32_t kMaxGap = 1024; | 1560 static const uint32_t kMaxGap = 1024; |
1555 static const int kMaxFastElementsLength = 5000; | 1561 static const int kMaxFastElementsLength = 5000; |
1556 static const int kInitialMaxFastElementArray = 100000; | 1562 static const int kInitialMaxFastElementArray = 100000; |
1557 static const int kMaxFastProperties = 8; | 1563 static const int kMaxFastProperties = 8; |
1558 static const int kMaxInstanceSize = 255 * kPointerSize; | 1564 static const int kMaxInstanceSize = 255 * kPointerSize; |
1559 // When extending the backing storage for property values, we increase | 1565 // When extending the backing storage for property values, we increase |
1560 // its size by more than the 1 entry necessary, so sequentially adding fields | 1566 // its size by more than the 1 entry necessary, so sequentially adding fields |
1561 // to the same object requires fewer allocations and copies. | 1567 // to the same object requires fewer allocations and copies. |
1562 static const int kFieldsAdded = 3; | 1568 static const int kFieldsAdded = 3; |
1563 | 1569 |
1564 // Layout description. | 1570 // Layout description. |
1565 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 1571 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
1566 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 1572 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
1567 static const int kHeaderSize = kElementsOffset + kPointerSize; | 1573 static const int kHeaderSize = kElementsOffset + kPointerSize; |
1568 | 1574 |
1569 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); | 1575 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); |
1570 | 1576 |
1571 Object* GetElementWithInterceptor(JSObject* receiver, uint32_t index); | |
1572 | |
1573 private: | 1577 private: |
1574 Object* GetElementWithCallback(Object* receiver, | 1578 Object* GetElementWithCallback(Object* receiver, |
1575 Object* structure, | 1579 Object* structure, |
1576 uint32_t index, | 1580 uint32_t index, |
1577 Object* holder); | 1581 Object* holder); |
1578 Object* SetElementWithCallback(Object* structure, | 1582 Object* SetElementWithCallback(Object* structure, |
1579 uint32_t index, | 1583 uint32_t index, |
1580 Object* value, | 1584 Object* value, |
1581 JSObject* holder); | 1585 JSObject* holder); |
1582 Object* SetElementWithInterceptor(uint32_t index, Object* value); | 1586 Object* SetElementWithInterceptor(uint32_t index, Object* value); |
(...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5334 } else { | 5338 } else { |
5335 value &= ~(1 << bit_position); | 5339 value &= ~(1 << bit_position); |
5336 } | 5340 } |
5337 return value; | 5341 return value; |
5338 } | 5342 } |
5339 }; | 5343 }; |
5340 | 5344 |
5341 } } // namespace v8::internal | 5345 } } // namespace v8::internal |
5342 | 5346 |
5343 #endif // V8_OBJECTS_H_ | 5347 #endif // V8_OBJECTS_H_ |
OLD | NEW |