OLD | NEW |
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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 FORCE_DELETION | 1362 FORCE_DELETION |
1363 }; | 1363 }; |
1364 | 1364 |
1365 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas | 1365 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas |
1366 // a keyed store is of the form a[expression] = foo. | 1366 // a keyed store is of the form a[expression] = foo. |
1367 enum StoreFromKeyed { | 1367 enum StoreFromKeyed { |
1368 MAY_BE_STORE_FROM_KEYED, | 1368 MAY_BE_STORE_FROM_KEYED, |
1369 CERTAINLY_NOT_STORE_FROM_KEYED | 1369 CERTAINLY_NOT_STORE_FROM_KEYED |
1370 }; | 1370 }; |
1371 | 1371 |
| 1372 // Internal properties (e.g. the hidden properties dictionary) might |
| 1373 // be added even though the receiver is non-extensible. |
| 1374 enum ExtensibilityCheck { |
| 1375 PERFORM_EXTENSIBILITY_CHECK, |
| 1376 OMIT_EXTENSIBILITY_CHECK |
| 1377 }; |
| 1378 |
1372 // Casting. | 1379 // Casting. |
1373 static inline JSReceiver* cast(Object* obj); | 1380 static inline JSReceiver* cast(Object* obj); |
1374 | 1381 |
1375 static Handle<Object> SetProperty(Handle<JSReceiver> object, | 1382 static Handle<Object> SetProperty(Handle<JSReceiver> object, |
1376 Handle<String> key, | 1383 Handle<String> key, |
1377 Handle<Object> value, | 1384 Handle<Object> value, |
1378 PropertyAttributes attributes, | 1385 PropertyAttributes attributes, |
1379 StrictModeFlag strict_mode); | 1386 StrictModeFlag strict_mode); |
1380 // Can cause GC. | 1387 // Can cause GC. |
1381 MUST_USE_RESULT MaybeObject* SetProperty( | 1388 MUST_USE_RESULT MaybeObject* SetProperty( |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 StrictModeFlag strict_mode); | 1567 StrictModeFlag strict_mode); |
1561 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( | 1568 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( |
1562 String* name, | 1569 String* name, |
1563 Object* value, | 1570 Object* value, |
1564 PropertyAttributes attributes, | 1571 PropertyAttributes attributes, |
1565 StrictModeFlag strict_mode); | 1572 StrictModeFlag strict_mode); |
1566 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( | 1573 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( |
1567 String* name, | 1574 String* name, |
1568 Object* value, | 1575 Object* value, |
1569 PropertyAttributes attributes, | 1576 PropertyAttributes attributes, |
1570 StrictModeFlag strict_mode); | 1577 StrictModeFlag strict_mode, |
| 1578 ExtensibilityCheck extensibility_check); |
1571 | 1579 |
1572 static Handle<Object> SetLocalPropertyIgnoreAttributes( | 1580 static Handle<Object> SetLocalPropertyIgnoreAttributes( |
1573 Handle<JSObject> object, | 1581 Handle<JSObject> object, |
1574 Handle<String> key, | 1582 Handle<String> key, |
1575 Handle<Object> value, | 1583 Handle<Object> value, |
1576 PropertyAttributes attributes); | 1584 PropertyAttributes attributes); |
1577 | 1585 |
1578 // Can cause GC. | 1586 // Can cause GC. |
1579 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( | 1587 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( |
1580 String* key, | 1588 String* key, |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 MUST_USE_RESULT MaybeObject* AddSlowProperty(String* name, | 1960 MUST_USE_RESULT MaybeObject* AddSlowProperty(String* name, |
1953 Object* value, | 1961 Object* value, |
1954 PropertyAttributes attributes); | 1962 PropertyAttributes attributes); |
1955 | 1963 |
1956 // Add a property to an object. | 1964 // Add a property to an object. |
1957 MUST_USE_RESULT MaybeObject* AddProperty( | 1965 MUST_USE_RESULT MaybeObject* AddProperty( |
1958 String* name, | 1966 String* name, |
1959 Object* value, | 1967 Object* value, |
1960 PropertyAttributes attributes, | 1968 PropertyAttributes attributes, |
1961 StrictModeFlag strict_mode, | 1969 StrictModeFlag strict_mode, |
1962 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 1970 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
| 1971 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); |
1963 | 1972 |
1964 // Convert the object to use the canonical dictionary | 1973 // Convert the object to use the canonical dictionary |
1965 // representation. If the object is expected to have additional properties | 1974 // representation. If the object is expected to have additional properties |
1966 // added this number can be indicated to have the backing store allocated to | 1975 // added this number can be indicated to have the backing store allocated to |
1967 // an initial capacity for holding these properties. | 1976 // an initial capacity for holding these properties. |
1968 static void NormalizeProperties(Handle<JSObject> object, | 1977 static void NormalizeProperties(Handle<JSObject> object, |
1969 PropertyNormalizationMode mode, | 1978 PropertyNormalizationMode mode, |
1970 int expected_additional_properties); | 1979 int expected_additional_properties); |
1971 | 1980 |
1972 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 1981 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
(...skipping 6786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8759 } else { | 8768 } else { |
8760 value &= ~(1 << bit_position); | 8769 value &= ~(1 << bit_position); |
8761 } | 8770 } |
8762 return value; | 8771 return value; |
8763 } | 8772 } |
8764 }; | 8773 }; |
8765 | 8774 |
8766 } } // namespace v8::internal | 8775 } } // namespace v8::internal |
8767 | 8776 |
8768 #endif // V8_OBJECTS_H_ | 8777 #endif // V8_OBJECTS_H_ |
OLD | NEW |