| 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 2468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 StoreMode store_mode); | 2479 StoreMode store_mode); |
| 2480 | 2480 |
| 2481 // Convert the object to use the canonical dictionary | 2481 // Convert the object to use the canonical dictionary |
| 2482 // representation. If the object is expected to have additional properties | 2482 // representation. If the object is expected to have additional properties |
| 2483 // added this number can be indicated to have the backing store allocated to | 2483 // added this number can be indicated to have the backing store allocated to |
| 2484 // an initial capacity for holding these properties. | 2484 // an initial capacity for holding these properties. |
| 2485 static void NormalizeProperties(Handle<JSObject> object, | 2485 static void NormalizeProperties(Handle<JSObject> object, |
| 2486 PropertyNormalizationMode mode, | 2486 PropertyNormalizationMode mode, |
| 2487 int expected_additional_properties); | 2487 int expected_additional_properties); |
| 2488 | 2488 |
| 2489 MUST_USE_RESULT MaybeObject* NormalizeProperties( | |
| 2490 PropertyNormalizationMode mode, | |
| 2491 int expected_additional_properties); | |
| 2492 | |
| 2493 // Convert and update the elements backing store to be a | 2489 // Convert and update the elements backing store to be a |
| 2494 // SeededNumberDictionary dictionary. Returns the backing after conversion. | 2490 // SeededNumberDictionary dictionary. Returns the backing after conversion. |
| 2495 static Handle<SeededNumberDictionary> NormalizeElements( | 2491 static Handle<SeededNumberDictionary> NormalizeElements( |
| 2496 Handle<JSObject> object); | 2492 Handle<JSObject> object); |
| 2497 | 2493 |
| 2498 MUST_USE_RESULT MaybeObject* NormalizeElements(); | 2494 MUST_USE_RESULT MaybeObject* NormalizeElements(); |
| 2499 | 2495 |
| 2500 // Transform slow named properties to fast variants. | 2496 // Transform slow named properties to fast variants. |
| 2501 // Returns failure if allocation failed. | |
| 2502 static void TransformToFastProperties(Handle<JSObject> object, | 2497 static void TransformToFastProperties(Handle<JSObject> object, |
| 2503 int unused_property_fields); | 2498 int unused_property_fields); |
| 2504 | 2499 |
| 2505 MUST_USE_RESULT MaybeObject* TransformToFastProperties( | |
| 2506 int unused_property_fields); | |
| 2507 | |
| 2508 // Access fast-case object properties at index. | 2500 // Access fast-case object properties at index. |
| 2509 MUST_USE_RESULT inline MaybeObject* FastPropertyAt( | 2501 MUST_USE_RESULT inline MaybeObject* FastPropertyAt( |
| 2510 Representation representation, | 2502 Representation representation, |
| 2511 int index); | 2503 int index); |
| 2512 inline Object* RawFastPropertyAt(int index); | 2504 inline Object* RawFastPropertyAt(int index); |
| 2513 inline void FastPropertyAtPut(int index, Object* value); | 2505 inline void FastPropertyAtPut(int index, Object* value); |
| 2514 | 2506 |
| 2515 // Access to in object properties. | 2507 // Access to in object properties. |
| 2516 inline int GetInObjectPropertyOffset(int index); | 2508 inline int GetInObjectPropertyOffset(int index); |
| 2517 inline Object* InObjectPropertyAt(int index); | 2509 inline Object* InObjectPropertyAt(int index); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2530 // pre_allocated_value and the rest with filler_value. | 2522 // pre_allocated_value and the rest with filler_value. |
| 2531 // Note: this call does not update write barrier, the caller is responsible | 2523 // Note: this call does not update write barrier, the caller is responsible |
| 2532 // to ensure that |filler_value| can be collected without WB here. | 2524 // to ensure that |filler_value| can be collected without WB here. |
| 2533 inline void InitializeBody(Map* map, | 2525 inline void InitializeBody(Map* map, |
| 2534 Object* pre_allocated_value, | 2526 Object* pre_allocated_value, |
| 2535 Object* filler_value); | 2527 Object* filler_value); |
| 2536 | 2528 |
| 2537 // Check whether this object references another object | 2529 // Check whether this object references another object |
| 2538 bool ReferencesObject(Object* obj); | 2530 bool ReferencesObject(Object* obj); |
| 2539 | 2531 |
| 2540 // Casting. | |
| 2541 static inline JSObject* cast(Object* obj); | |
| 2542 | |
| 2543 // Disalow further properties to be added to the object. | 2532 // Disalow further properties to be added to the object. |
| 2544 static Handle<Object> PreventExtensions(Handle<JSObject> object); | 2533 static Handle<Object> PreventExtensions(Handle<JSObject> object); |
| 2545 MUST_USE_RESULT MaybeObject* PreventExtensions(); | 2534 MUST_USE_RESULT MaybeObject* PreventExtensions(); |
| 2546 | 2535 |
| 2547 // ES5 Object.freeze | 2536 // ES5 Object.freeze |
| 2548 static Handle<Object> Freeze(Handle<JSObject> object); | 2537 static Handle<Object> Freeze(Handle<JSObject> object); |
| 2549 | 2538 |
| 2550 // Called the first time an object is observed with ES7 Object.observe. | 2539 // Called the first time an object is observed with ES7 Object.observe. |
| 2551 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); | 2540 MUST_USE_RESULT MaybeObject* SetObserved(Isolate* isolate); |
| 2552 | 2541 |
| 2553 // Copy object. | 2542 // Copy object. |
| 2554 static Handle<JSObject> Copy(Handle<JSObject> object); | 2543 static Handle<JSObject> Copy(Handle<JSObject> object); |
| 2555 static Handle<JSObject> DeepCopy(Handle<JSObject> object); | 2544 static Handle<JSObject> DeepCopy(Handle<JSObject> object); |
| 2556 | 2545 |
| 2546 // Casting. |
| 2547 static inline JSObject* cast(Object* obj); |
| 2548 |
| 2557 // Dispatched behavior. | 2549 // Dispatched behavior. |
| 2558 void JSObjectShortPrint(StringStream* accumulator); | 2550 void JSObjectShortPrint(StringStream* accumulator); |
| 2559 DECLARE_PRINTER(JSObject) | 2551 DECLARE_PRINTER(JSObject) |
| 2560 DECLARE_VERIFIER(JSObject) | 2552 DECLARE_VERIFIER(JSObject) |
| 2561 #ifdef OBJECT_PRINT | 2553 #ifdef OBJECT_PRINT |
| 2562 void PrintProperties(FILE* out = stdout); | 2554 void PrintProperties(FILE* out = stdout); |
| 2563 void PrintElements(FILE* out = stdout); | 2555 void PrintElements(FILE* out = stdout); |
| 2564 void PrintTransitions(FILE* out = stdout); | 2556 void PrintTransitions(FILE* out = stdout); |
| 2565 #endif | 2557 #endif |
| 2566 | 2558 |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4224 }; | 4216 }; |
| 4225 | 4217 |
| 4226 | 4218 |
| 4227 // The cache for maps used by normalized (dictionary mode) objects. | 4219 // The cache for maps used by normalized (dictionary mode) objects. |
| 4228 // Such maps do not have property descriptors, so a typical program | 4220 // Such maps do not have property descriptors, so a typical program |
| 4229 // needs very limited number of distinct normalized maps. | 4221 // needs very limited number of distinct normalized maps. |
| 4230 class NormalizedMapCache: public FixedArray { | 4222 class NormalizedMapCache: public FixedArray { |
| 4231 public: | 4223 public: |
| 4232 static const int kEntries = 64; | 4224 static const int kEntries = 64; |
| 4233 | 4225 |
| 4234 MUST_USE_RESULT MaybeObject* Get(JSObject* object, | 4226 static Handle<Map> Get(Handle<NormalizedMapCache> cache, |
| 4235 PropertyNormalizationMode mode); | 4227 Handle<JSObject> object, |
| 4228 PropertyNormalizationMode mode); |
| 4236 | 4229 |
| 4237 void Clear(); | 4230 void Clear(); |
| 4238 | 4231 |
| 4239 // Casting | 4232 // Casting |
| 4240 static inline NormalizedMapCache* cast(Object* obj); | 4233 static inline NormalizedMapCache* cast(Object* obj); |
| 4241 | 4234 |
| 4242 DECLARE_VERIFIER(NormalizedMapCache) | 4235 DECLARE_VERIFIER(NormalizedMapCache) |
| 4243 }; | 4236 }; |
| 4244 | 4237 |
| 4245 | 4238 |
| (...skipping 6004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10250 } else { | 10243 } else { |
| 10251 value &= ~(1 << bit_position); | 10244 value &= ~(1 << bit_position); |
| 10252 } | 10245 } |
| 10253 return value; | 10246 return value; |
| 10254 } | 10247 } |
| 10255 }; | 10248 }; |
| 10256 | 10249 |
| 10257 } } // namespace v8::internal | 10250 } } // namespace v8::internal |
| 10258 | 10251 |
| 10259 #endif // V8_OBJECTS_H_ | 10252 #endif // V8_OBJECTS_H_ |
| OLD | NEW |