Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: src/objects.h

Issue 2127583002: [runtime] Better encapsulation of dictionary objects handling in lookup iterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/assert-scope.h" 10 #include "src/assert-scope.h"
(...skipping 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 friend class JSReceiver; 2472 friend class JSReceiver;
2473 friend class Object; 2473 friend class Object;
2474 2474
2475 // Used from Object::GetProperty(). 2475 // Used from Object::GetProperty().
2476 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( 2476 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck(
2477 LookupIterator* it); 2477 LookupIterator* it);
2478 2478
2479 MUST_USE_RESULT static Maybe<bool> SetPropertyWithFailedAccessCheck( 2479 MUST_USE_RESULT static Maybe<bool> SetPropertyWithFailedAccessCheck(
2480 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw); 2480 LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
2481 2481
2482 // Add a property to a slow-case object.
2483 static void AddSlowProperty(Handle<JSObject> object,
2484 Handle<Name> name,
2485 Handle<Object> value,
2486 PropertyAttributes attributes);
2487
2488 MUST_USE_RESULT static Maybe<bool> DeletePropertyWithInterceptor( 2482 MUST_USE_RESULT static Maybe<bool> DeletePropertyWithInterceptor(
2489 LookupIterator* it, ShouldThrow should_throw); 2483 LookupIterator* it, ShouldThrow should_throw);
2490 2484
2491 bool ReferencesObjectFromElements(FixedArray* elements, 2485 bool ReferencesObjectFromElements(FixedArray* elements,
2492 ElementsKind kind, 2486 ElementsKind kind,
2493 Object* object); 2487 Object* object);
2494 2488
2495 static Object* GetIdentityHash(Isolate* isolate, Handle<JSObject> object); 2489 static Object* GetIdentityHash(Isolate* isolate, Handle<JSObject> object);
2496 2490
2497 static Smi* GetOrCreateIdentityHash(Isolate* isolate, 2491 static Smi* GetOrCreateIdentityHash(Isolate* isolate,
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
3507 3501
3508 // Sets the entry to (key, value) pair. 3502 // Sets the entry to (key, value) pair.
3509 inline void SetEntry(int entry, 3503 inline void SetEntry(int entry,
3510 Handle<Object> key, 3504 Handle<Object> key,
3511 Handle<Object> value); 3505 Handle<Object> value);
3512 inline void SetEntry(int entry, 3506 inline void SetEntry(int entry,
3513 Handle<Object> key, 3507 Handle<Object> key,
3514 Handle<Object> value, 3508 Handle<Object> value,
3515 PropertyDetails details); 3509 PropertyDetails details);
3516 3510
3517 MUST_USE_RESULT static Handle<Derived> Add( 3511 MUST_USE_RESULT static Handle<Derived> Add(Handle<Derived> dictionary,
3518 Handle<Derived> dictionary, 3512 Key key, Handle<Object> value,
3519 Key key, 3513 PropertyDetails details,
3520 Handle<Object> value, 3514 int* entry_out = nullptr);
3521 PropertyDetails details);
3522 3515
3523 // Returns iteration indices array for the |dictionary|. 3516 // Returns iteration indices array for the |dictionary|.
3524 // Values are direct indices in the |HashTable| array. 3517 // Values are direct indices in the |HashTable| array.
3525 static Handle<FixedArray> BuildIterationIndicesArray( 3518 static Handle<FixedArray> BuildIterationIndicesArray(
3526 Handle<Derived> dictionary); 3519 Handle<Derived> dictionary);
3527 3520
3528 protected: 3521 protected:
3529 // Generic at put operation. 3522 // Generic at put operation.
3530 MUST_USE_RESULT static Handle<Derived> AtPut( 3523 MUST_USE_RESULT static Handle<Derived> AtPut(
3531 Handle<Derived> dictionary, 3524 Handle<Derived> dictionary,
3532 Key key, 3525 Key key,
3533 Handle<Object> value); 3526 Handle<Object> value);
3534 3527
3535 // Add entry to dictionary. 3528 // Add entry to dictionary. Returns entry value.
3536 static void AddEntry( 3529 static int AddEntry(Handle<Derived> dictionary, Key key, Handle<Object> value,
3537 Handle<Derived> dictionary, 3530 PropertyDetails details, uint32_t hash);
3538 Key key,
3539 Handle<Object> value,
3540 PropertyDetails details,
3541 uint32_t hash);
3542 3531
3543 // Generate new enumeration indices to avoid enumeration index overflow. 3532 // Generate new enumeration indices to avoid enumeration index overflow.
3544 // Returns iteration indices array for the |dictionary|. 3533 // Returns iteration indices array for the |dictionary|.
3545 static Handle<FixedArray> GenerateNewEnumerationIndices( 3534 static Handle<FixedArray> GenerateNewEnumerationIndices(
3546 Handle<Derived> dictionary); 3535 Handle<Derived> dictionary);
3547 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex; 3536 static const int kMaxNumberKeyIndex = DerivedHashTable::kPrefixStartIndex;
3548 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1; 3537 static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
3549 }; 3538 };
3550 3539
3551 3540
(...skipping 4270 matching lines...) Expand 10 before | Expand all | Expand 10 after
7822 // [native context]: the natives corresponding to this global object. 7811 // [native context]: the natives corresponding to this global object.
7823 DECL_ACCESSORS(native_context, Context) 7812 DECL_ACCESSORS(native_context, Context)
7824 7813
7825 // [global proxy]: the global proxy object of the context 7814 // [global proxy]: the global proxy object of the context
7826 DECL_ACCESSORS(global_proxy, JSObject) 7815 DECL_ACCESSORS(global_proxy, JSObject)
7827 7816
7828 7817
7829 static void InvalidatePropertyCell(Handle<JSGlobalObject> object, 7818 static void InvalidatePropertyCell(Handle<JSGlobalObject> object,
7830 Handle<Name> name); 7819 Handle<Name> name);
7831 // Ensure that the global object has a cell for the given property name. 7820 // Ensure that the global object has a cell for the given property name.
7832 static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global, 7821 static Handle<PropertyCell> EnsureEmptyPropertyCell(
7833 Handle<Name> name); 7822 Handle<JSGlobalObject> global, Handle<Name> name,
7823 PropertyCellType cell_type, int* entry_out = nullptr);
7834 7824
7835 DECLARE_CAST(JSGlobalObject) 7825 DECLARE_CAST(JSGlobalObject)
7836 7826
7837 inline bool IsDetached(); 7827 inline bool IsDetached();
7838 7828
7839 // Dispatched behavior. 7829 // Dispatched behavior.
7840 DECLARE_PRINTER(JSGlobalObject) 7830 DECLARE_PRINTER(JSGlobalObject)
7841 DECLARE_VERIFIER(JSGlobalObject) 7831 DECLARE_VERIFIER(JSGlobalObject)
7842 7832
7843 // Layout description. 7833 // Layout description.
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
9673 inline PropertyDetails property_details(); 9663 inline PropertyDetails property_details();
9674 inline void set_property_details(PropertyDetails details); 9664 inline void set_property_details(PropertyDetails details);
9675 9665
9676 PropertyCellConstantType GetConstantType(); 9666 PropertyCellConstantType GetConstantType();
9677 9667
9678 // Computes the new type of the cell's contents for the given value, but 9668 // Computes the new type of the cell's contents for the given value, but
9679 // without actually modifying the details. 9669 // without actually modifying the details.
9680 static PropertyCellType UpdatedType(Handle<PropertyCell> cell, 9670 static PropertyCellType UpdatedType(Handle<PropertyCell> cell,
9681 Handle<Object> value, 9671 Handle<Object> value,
9682 PropertyDetails details); 9672 PropertyDetails details);
9683 static void UpdateCell(Handle<GlobalDictionary> dictionary, int entry, 9673 // Prepares property cell at given entry for receiving given value.
9684 Handle<Object> value, PropertyDetails details); 9674 // As a result the old cell could be invalidated and/or dependent code could
9675 // be deoptimized. Returns the prepared property cell.
9676 static Handle<PropertyCell> PrepareForValue(
9677 Handle<GlobalDictionary> dictionary, int entry, Handle<Object> value,
9678 PropertyDetails details);
9685 9679
9686 static Handle<PropertyCell> InvalidateEntry( 9680 static Handle<PropertyCell> InvalidateEntry(
9687 Handle<GlobalDictionary> dictionary, int entry); 9681 Handle<GlobalDictionary> dictionary, int entry);
9688 9682
9689 static void SetValueWithInvalidation(Handle<PropertyCell> cell, 9683 static void SetValueWithInvalidation(Handle<PropertyCell> cell,
9690 Handle<Object> new_value); 9684 Handle<Object> new_value);
9691 9685
9692 DECLARE_CAST(PropertyCell) 9686 DECLARE_CAST(PropertyCell)
9693 9687
9694 // Dispatched behavior. 9688 // Dispatched behavior.
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
10922 } 10916 }
10923 return value; 10917 return value;
10924 } 10918 }
10925 }; 10919 };
10926 10920
10927 10921
10928 } // NOLINT, false-positive due to second-order macros. 10922 } // NOLINT, false-positive due to second-order macros.
10929 } // NOLINT, false-positive due to second-order macros. 10923 } // NOLINT, false-positive due to second-order macros.
10930 10924
10931 #endif // V8_OBJECTS_H_ 10925 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698