OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 StrictModeFlag strict_mode); | 1390 StrictModeFlag strict_mode); |
1391 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, | 1391 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, |
1392 String* key, | 1392 String* key, |
1393 Object* value, | 1393 Object* value, |
1394 PropertyAttributes attributes, | 1394 PropertyAttributes attributes, |
1395 StrictModeFlag strict_mode); | 1395 StrictModeFlag strict_mode); |
1396 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter, | 1396 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter, |
1397 Object* value); | 1397 Object* value); |
1398 | 1398 |
1399 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1399 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
| 1400 MUST_USE_RESULT MaybeObject* DeleteElement(uint32_t index, DeleteMode mode); |
| 1401 |
| 1402 // Set the index'th array element. |
| 1403 // Can cause GC, or return failure if GC is required. |
| 1404 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
| 1405 Object* value, |
| 1406 StrictModeFlag strict_mode, |
| 1407 bool check_prototype); |
1400 | 1408 |
1401 // Returns the class name ([[Class]] property in the specification). | 1409 // Returns the class name ([[Class]] property in the specification). |
1402 String* class_name(); | 1410 String* class_name(); |
1403 | 1411 |
1404 // Returns the constructor name (the name (possibly, inferred name) of the | 1412 // Returns the constructor name (the name (possibly, inferred name) of the |
1405 // function that was used to instantiate the object). | 1413 // function that was used to instantiate the object). |
1406 String* constructor_name(); | 1414 String* constructor_name(); |
1407 | 1415 |
1408 inline PropertyAttributes GetPropertyAttribute(String* name); | 1416 inline PropertyAttributes GetPropertyAttribute(String* name); |
1409 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, | 1417 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, |
1410 String* name); | 1418 String* name); |
1411 PropertyAttributes GetLocalPropertyAttribute(String* name); | 1419 PropertyAttributes GetLocalPropertyAttribute(String* name); |
1412 | 1420 |
1413 // Can cause a GC. | 1421 // Can cause a GC. |
1414 inline bool HasProperty(String* name); | 1422 inline bool HasProperty(String* name); |
1415 inline bool HasLocalProperty(String* name); | 1423 inline bool HasLocalProperty(String* name); |
| 1424 inline bool HasElement(uint32_t index); |
1416 | 1425 |
1417 // Return the object's prototype (might be Heap::null_value()). | 1426 // Return the object's prototype (might be Heap::null_value()). |
1418 inline Object* GetPrototype(); | 1427 inline Object* GetPrototype(); |
1419 | 1428 |
1420 // Set the object's prototype (only JSReceiver and null are allowed). | 1429 // Set the object's prototype (only JSReceiver and null are allowed). |
1421 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, | 1430 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, |
1422 bool skip_hidden_prototypes); | 1431 bool skip_hidden_prototypes); |
1423 | 1432 |
1424 // Lookup a property. If found, the result is valid and has | 1433 // Lookup a property. If found, the result is valid and has |
1425 // detailed information. | 1434 // detailed information. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 // Returns true if the backing storage for the slow-case elements of | 1695 // Returns true if the backing storage for the slow-case elements of |
1687 // this object takes up nearly as much space as a fast-case backing | 1696 // this object takes up nearly as much space as a fast-case backing |
1688 // storage would. In that case the JSObject should have fast | 1697 // storage would. In that case the JSObject should have fast |
1689 // elements. | 1698 // elements. |
1690 bool ShouldConvertToFastElements(); | 1699 bool ShouldConvertToFastElements(); |
1691 // Returns true if the elements of JSObject contains only values that can be | 1700 // Returns true if the elements of JSObject contains only values that can be |
1692 // represented in a FixedDoubleArray. | 1701 // represented in a FixedDoubleArray. |
1693 bool CanConvertToFastDoubleElements(); | 1702 bool CanConvertToFastDoubleElements(); |
1694 | 1703 |
1695 // Tells whether the index'th element is present. | 1704 // Tells whether the index'th element is present. |
1696 inline bool HasElement(uint32_t index); | |
1697 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); | 1705 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); |
1698 | 1706 |
1699 // Computes the new capacity when expanding the elements of a JSObject. | 1707 // Computes the new capacity when expanding the elements of a JSObject. |
1700 static int NewElementsCapacity(int old_capacity) { | 1708 static int NewElementsCapacity(int old_capacity) { |
1701 // (old_capacity + 50%) + 16 | 1709 // (old_capacity + 50%) + 16 |
1702 return old_capacity + (old_capacity >> 1) + 16; | 1710 return old_capacity + (old_capacity >> 1) + 16; |
1703 } | 1711 } |
1704 | 1712 |
1705 // Tells whether the index'th element is present and how it is stored. | 1713 // Tells whether the index'th element is present and how it is stored. |
1706 enum LocalElementType { | 1714 enum LocalElementType { |
(...skipping 4880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6587 // The JSProxy describes EcmaScript Harmony proxies | 6595 // The JSProxy describes EcmaScript Harmony proxies |
6588 class JSProxy: public JSReceiver { | 6596 class JSProxy: public JSReceiver { |
6589 public: | 6597 public: |
6590 // [handler]: The handler property. | 6598 // [handler]: The handler property. |
6591 DECL_ACCESSORS(handler, Object) | 6599 DECL_ACCESSORS(handler, Object) |
6592 | 6600 |
6593 // Casting. | 6601 // Casting. |
6594 static inline JSProxy* cast(Object* obj); | 6602 static inline JSProxy* cast(Object* obj); |
6595 | 6603 |
6596 bool HasPropertyWithHandler(String* name); | 6604 bool HasPropertyWithHandler(String* name); |
| 6605 bool HasElementWithHandler(uint32_t index); |
6597 | 6606 |
6598 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( | 6607 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler( |
6599 Object* receiver, | 6608 Object* receiver, |
6600 String* name); | 6609 String* name); |
6601 MUST_USE_RESULT MaybeObject* GetElementWithHandler( | 6610 MUST_USE_RESULT MaybeObject* GetElementWithHandler( |
6602 Object* receiver, | 6611 Object* receiver, |
6603 uint32_t index); | 6612 uint32_t index); |
6604 | 6613 |
6605 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( | 6614 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( |
6606 String* name, | 6615 String* name, |
6607 Object* value, | 6616 Object* value, |
6608 PropertyAttributes attributes, | 6617 PropertyAttributes attributes, |
6609 StrictModeFlag strict_mode); | 6618 StrictModeFlag strict_mode); |
| 6619 MUST_USE_RESULT MaybeObject* SetElementWithHandler( |
| 6620 uint32_t index, |
| 6621 Object* value, |
| 6622 StrictModeFlag strict_mode); |
| 6623 |
| 6624 // If the handler defines an accessor property, invoke its setter |
| 6625 // (or throw if only a getter exists) and set *found to true. Otherwise false. |
| 6626 MUST_USE_RESULT MaybeObject* SetPropertyWithHandlerIfDefiningSetter( |
| 6627 String* name, |
| 6628 Object* value, |
| 6629 PropertyAttributes attributes, |
| 6630 StrictModeFlag strict_mode, |
| 6631 bool* found); |
6610 | 6632 |
6611 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( | 6633 MUST_USE_RESULT MaybeObject* DeletePropertyWithHandler( |
6612 String* name, | 6634 String* name, |
6613 DeleteMode mode); | 6635 DeleteMode mode); |
| 6636 MUST_USE_RESULT MaybeObject* DeleteElementWithHandler( |
| 6637 uint32_t index, |
| 6638 DeleteMode mode); |
6614 | 6639 |
6615 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( | 6640 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
6616 JSReceiver* receiver, | 6641 JSReceiver* receiver, |
6617 String* name); | 6642 String* name); |
| 6643 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( |
| 6644 JSReceiver* receiver, |
| 6645 uint32_t index); |
6618 | 6646 |
6619 // Turn this into an (empty) JSObject. | 6647 // Turn this into an (empty) JSObject. |
6620 void Fix(); | 6648 void Fix(); |
6621 | 6649 |
6622 // Initializes the body after the handler slot. | 6650 // Initializes the body after the handler slot. |
6623 inline void InitializeBody(int object_size, Object* value); | 6651 inline void InitializeBody(int object_size, Object* value); |
6624 | 6652 |
6625 // Invoke a trap by name. If the trap does not exist on this's handler, | 6653 // Invoke a trap by name. If the trap does not exist on this's handler, |
6626 // but derived_trap is non-NULL, invoke that instead. May cause GC. | 6654 // but derived_trap is non-NULL, invoke that instead. May cause GC. |
6627 Handle<Object> CallTrap(const char* name, | 6655 Handle<Object> CallTrap(const char* name, |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7370 } else { | 7398 } else { |
7371 value &= ~(1 << bit_position); | 7399 value &= ~(1 << bit_position); |
7372 } | 7400 } |
7373 return value; | 7401 return value; |
7374 } | 7402 } |
7375 }; | 7403 }; |
7376 | 7404 |
7377 } } // namespace v8::internal | 7405 } } // namespace v8::internal |
7378 | 7406 |
7379 #endif // V8_OBJECTS_H_ | 7407 #endif // V8_OBJECTS_H_ |
OLD | NEW |