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

Side by Side Diff: src/objects.h

Issue 151163005: A64: Synchronize with r16356. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/mips/stub-cache-mips.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 // 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) { 227 static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) {
228 return store_mode >= STORE_AND_GROW_NO_TRANSITION && 228 return store_mode >= STORE_AND_GROW_NO_TRANSITION &&
229 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT; 229 store_mode <= STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT;
230 } 230 }
231 231
232 232
233 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. 233 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER.
234 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; 234 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER };
235 235
236 236
237 // Indicates whether a value can be loaded as a constant.
238 enum StoreMode {
239 ALLOW_AS_CONSTANT,
240 FORCE_FIELD
241 };
242
243
237 // PropertyNormalizationMode is used to specify whether to keep 244 // PropertyNormalizationMode is used to specify whether to keep
238 // inobject properties when normalizing properties of a JSObject. 245 // inobject properties when normalizing properties of a JSObject.
239 enum PropertyNormalizationMode { 246 enum PropertyNormalizationMode {
240 CLEAR_INOBJECT_PROPERTIES, 247 CLEAR_INOBJECT_PROPERTIES,
241 KEEP_INOBJECT_PROPERTIES 248 KEEP_INOBJECT_PROPERTIES
242 }; 249 };
243 250
244 251
245 // NormalizedMapSharingMode is used to specify whether a map may be shared 252 // NormalizedMapSharingMode is used to specify whether a map may be shared
246 // by different objects with normalized properties. 253 // by different objects with normalized properties.
247 enum NormalizedMapSharingMode { 254 enum NormalizedMapSharingMode {
248 UNIQUE_NORMALIZED_MAP, 255 UNIQUE_NORMALIZED_MAP,
249 SHARED_NORMALIZED_MAP 256 SHARED_NORMALIZED_MAP
250 }; 257 };
251 258
252 259
253 // Indicates whether a get method should implicitly create the object looked up. 260 // Indicates whether a get method should implicitly create the object looked up.
254 enum CreationFlag { 261 enum CreationFlag {
255 ALLOW_CREATION, 262 ALLOW_CREATION,
256 OMIT_CREATION 263 OMIT_CREATION
257 }; 264 };
258 265
259 266
260 // Indicates whether transitions can be added to a source map or not. 267 // Indicates whether transitions can be added to a source map or not.
261 enum TransitionFlag { 268 enum TransitionFlag {
262 INSERT_TRANSITION, 269 INSERT_TRANSITION,
263 OMIT_TRANSITION_KEEP_REPRESENTATIONS,
264 OMIT_TRANSITION 270 OMIT_TRANSITION
265 }; 271 };
266 272
267 273
268 enum DebugExtraICState { 274 enum DebugExtraICState {
269 DEBUG_BREAK, 275 DEBUG_BREAK,
270 DEBUG_PREPARE_STEP_IN 276 DEBUG_PREPARE_STEP_IN
271 }; 277 };
272 278
273 279
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 FORCE_DELETION 1950 FORCE_DELETION
1945 }; 1951 };
1946 1952
1947 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas 1953 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas
1948 // a keyed store is of the form a[expression] = foo. 1954 // a keyed store is of the form a[expression] = foo.
1949 enum StoreFromKeyed { 1955 enum StoreFromKeyed {
1950 MAY_BE_STORE_FROM_KEYED, 1956 MAY_BE_STORE_FROM_KEYED,
1951 CERTAINLY_NOT_STORE_FROM_KEYED 1957 CERTAINLY_NOT_STORE_FROM_KEYED
1952 }; 1958 };
1953 1959
1954 // Indicates whether a value can be loaded as a constant.
1955 enum StoreMode {
1956 ALLOW_AS_CONSTANT,
1957 FORCE_FIELD
1958 };
1959
1960 // Internal properties (e.g. the hidden properties dictionary) might 1960 // Internal properties (e.g. the hidden properties dictionary) might
1961 // be added even though the receiver is non-extensible. 1961 // be added even though the receiver is non-extensible.
1962 enum ExtensibilityCheck { 1962 enum ExtensibilityCheck {
1963 PERFORM_EXTENSIBILITY_CHECK, 1963 PERFORM_EXTENSIBILITY_CHECK,
1964 OMIT_EXTENSIBILITY_CHECK 1964 OMIT_EXTENSIBILITY_CHECK
1965 }; 1965 };
1966 1966
1967 // Casting. 1967 // Casting.
1968 static inline JSReceiver* cast(Object* obj); 1968 static inline JSReceiver* cast(Object* obj);
1969 1969
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( 2177 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor(
2178 Name* name, 2178 Name* name,
2179 Object* value, 2179 Object* value,
2180 PropertyAttributes attributes, 2180 PropertyAttributes attributes,
2181 StrictModeFlag strict_mode); 2181 StrictModeFlag strict_mode);
2182 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( 2182 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor(
2183 Name* name, 2183 Name* name,
2184 Object* value, 2184 Object* value,
2185 PropertyAttributes attributes, 2185 PropertyAttributes attributes,
2186 StrictModeFlag strict_mode, 2186 StrictModeFlag strict_mode,
2187 ExtensibilityCheck extensibility_check,
2188 StoreMode mode = ALLOW_AS_CONSTANT); 2187 StoreMode mode = ALLOW_AS_CONSTANT);
2189 2188
2190 static Handle<Object> SetLocalPropertyIgnoreAttributes( 2189 static Handle<Object> SetLocalPropertyIgnoreAttributes(
2191 Handle<JSObject> object, 2190 Handle<JSObject> object,
2192 Handle<Name> key, 2191 Handle<Name> key,
2193 Handle<Object> value, 2192 Handle<Object> value,
2194 PropertyAttributes attributes, 2193 PropertyAttributes attributes,
2195 ValueType value_type = OPTIMAL_REPRESENTATION, 2194 ValueType value_type = OPTIMAL_REPRESENTATION,
2196 StoreMode mode = ALLOW_AS_CONSTANT); 2195 StoreMode mode = ALLOW_AS_CONSTANT);
2197 2196
(...skipping 17 matching lines...) Expand all
2215 2214
2216 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); 2215 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance);
2217 inline MUST_USE_RESULT MaybeObject* TryMigrateInstance(); 2216 inline MUST_USE_RESULT MaybeObject* TryMigrateInstance();
2218 2217
2219 // Can cause GC. 2218 // Can cause GC.
2220 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( 2219 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
2221 Name* key, 2220 Name* key,
2222 Object* value, 2221 Object* value,
2223 PropertyAttributes attributes, 2222 PropertyAttributes attributes,
2224 ValueType value_type = OPTIMAL_REPRESENTATION, 2223 ValueType value_type = OPTIMAL_REPRESENTATION,
2225 StoreMode mode = ALLOW_AS_CONSTANT); 2224 StoreMode mode = ALLOW_AS_CONSTANT,
2225 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
2226 2226
2227 // Retrieve a value in a normalized object given a lookup result. 2227 // Retrieve a value in a normalized object given a lookup result.
2228 // Handles the special representation of JS global objects. 2228 // Handles the special representation of JS global objects.
2229 Object* GetNormalizedProperty(LookupResult* result); 2229 Object* GetNormalizedProperty(LookupResult* result);
2230 2230
2231 // Sets the property value in a normalized object given (key, value). 2231 // Sets the property value in a normalized object given (key, value).
2232 // Handles the special representation of JS global objects. 2232 // Handles the special representation of JS global objects.
2233 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object, 2233 static Handle<Object> SetNormalizedProperty(Handle<JSObject> object,
2234 LookupResult* result, 2234 LookupResult* result,
2235 Handle<Object> value); 2235 Handle<Object> value);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2270 Name* name, 2270 Name* name,
2271 bool continue_search); 2271 bool continue_search);
2272 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, 2272 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver,
2273 uint32_t index, 2273 uint32_t index,
2274 bool continue_search); 2274 bool continue_search);
2275 2275
2276 static void DefineAccessor(Handle<JSObject> object, 2276 static void DefineAccessor(Handle<JSObject> object,
2277 Handle<Name> name, 2277 Handle<Name> name,
2278 Handle<Object> getter, 2278 Handle<Object> getter,
2279 Handle<Object> setter, 2279 Handle<Object> setter,
2280 PropertyAttributes attributes); 2280 PropertyAttributes attributes,
2281 v8::AccessControl access_control = v8::DEFAULT);
2281 2282
2282 MaybeObject* LookupAccessor(Name* name, AccessorComponent component); 2283 MaybeObject* LookupAccessor(Name* name, AccessorComponent component);
2283 2284
2284 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); 2285 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info);
2285 2286
2286 // Used from Object::GetProperty(). 2287 // Used from Object::GetProperty().
2287 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck( 2288 MUST_USE_RESULT MaybeObject* GetPropertyWithFailedAccessCheck(
2288 Object* receiver, 2289 Object* receiver,
2289 LookupResult* result, 2290 LookupResult* result,
2290 Name* name, 2291 Name* name,
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 2518
2518 // Add a constant function property to a fast-case object. 2519 // Add a constant function property to a fast-case object.
2519 // This leaves a CONSTANT_TRANSITION in the old map, and 2520 // This leaves a CONSTANT_TRANSITION in the old map, and
2520 // if it is called on a second object with this map, a 2521 // if it is called on a second object with this map, a
2521 // normal property is added instead, with a map transition. 2522 // normal property is added instead, with a map transition.
2522 // This avoids the creation of many maps with the same constant 2523 // This avoids the creation of many maps with the same constant
2523 // function, all orphaned. 2524 // function, all orphaned.
2524 MUST_USE_RESULT MaybeObject* AddConstantProperty( 2525 MUST_USE_RESULT MaybeObject* AddConstantProperty(
2525 Name* name, 2526 Name* name,
2526 Object* constant, 2527 Object* constant,
2527 PropertyAttributes attributes); 2528 PropertyAttributes attributes,
2529 TransitionFlag flag);
2528 2530
2529 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty( 2531 MUST_USE_RESULT MaybeObject* ReplaceSlowProperty(
2530 Name* name, 2532 Name* name,
2531 Object* value, 2533 Object* value,
2532 PropertyAttributes attributes); 2534 PropertyAttributes attributes);
2533 2535
2534 // Returns a new map with all transitions dropped from the object's current 2536 // Returns a new map with all transitions dropped from the object's current
2535 // map and the ElementsKind set. 2537 // map and the ElementsKind set.
2536 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, 2538 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object,
2537 ElementsKind to_kind); 2539 ElementsKind to_kind);
2538 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( 2540 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap(
2539 Isolate* isolate, 2541 Isolate* isolate,
2540 ElementsKind elements_kind); 2542 ElementsKind elements_kind);
2541 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( 2543 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow(
2542 ElementsKind elements_kind); 2544 ElementsKind elements_kind);
2543 2545
2544 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, 2546 static Handle<Object> TransitionElementsKind(Handle<JSObject> object,
2545 ElementsKind to_kind); 2547 ElementsKind to_kind);
2546 2548
2547 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); 2549 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
2548 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); 2550 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2549 2551
2550 // Replaces an existing transition with a transition to a map with a FIELD.
2551 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition(
2552 int transition_index,
2553 Name* name,
2554 Object* new_value,
2555 PropertyAttributes attributes);
2556
2557 // Converts a descriptor of any other type to a real field, backed by the
2558 // properties array.
2559 MUST_USE_RESULT MaybeObject* ConvertDescriptorToField(
2560 Name* name,
2561 Object* new_value,
2562 PropertyAttributes attributes,
2563 TransitionFlag flag = OMIT_TRANSITION);
2564
2565 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map); 2552 MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map);
2566 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation( 2553 MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation(
2567 int modify_index, 2554 int modify_index,
2568 Representation new_representation); 2555 Representation new_representation,
2556 StoreMode store_mode);
2569 2557
2570 // Add a property to a fast-case object. 2558 // Add a property to a fast-case object.
2571 MUST_USE_RESULT MaybeObject* AddFastProperty( 2559 MUST_USE_RESULT MaybeObject* AddFastProperty(
2572 Name* name, 2560 Name* name,
2573 Object* value, 2561 Object* value,
2574 PropertyAttributes attributes, 2562 PropertyAttributes attributes,
2575 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, 2563 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
2576 ValueType value_type = OPTIMAL_REPRESENTATION); 2564 ValueType value_type = OPTIMAL_REPRESENTATION,
2565 TransitionFlag flag = INSERT_TRANSITION);
2577 2566
2578 // Add a property to a slow-case object. 2567 // Add a property to a slow-case object.
2579 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name, 2568 MUST_USE_RESULT MaybeObject* AddSlowProperty(Name* name,
2580 Object* value, 2569 Object* value,
2581 PropertyAttributes attributes); 2570 PropertyAttributes attributes);
2582 2571
2583 // Add a property to an object. May cause GC. 2572 // Add a property to an object. May cause GC.
2584 MUST_USE_RESULT MaybeObject* AddProperty( 2573 MUST_USE_RESULT MaybeObject* AddProperty(
2585 Name* name, 2574 Name* name,
2586 Object* value, 2575 Object* value,
2587 PropertyAttributes attributes, 2576 PropertyAttributes attributes,
2588 StrictModeFlag strict_mode, 2577 StrictModeFlag strict_mode,
2589 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, 2578 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
2590 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, 2579 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
2591 ValueType value_type = OPTIMAL_REPRESENTATION, 2580 ValueType value_type = OPTIMAL_REPRESENTATION,
2592 StoreMode mode = ALLOW_AS_CONSTANT); 2581 StoreMode mode = ALLOW_AS_CONSTANT,
2582 TransitionFlag flag = INSERT_TRANSITION);
2593 2583
2594 // Convert the object to use the canonical dictionary 2584 // Convert the object to use the canonical dictionary
2595 // representation. If the object is expected to have additional properties 2585 // representation. If the object is expected to have additional properties
2596 // added this number can be indicated to have the backing store allocated to 2586 // added this number can be indicated to have the backing store allocated to
2597 // an initial capacity for holding these properties. 2587 // an initial capacity for holding these properties.
2598 static void NormalizeProperties(Handle<JSObject> object, 2588 static void NormalizeProperties(Handle<JSObject> object,
2599 PropertyNormalizationMode mode, 2589 PropertyNormalizationMode mode,
2600 int expected_additional_properties); 2590 int expected_additional_properties);
2601 2591
2602 MUST_USE_RESULT MaybeObject* NormalizeProperties( 2592 MUST_USE_RESULT MaybeObject* NormalizeProperties(
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2718 int number_of_slow_unused_elements_; 2708 int number_of_slow_unused_elements_;
2719 }; 2709 };
2720 2710
2721 void IncrementSpillStatistics(SpillInformation* info); 2711 void IncrementSpillStatistics(SpillInformation* info);
2722 #endif 2712 #endif
2723 Object* SlowReverseLookup(Object* value); 2713 Object* SlowReverseLookup(Object* value);
2724 2714
2725 // Maximal number of fast properties for the JSObject. Used to 2715 // Maximal number of fast properties for the JSObject. Used to
2726 // restrict the number of map transitions to avoid an explosion in 2716 // restrict the number of map transitions to avoid an explosion in
2727 // the number of maps for objects used as dictionaries. 2717 // the number of maps for objects used as dictionaries.
2728 inline bool TooManyFastProperties(int properties, StoreFromKeyed store_mode); 2718 inline bool TooManyFastProperties(
2719 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
2729 2720
2730 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). 2721 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1).
2731 // Also maximal value of JSArray's length property. 2722 // Also maximal value of JSArray's length property.
2732 static const uint32_t kMaxElementCount = 0xffffffffu; 2723 static const uint32_t kMaxElementCount = 0xffffffffu;
2733 2724
2734 // Constants for heuristics controlling conversion of fast elements 2725 // Constants for heuristics controlling conversion of fast elements
2735 // to slow elements. 2726 // to slow elements.
2736 2727
2737 // Maximal gap that can be introduced by adding an element beyond 2728 // Maximal gap that can be introduced by adding an element beyond
2738 // the current elements length. 2729 // the current elements length.
2739 static const uint32_t kMaxGap = 1024; 2730 static const uint32_t kMaxGap = 1024;
2740 2731
2741 // Maximal length of fast elements array that won't be checked for 2732 // Maximal length of fast elements array that won't be checked for
2742 // being dense enough on expansion. 2733 // being dense enough on expansion.
2743 static const int kMaxUncheckedFastElementsLength = 5000; 2734 static const int kMaxUncheckedFastElementsLength = 5000;
2744 2735
2745 // Same as above but for old arrays. This limit is more strict. We 2736 // Same as above but for old arrays. This limit is more strict. We
2746 // don't want to be wasteful with long lived objects. 2737 // don't want to be wasteful with long lived objects.
2747 static const int kMaxUncheckedOldFastElementsLength = 500; 2738 static const int kMaxUncheckedOldFastElementsLength = 500;
2748 2739
2749 static const int kInitialMaxFastElementArray = 100000; 2740 // TODO(2790): HAllocate currently always allocates fast backing stores
2741 // in new space, where on x64 we can only fit ~98K elements. Keep this
2742 // limit lower than that until HAllocate is made smarter.
2743 static const int kInitialMaxFastElementArray = 95000;
2744
2750 static const int kFastPropertiesSoftLimit = 12; 2745 static const int kFastPropertiesSoftLimit = 12;
2751 static const int kMaxFastProperties = 64; 2746 static const int kMaxFastProperties = 64;
2752 static const int kMaxInstanceSize = 255 * kPointerSize; 2747 static const int kMaxInstanceSize = 255 * kPointerSize;
2753 // When extending the backing storage for property values, we increase 2748 // When extending the backing storage for property values, we increase
2754 // its size by more than the 1 entry necessary, so sequentially adding fields 2749 // its size by more than the 1 entry necessary, so sequentially adding fields
2755 // to the same object requires fewer allocations and copies. 2750 // to the same object requires fewer allocations and copies.
2756 static const int kFieldsAdded = 3; 2751 static const int kFieldsAdded = 3;
2757 2752
2758 // Layout description. 2753 // Layout description.
2759 static const int kPropertiesOffset = HeapObject::kHeaderSize; 2754 static const int kPropertiesOffset = HeapObject::kHeaderSize;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 Object* structure, 2855 Object* structure,
2861 PropertyAttributes attributes); 2856 PropertyAttributes attributes);
2862 MUST_USE_RESULT MaybeObject* SetPropertyCallback( 2857 MUST_USE_RESULT MaybeObject* SetPropertyCallback(
2863 Name* name, 2858 Name* name,
2864 Object* structure, 2859 Object* structure,
2865 PropertyAttributes attributes); 2860 PropertyAttributes attributes);
2866 static void DefineElementAccessor(Handle<JSObject> object, 2861 static void DefineElementAccessor(Handle<JSObject> object,
2867 uint32_t index, 2862 uint32_t index,
2868 Handle<Object> getter, 2863 Handle<Object> getter,
2869 Handle<Object> setter, 2864 Handle<Object> setter,
2870 PropertyAttributes attributes); 2865 PropertyAttributes attributes,
2866 v8::AccessControl access_control);
2871 static Handle<AccessorPair> CreateAccessorPairFor(Handle<JSObject> object, 2867 static Handle<AccessorPair> CreateAccessorPairFor(Handle<JSObject> object,
2872 Handle<Name> name); 2868 Handle<Name> name);
2873 static void DefinePropertyAccessor(Handle<JSObject> object, 2869 static void DefinePropertyAccessor(Handle<JSObject> object,
2874 Handle<Name> name, 2870 Handle<Name> name,
2875 Handle<Object> getter, 2871 Handle<Object> getter,
2876 Handle<Object> setter, 2872 Handle<Object> setter,
2877 PropertyAttributes attributes); 2873 PropertyAttributes attributes,
2874 v8::AccessControl access_control);
2878 2875
2879 // Try to define a single accessor paying attention to map transitions. 2876 // Try to define a single accessor paying attention to map transitions.
2880 // Returns false if this was not possible and we have to use the slow case. 2877 // Returns false if this was not possible and we have to use the slow case.
2881 static bool DefineFastAccessor(Handle<JSObject> object, 2878 static bool DefineFastAccessor(Handle<JSObject> object,
2882 Handle<Name> name, 2879 Handle<Name> name,
2883 AccessorComponent component, 2880 AccessorComponent component,
2884 Handle<Object> accessor, 2881 Handle<Object> accessor,
2885 PropertyAttributes attributes); 2882 PropertyAttributes attributes);
2886 2883
2887 enum InitializeHiddenProperties { 2884 enum InitializeHiddenProperties {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3208 3205
3209 // Transfer a complete descriptor from the src descriptor array to this 3206 // Transfer a complete descriptor from the src descriptor array to this
3210 // descriptor array. 3207 // descriptor array.
3211 void CopyFrom(int dst_index, 3208 void CopyFrom(int dst_index,
3212 DescriptorArray* src, 3209 DescriptorArray* src,
3213 int src_index, 3210 int src_index,
3214 const WhitenessWitness&); 3211 const WhitenessWitness&);
3215 MUST_USE_RESULT MaybeObject* Merge(int verbatim, 3212 MUST_USE_RESULT MaybeObject* Merge(int verbatim,
3216 int valid, 3213 int valid,
3217 int new_size, 3214 int new_size,
3215 int modify_index,
3216 StoreMode store_mode,
3218 DescriptorArray* other); 3217 DescriptorArray* other);
3219 3218
3220 bool IsMoreGeneralThan(int verbatim, 3219 bool IsMoreGeneralThan(int verbatim,
3221 int valid, 3220 int valid,
3222 int new_size, 3221 int new_size,
3223 DescriptorArray* other); 3222 DescriptorArray* other);
3224 3223
3225 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) { 3224 MUST_USE_RESULT MaybeObject* CopyUpTo(int enumeration_index) {
3226 return CopyUpToAddAttributes(enumeration_index, NONE); 3225 return CopyUpToAddAttributes(enumeration_index, NONE);
3227 } 3226 }
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after
4929 // clients of this API that pass "extra" values in for argc. These clients 4928 // clients of this API that pass "extra" values in for argc. These clients
4930 // should be retrofitted to used ExtendedExtraICState. 4929 // should be retrofitted to used ExtendedExtraICState.
4931 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC; 4930 return kind == COMPARE_NIL_IC || kind == TO_BOOLEAN_IC;
4932 } 4931 }
4933 4932
4934 inline StubType type(); // Only valid for monomorphic IC stubs. 4933 inline StubType type(); // Only valid for monomorphic IC stubs.
4935 inline int arguments_count(); // Only valid for call IC stubs. 4934 inline int arguments_count(); // Only valid for call IC stubs.
4936 4935
4937 // Testers for IC stub kinds. 4936 // Testers for IC stub kinds.
4938 inline bool is_inline_cache_stub(); 4937 inline bool is_inline_cache_stub();
4939 inline bool is_debug_break(); 4938 inline bool is_debug_stub();
4940 inline bool is_load_stub() { return kind() == LOAD_IC; } 4939 inline bool is_load_stub() { return kind() == LOAD_IC; }
4941 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 4940 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
4942 inline bool is_store_stub() { return kind() == STORE_IC; } 4941 inline bool is_store_stub() { return kind() == STORE_IC; }
4943 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 4942 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
4944 inline bool is_call_stub() { return kind() == CALL_IC; } 4943 inline bool is_call_stub() { return kind() == CALL_IC; }
4945 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } 4944 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; }
4946 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } 4945 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; }
4947 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } 4946 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
4948 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; } 4947 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
4949 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } 4948 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
5637 5636
5638 int NumberOfFields(); 5637 int NumberOfFields();
5639 5638
5640 bool InstancesNeedRewriting(Map* target, 5639 bool InstancesNeedRewriting(Map* target,
5641 int target_number_of_fields, 5640 int target_number_of_fields,
5642 int target_inobject, 5641 int target_inobject,
5643 int target_unused); 5642 int target_unused);
5644 static Handle<Map> GeneralizeRepresentation( 5643 static Handle<Map> GeneralizeRepresentation(
5645 Handle<Map> map, 5644 Handle<Map> map,
5646 int modify_index, 5645 int modify_index,
5647 Representation new_representation); 5646 Representation new_representation,
5647 StoreMode store_mode);
5648 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation( 5648 MUST_USE_RESULT MaybeObject* GeneralizeRepresentation(
5649 int modify_index, 5649 int modify_index,
5650 Representation representation); 5650 Representation representation,
5651 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations(); 5651 StoreMode store_mode);
5652 MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations(
5653 int modify_index,
5654 StoreMode store_mode,
5655 PropertyAttributes attributes,
5656 const char* reason);
5652 5657
5653 void PrintGeneralization(FILE* file, 5658 void PrintGeneralization(FILE* file,
5659 const char* reason,
5654 int modify_index, 5660 int modify_index,
5655 int split, 5661 int split,
5656 int descriptors, 5662 int descriptors,
5663 bool constant_to_field,
5657 Representation old_representation, 5664 Representation old_representation,
5658 Representation new_representation); 5665 Representation new_representation);
5659 5666
5660 // Returns the constructor name (the name (possibly, inferred name) of the 5667 // Returns the constructor name (the name (possibly, inferred name) of the
5661 // function that was used to instantiate the object). 5668 // function that was used to instantiate the object).
5662 String* constructor_name(); 5669 String* constructor_name();
5663 5670
5664 // Tells whether the map is attached to SharedFunctionInfo 5671 // Tells whether the map is attached to SharedFunctionInfo
5665 // (for inobject slack tracking). 5672 // (for inobject slack tracking).
5666 inline void set_attached_to_shared_function_info(bool value); 5673 inline void set_attached_to_shared_function_info(bool value);
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
6984 6991
6985 // Tells whether or not this function has been optimized. 6992 // Tells whether or not this function has been optimized.
6986 inline bool IsOptimized(); 6993 inline bool IsOptimized();
6987 6994
6988 // Tells whether or not this function can be optimized. 6995 // Tells whether or not this function can be optimized.
6989 inline bool IsOptimizable(); 6996 inline bool IsOptimizable();
6990 6997
6991 // Mark this function for lazy recompilation. The function will be 6998 // Mark this function for lazy recompilation. The function will be
6992 // recompiled the next time it is executed. 6999 // recompiled the next time it is executed.
6993 void MarkForLazyRecompilation(); 7000 void MarkForLazyRecompilation();
6994 void MarkForParallelRecompilation(); 7001 void MarkForConcurrentRecompilation();
6995 void MarkForInstallingRecompiledCode(); 7002 void MarkForInstallingRecompiledCode();
6996 void MarkInRecompileQueue(); 7003 void MarkInRecompileQueue();
6997 7004
6998 // Helpers to compile this function. Returns true on success, false on 7005 // Helpers to compile this function. Returns true on success, false on
6999 // failure (e.g., stack overflow during compilation). 7006 // failure (e.g., stack overflow during compilation).
7000 static bool EnsureCompiled(Handle<JSFunction> function, 7007 static bool EnsureCompiled(Handle<JSFunction> function,
7001 ClearExceptionFlag flag); 7008 ClearExceptionFlag flag);
7002 static bool CompileLazy(Handle<JSFunction> function, 7009 static bool CompileLazy(Handle<JSFunction> function,
7003 ClearExceptionFlag flag); 7010 ClearExceptionFlag flag);
7004 static bool CompileOptimized(Handle<JSFunction> function, 7011 static bool CompileOptimized(Handle<JSFunction> function,
7005 BailoutId osr_ast_id, 7012 BailoutId osr_ast_id,
7006 ClearExceptionFlag flag); 7013 ClearExceptionFlag flag);
7007 7014
7008 // Tells whether or not the function is already marked for lazy 7015 // Tells whether or not the function is already marked for lazy
7009 // recompilation. 7016 // recompilation.
7010 inline bool IsMarkedForLazyRecompilation(); 7017 inline bool IsMarkedForLazyRecompilation();
7011 inline bool IsMarkedForParallelRecompilation(); 7018 inline bool IsMarkedForConcurrentRecompilation();
7012 inline bool IsMarkedForInstallingRecompiledCode(); 7019 inline bool IsMarkedForInstallingRecompiledCode();
7013 7020
7014 // Tells whether or not the function is on the parallel 7021 // Tells whether or not the function is on the concurrent recompilation queue.
7015 // recompilation queue.
7016 inline bool IsInRecompileQueue(); 7022 inline bool IsInRecompileQueue();
7017 7023
7018 // Check whether or not this function is inlineable. 7024 // Check whether or not this function is inlineable.
7019 bool IsInlineable(); 7025 bool IsInlineable();
7020 7026
7021 // [literals_or_bindings]: Fixed array holding either 7027 // [literals_or_bindings]: Fixed array holding either
7022 // the materialized literals or the bindings of a bound function. 7028 // the materialized literals or the bindings of a bound function.
7023 // 7029 //
7024 // If the function contains object, regexp or array literals, the 7030 // If the function contains object, regexp or array literals, the
7025 // literals array prefix contains the object, regexp, and array 7031 // literals array prefix contains the object, regexp, and array
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
7097 // Dispatched behavior. 7103 // Dispatched behavior.
7098 DECLARE_PRINTER(JSFunction) 7104 DECLARE_PRINTER(JSFunction)
7099 DECLARE_VERIFIER(JSFunction) 7105 DECLARE_VERIFIER(JSFunction)
7100 7106
7101 // Returns the number of allocated literals. 7107 // Returns the number of allocated literals.
7102 inline int NumberOfLiterals(); 7108 inline int NumberOfLiterals();
7103 7109
7104 // Retrieve the native context from a function's literal array. 7110 // Retrieve the native context from a function's literal array.
7105 static Context* NativeContextFromLiterals(FixedArray* literals); 7111 static Context* NativeContextFromLiterals(FixedArray* literals);
7106 7112
7107 bool PassesHydrogenFilter(); 7113 // Used for flags such as --hydrogen-filter.
7114 bool PassesFilter(const char* raw_filter);
7108 7115
7109 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to 7116 // Layout descriptors. The last property (from kNonWeakFieldsEndOffset to
7110 // kSize) is weak and has special handling during garbage collection. 7117 // kSize) is weak and has special handling during garbage collection.
7111 static const int kCodeEntryOffset = JSObject::kHeaderSize; 7118 static const int kCodeEntryOffset = JSObject::kHeaderSize;
7112 static const int kPrototypeOrInitialMapOffset = 7119 static const int kPrototypeOrInitialMapOffset =
7113 kCodeEntryOffset + kPointerSize; 7120 kCodeEntryOffset + kPointerSize;
7114 static const int kSharedFunctionInfoOffset = 7121 static const int kSharedFunctionInfoOffset =
7115 kPrototypeOrInitialMapOffset + kPointerSize; 7122 kPrototypeOrInitialMapOffset + kPointerSize;
7116 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; 7123 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize;
7117 static const int kLiteralsOffset = kContextOffset + kPointerSize; 7124 static const int kLiteralsOffset = kContextOffset + kPointerSize;
(...skipping 2586 matching lines...) Expand 10 before | Expand all | Expand 10 after
9704 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo); 9711 DISALLOW_IMPLICIT_CONSTRUCTORS(ExecutableAccessorInfo);
9705 }; 9712 };
9706 9713
9707 9714
9708 // Support for JavaScript accessors: A pair of a getter and a setter. Each 9715 // Support for JavaScript accessors: A pair of a getter and a setter. Each
9709 // accessor can either be 9716 // accessor can either be
9710 // * a pointer to a JavaScript function or proxy: a real accessor 9717 // * a pointer to a JavaScript function or proxy: a real accessor
9711 // * undefined: considered an accessor by the spec, too, strangely enough 9718 // * undefined: considered an accessor by the spec, too, strangely enough
9712 // * the hole: an accessor which has not been set 9719 // * the hole: an accessor which has not been set
9713 // * a pointer to a map: a transition used to ensure map sharing 9720 // * a pointer to a map: a transition used to ensure map sharing
9721 // access_flags provides the ability to override access checks on access check
9722 // failure.
9714 class AccessorPair: public Struct { 9723 class AccessorPair: public Struct {
9715 public: 9724 public:
9716 DECL_ACCESSORS(getter, Object) 9725 DECL_ACCESSORS(getter, Object)
9717 DECL_ACCESSORS(setter, Object) 9726 DECL_ACCESSORS(setter, Object)
9727 DECL_ACCESSORS(access_flags, Smi)
9728
9729 inline void set_access_flags(v8::AccessControl access_control);
9730 inline bool all_can_read();
9731 inline bool all_can_write();
9732 inline bool prohibits_overwriting();
9718 9733
9719 static inline AccessorPair* cast(Object* obj); 9734 static inline AccessorPair* cast(Object* obj);
9720 9735
9721 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair); 9736 static Handle<AccessorPair> Copy(Handle<AccessorPair> pair);
9722 9737
9723 Object* get(AccessorComponent component) { 9738 Object* get(AccessorComponent component) {
9724 return component == ACCESSOR_GETTER ? getter() : setter(); 9739 return component == ACCESSOR_GETTER ? getter() : setter();
9725 } 9740 }
9726 9741
9727 void set(AccessorComponent component, Object* value) { 9742 void set(AccessorComponent component, Object* value) {
(...skipping 16 matching lines...) Expand all
9744 bool ContainsAccessor() { 9759 bool ContainsAccessor() {
9745 return IsJSAccessor(getter()) || IsJSAccessor(setter()); 9760 return IsJSAccessor(getter()) || IsJSAccessor(setter());
9746 } 9761 }
9747 9762
9748 // Dispatched behavior. 9763 // Dispatched behavior.
9749 DECLARE_PRINTER(AccessorPair) 9764 DECLARE_PRINTER(AccessorPair)
9750 DECLARE_VERIFIER(AccessorPair) 9765 DECLARE_VERIFIER(AccessorPair)
9751 9766
9752 static const int kGetterOffset = HeapObject::kHeaderSize; 9767 static const int kGetterOffset = HeapObject::kHeaderSize;
9753 static const int kSetterOffset = kGetterOffset + kPointerSize; 9768 static const int kSetterOffset = kGetterOffset + kPointerSize;
9754 static const int kSize = kSetterOffset + kPointerSize; 9769 static const int kAccessFlagsOffset = kSetterOffset + kPointerSize;
9770 static const int kSize = kAccessFlagsOffset + kPointerSize;
9755 9771
9756 private: 9772 private:
9773 static const int kAllCanReadBit = 0;
9774 static const int kAllCanWriteBit = 1;
9775 static const int kProhibitsOverwritingBit = 2;
9776
9757 // Strangely enough, in addition to functions and harmony proxies, the spec 9777 // Strangely enough, in addition to functions and harmony proxies, the spec
9758 // requires us to consider undefined as a kind of accessor, too: 9778 // requires us to consider undefined as a kind of accessor, too:
9759 // var obj = {}; 9779 // var obj = {};
9760 // Object.defineProperty(obj, "foo", {get: undefined}); 9780 // Object.defineProperty(obj, "foo", {get: undefined});
9761 // assertTrue("foo" in obj); 9781 // assertTrue("foo" in obj);
9762 bool IsJSAccessor(Object* obj) { 9782 bool IsJSAccessor(Object* obj) {
9763 return obj->IsSpecFunction() || obj->IsUndefined(); 9783 return obj->IsSpecFunction() || obj->IsUndefined();
9764 } 9784 }
9765 9785
9766 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair); 9786 DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
9872 inline int length(); 9892 inline int length();
9873 inline void set_length(int value); 9893 inline void set_length(int value);
9874 9894
9875 // Following properties use flag bits. 9895 // Following properties use flag bits.
9876 DECL_BOOLEAN_ACCESSORS(hidden_prototype) 9896 DECL_BOOLEAN_ACCESSORS(hidden_prototype)
9877 DECL_BOOLEAN_ACCESSORS(undetectable) 9897 DECL_BOOLEAN_ACCESSORS(undetectable)
9878 // If the bit is set, object instances created by this function 9898 // If the bit is set, object instances created by this function
9879 // requires access check. 9899 // requires access check.
9880 DECL_BOOLEAN_ACCESSORS(needs_access_check) 9900 DECL_BOOLEAN_ACCESSORS(needs_access_check)
9881 DECL_BOOLEAN_ACCESSORS(read_only_prototype) 9901 DECL_BOOLEAN_ACCESSORS(read_only_prototype)
9902 DECL_BOOLEAN_ACCESSORS(remove_prototype)
9882 9903
9883 static inline FunctionTemplateInfo* cast(Object* obj); 9904 static inline FunctionTemplateInfo* cast(Object* obj);
9884 9905
9885 // Dispatched behavior. 9906 // Dispatched behavior.
9886 DECLARE_PRINTER(FunctionTemplateInfo) 9907 DECLARE_PRINTER(FunctionTemplateInfo)
9887 DECLARE_VERIFIER(FunctionTemplateInfo) 9908 DECLARE_VERIFIER(FunctionTemplateInfo)
9888 9909
9889 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize; 9910 static const int kSerialNumberOffset = TemplateInfo::kHeaderSize;
9890 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize; 9911 static const int kCallCodeOffset = kSerialNumberOffset + kPointerSize;
9891 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize; 9912 static const int kPropertyAccessorsOffset = kCallCodeOffset + kPointerSize;
(...skipping 15 matching lines...) Expand all
9907 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize; 9928 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize;
9908 static const int kLengthOffset = kFlagOffset + kPointerSize; 9929 static const int kLengthOffset = kFlagOffset + kPointerSize;
9909 static const int kSize = kLengthOffset + kPointerSize; 9930 static const int kSize = kLengthOffset + kPointerSize;
9910 9931
9911 private: 9932 private:
9912 // Bit position in the flag, from least significant bit position. 9933 // Bit position in the flag, from least significant bit position.
9913 static const int kHiddenPrototypeBit = 0; 9934 static const int kHiddenPrototypeBit = 0;
9914 static const int kUndetectableBit = 1; 9935 static const int kUndetectableBit = 1;
9915 static const int kNeedsAccessCheckBit = 2; 9936 static const int kNeedsAccessCheckBit = 2;
9916 static const int kReadOnlyPrototypeBit = 3; 9937 static const int kReadOnlyPrototypeBit = 3;
9938 static const int kRemovePrototypeBit = 4;
9917 9939
9918 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 9940 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
9919 }; 9941 };
9920 9942
9921 9943
9922 class ObjectTemplateInfo: public TemplateInfo { 9944 class ObjectTemplateInfo: public TemplateInfo {
9923 public: 9945 public:
9924 DECL_ACCESSORS(constructor, Object) 9946 DECL_ACCESSORS(constructor, Object)
9925 DECL_ACCESSORS(internal_field_count, Object) 9947 DECL_ACCESSORS(internal_field_count, Object)
9926 9948
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
10209 } else { 10231 } else {
10210 value &= ~(1 << bit_position); 10232 value &= ~(1 << bit_position);
10211 } 10233 }
10212 return value; 10234 return value;
10213 } 10235 }
10214 }; 10236 };
10215 10237
10216 } } // namespace v8::internal 10238 } } // namespace v8::internal
10217 10239
10218 #endif // V8_OBJECTS_H_ 10240 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mips/stub-cache-mips.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698