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

Side by Side Diff: src/objects.h

Issue 468493002: Rewriting SetOwnPropertyIgnoreAttributes using the LookupIterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assert-scope.h" 9 #include "src/assert-scope.h"
10 #include "src/builtins.h" 10 #include "src/builtins.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 241
242 // PropertyNormalizationMode is used to specify whether to keep 242 // PropertyNormalizationMode is used to specify whether to keep
243 // inobject properties when normalizing properties of a JSObject. 243 // inobject properties when normalizing properties of a JSObject.
244 enum PropertyNormalizationMode { 244 enum PropertyNormalizationMode {
245 CLEAR_INOBJECT_PROPERTIES, 245 CLEAR_INOBJECT_PROPERTIES,
246 KEEP_INOBJECT_PROPERTIES 246 KEEP_INOBJECT_PROPERTIES
247 }; 247 };
248 248
249 249
250 // Internal properties (e.g. the hidden properties dictionary) might
251 // be added even though the receiver is non-extensible.
252 enum ExtensibilityCheck {
253 PERFORM_EXTENSIBILITY_CHECK,
254 OMIT_EXTENSIBILITY_CHECK
255 };
256
257
250 // Indicates how aggressively the prototype should be optimized. FAST_PROTOTYPE 258 // Indicates how aggressively the prototype should be optimized. FAST_PROTOTYPE
251 // will give the fastest result by tailoring the map to the prototype, but that 259 // will give the fastest result by tailoring the map to the prototype, but that
252 // will cause polymorphism with other objects. REGULAR_PROTOTYPE is to be used 260 // will cause polymorphism with other objects. REGULAR_PROTOTYPE is to be used
253 // (at least for now) when dynamically modifying the prototype chain of an 261 // (at least for now) when dynamically modifying the prototype chain of an
254 // object using __proto__ or Object.setPrototypeOf. 262 // object using __proto__ or Object.setPrototypeOf.
255 enum PrototypeOptimizationMode { REGULAR_PROTOTYPE, FAST_PROTOTYPE }; 263 enum PrototypeOptimizationMode { REGULAR_PROTOTYPE, FAST_PROTOTYPE };
256 264
257 265
258 // Indicates whether transitions can be added to a source map or not. 266 // Indicates whether transitions can be added to a source map or not.
259 enum TransitionFlag { 267 enum TransitionFlag {
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 1504
1497 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( 1505 MUST_USE_RESULT static MaybeHandle<Object> SetProperty(
1498 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, 1506 LookupIterator* it, Handle<Object> value, StrictMode strict_mode,
1499 StoreFromKeyed store_mode); 1507 StoreFromKeyed store_mode);
1500 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( 1508 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty(
1501 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); 1509 LookupIterator* it, Handle<Object> value, StrictMode strict_mode);
1502 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( 1510 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty(
1503 LookupIterator* it, Handle<Object> value); 1511 LookupIterator* it, Handle<Object> value);
1504 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( 1512 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty(
1505 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, 1513 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
1506 StrictMode strict_mode, StoreFromKeyed store_mode); 1514 StrictMode strict_mode, StoreFromKeyed store_mode,
1515 ExtensibilityCheck check);
1507 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( 1516 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
1508 Handle<Object> object, 1517 Handle<Object> object,
1509 Handle<Name> key); 1518 Handle<Name> key);
1510 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( 1519 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty(
1511 Isolate* isolate, 1520 Isolate* isolate,
1512 Handle<Object> object, 1521 Handle<Object> object,
1513 const char* key); 1522 const char* key);
1514 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( 1523 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty(
1515 Handle<Object> object, 1524 Handle<Object> object,
1516 Handle<Name> key); 1525 Handle<Name> key);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1940 // JSReceiver includes types on which properties can be defined, i.e., 1949 // JSReceiver includes types on which properties can be defined, i.e.,
1941 // JSObject and JSProxy. 1950 // JSObject and JSProxy.
1942 class JSReceiver: public HeapObject { 1951 class JSReceiver: public HeapObject {
1943 public: 1952 public:
1944 enum DeleteMode { 1953 enum DeleteMode {
1945 NORMAL_DELETION, 1954 NORMAL_DELETION,
1946 STRICT_DELETION, 1955 STRICT_DELETION,
1947 FORCE_DELETION 1956 FORCE_DELETION
1948 }; 1957 };
1949 1958
1950 // Internal properties (e.g. the hidden properties dictionary) might
1951 // be added even though the receiver is non-extensible.
1952 enum ExtensibilityCheck {
1953 PERFORM_EXTENSIBILITY_CHECK,
1954 OMIT_EXTENSIBILITY_CHECK
1955 };
1956
1957 DECLARE_CAST(JSReceiver) 1959 DECLARE_CAST(JSReceiver)
1958 1960
1959 MUST_USE_RESULT static MaybeHandle<Object> SetElement( 1961 MUST_USE_RESULT static MaybeHandle<Object> SetElement(
1960 Handle<JSReceiver> object, 1962 Handle<JSReceiver> object,
1961 uint32_t index, 1963 uint32_t index,
1962 Handle<Object> value, 1964 Handle<Object> value,
1963 PropertyAttributes attributes, 1965 PropertyAttributes attributes,
1964 StrictMode strict_mode); 1966 StrictMode strict_mode);
1965 1967
1966 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6. 1968 // Implementation of [[HasProperty]], ECMA-262 5th edition, section 8.12.6.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 // Migrates the given object only if the target map is already available, 2178 // Migrates the given object only if the target map is already available,
2177 // or returns false if such a map is not yet available. 2179 // or returns false if such a map is not yet available.
2178 static bool TryMigrateInstance(Handle<JSObject> instance); 2180 static bool TryMigrateInstance(Handle<JSObject> instance);
2179 2181
2180 // Retrieve a value in a normalized object given a lookup result. 2182 // Retrieve a value in a normalized object given a lookup result.
2181 // Handles the special representation of JS global objects. 2183 // Handles the special representation of JS global objects.
2182 Object* GetNormalizedProperty(const LookupResult* result); 2184 Object* GetNormalizedProperty(const LookupResult* result);
2183 static Handle<Object> GetNormalizedProperty(Handle<JSObject> object, 2185 static Handle<Object> GetNormalizedProperty(Handle<JSObject> object,
2184 const LookupResult* result); 2186 const LookupResult* result);
2185 2187
2186 // Sets the property value in a normalized object given a lookup result.
2187 // Handles the special representation of JS global objects.
2188 static void SetNormalizedProperty(Handle<JSObject> object,
2189 const LookupResult* result,
2190 Handle<Object> value);
2191
2192 // Sets the property value in a normalized object given (key, value, details). 2188 // Sets the property value in a normalized object given (key, value, details).
2193 // Handles the special representation of JS global objects. 2189 // Handles the special representation of JS global objects.
2194 static void SetNormalizedProperty(Handle<JSObject> object, 2190 static void SetNormalizedProperty(Handle<JSObject> object,
2195 Handle<Name> key, 2191 Handle<Name> key,
2196 Handle<Object> value, 2192 Handle<Object> value,
2197 PropertyDetails details); 2193 PropertyDetails details);
2198 2194
2199 static void OptimizeAsPrototype(Handle<JSObject> object, 2195 static void OptimizeAsPrototype(Handle<JSObject> object,
2200 PrototypeOptimizationMode mode); 2196 PrototypeOptimizationMode mode);
2201 static void ReoptimizeIfPrototype(Handle<JSObject> object); 2197 static void ReoptimizeIfPrototype(Handle<JSObject> object);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 private: 2621 private:
2626 friend class DictionaryElementsAccessor; 2622 friend class DictionaryElementsAccessor;
2627 friend class JSReceiver; 2623 friend class JSReceiver;
2628 friend class Object; 2624 friend class Object;
2629 2625
2630 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map); 2626 static void MigrateFastToFast(Handle<JSObject> object, Handle<Map> new_map);
2631 static void MigrateFastToSlow(Handle<JSObject> object, 2627 static void MigrateFastToSlow(Handle<JSObject> object,
2632 Handle<Map> new_map, 2628 Handle<Map> new_map,
2633 int expected_additional_properties); 2629 int expected_additional_properties);
2634 2630
2635 static void SetPropertyToField(LookupResult* lookup, Handle<Object> value);
2636
2637 static void ConvertAndSetOwnProperty(LookupResult* lookup,
2638 Handle<Name> name,
2639 Handle<Object> value,
2640 PropertyAttributes attributes);
2641
2642 static void SetPropertyToFieldWithAttributes(LookupResult* lookup,
2643 Handle<Name> name,
2644 Handle<Object> value,
2645 PropertyAttributes attributes);
2646 static void GeneralizeFieldRepresentation(Handle<JSObject> object, 2631 static void GeneralizeFieldRepresentation(Handle<JSObject> object,
2647 int modify_index, 2632 int modify_index,
2648 Representation new_representation, 2633 Representation new_representation,
2649 Handle<HeapType> new_field_type); 2634 Handle<HeapType> new_field_type);
2650 2635
2651 static void UpdateAllocationSite(Handle<JSObject> object, 2636 static void UpdateAllocationSite(Handle<JSObject> object,
2652 ElementsKind to_kind); 2637 ElementsKind to_kind);
2653 2638
2654 // Used from Object::GetProperty(). 2639 // Used from Object::GetProperty().
2655 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck( 2640 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithFailedAccessCheck(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 StrictMode strict_mode, 2694 StrictMode strict_mode,
2710 bool check_prototype, 2695 bool check_prototype,
2711 SetPropertyMode set_mode = SET_PROPERTY); 2696 SetPropertyMode set_mode = SET_PROPERTY);
2712 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( 2697 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement(
2713 Handle<JSObject> object, 2698 Handle<JSObject> object,
2714 uint32_t index, 2699 uint32_t index,
2715 Handle<Object> value, 2700 Handle<Object> value,
2716 StrictMode strict_mode, 2701 StrictMode strict_mode,
2717 bool check_prototype = true); 2702 bool check_prototype = true);
2718 2703
2719 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition(
2720 Handle<JSObject> object,
2721 LookupResult* lookup,
2722 Handle<Name> name,
2723 Handle<Object> value,
2724 PropertyAttributes attributes);
2725 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( 2704 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck(
2726 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); 2705 LookupIterator* it, Handle<Object> value, StrictMode strict_mode);
2727 2706
2728 // Add a property to an object.
2729 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal(
2730 Handle<JSObject> object, Handle<Name> name, Handle<Object> value,
2731 PropertyAttributes attributes, StoreFromKeyed store_mode,
2732 ExtensibilityCheck extensibility_check, TransitionFlag flag);
2733
2734 // Add a property to a fast-case object.
2735 static void AddFastProperty(Handle<JSObject> object,
2736 Handle<Name> name,
2737 Handle<Object> value,
2738 PropertyAttributes attributes,
2739 StoreFromKeyed store_mode,
2740 TransitionFlag flag);
2741
2742 // Add a property to a slow-case object. 2707 // Add a property to a slow-case object.
2743 static void AddSlowProperty(Handle<JSObject> object, 2708 static void AddSlowProperty(Handle<JSObject> object,
2744 Handle<Name> name, 2709 Handle<Name> name,
2745 Handle<Object> value, 2710 Handle<Object> value,
2746 PropertyAttributes attributes); 2711 PropertyAttributes attributes);
2747 2712
2748 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty( 2713 MUST_USE_RESULT static MaybeHandle<Object> DeleteProperty(
2749 Handle<JSObject> object, 2714 Handle<JSObject> object,
2750 Handle<Name> name, 2715 Handle<Name> name,
2751 DeleteMode mode); 2716 DeleteMode mode);
(...skipping 3769 matching lines...) Expand 10 before | Expand all | Expand 10 after
6521 static Handle<Map> CopyForFreeze(Handle<Map> map); 6486 static Handle<Map> CopyForFreeze(Handle<Map> map);
6522 // Maximal number of fast properties. Used to restrict the number of map 6487 // Maximal number of fast properties. Used to restrict the number of map
6523 // transitions to avoid an explosion in the number of maps for objects used as 6488 // transitions to avoid an explosion in the number of maps for objects used as
6524 // dictionaries. 6489 // dictionaries.
6525 inline bool TooManyFastProperties(StoreFromKeyed store_mode); 6490 inline bool TooManyFastProperties(StoreFromKeyed store_mode);
6526 static Handle<Map> TransitionToDataProperty(Handle<Map> map, 6491 static Handle<Map> TransitionToDataProperty(Handle<Map> map,
6527 Handle<Name> name, 6492 Handle<Name> name,
6528 Handle<Object> value, 6493 Handle<Object> value,
6529 PropertyAttributes attributes, 6494 PropertyAttributes attributes,
6530 StoreFromKeyed store_mode); 6495 StoreFromKeyed store_mode);
6496 static Handle<Map> ReconfigureDataProperty(Handle<Map> map, int descriptor,
6497 PropertyAttributes attributes);
6531 6498
6532 inline void AppendDescriptor(Descriptor* desc); 6499 inline void AppendDescriptor(Descriptor* desc);
6533 6500
6534 // Returns a copy of the map, with all transitions dropped from the 6501 // Returns a copy of the map, with all transitions dropped from the
6535 // instance descriptors. 6502 // instance descriptors.
6536 static Handle<Map> Copy(Handle<Map> map); 6503 static Handle<Map> Copy(Handle<Map> map);
6537 static Handle<Map> Create(Handle<JSFunction> constructor, 6504 static Handle<Map> Create(Handle<JSFunction> constructor,
6538 int extra_inobject_properties); 6505 int extra_inobject_properties);
6539 6506
6540 // Returns the next free property index (only valid for FAST MODE). 6507 // Returns the next free property index (only valid for FAST MODE).
(...skipping 4732 matching lines...) Expand 10 before | Expand all | Expand 10 after
11273 } else { 11240 } else {
11274 value &= ~(1 << bit_position); 11241 value &= ~(1 << bit_position);
11275 } 11242 }
11276 return value; 11243 return value;
11277 } 11244 }
11278 }; 11245 };
11279 11246
11280 } } // namespace v8::internal 11247 } } // namespace v8::internal
11281 11248
11282 #endif // V8_OBJECTS_H_ 11249 #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