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

Side by Side Diff: src/objects.h

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years 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
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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 V(kModuleUrl, "Module url") \ 1189 V(kModuleUrl, "Module url") \
1190 V(kNativeFunctionLiteral, "Native function literal") \ 1190 V(kNativeFunctionLiteral, "Native function literal") \
1191 V(kNoCasesLeft, "no cases left") \ 1191 V(kNoCasesLeft, "no cases left") \
1192 V(kNoEmptyArraysHereInEmitFastAsciiArrayJoin, \ 1192 V(kNoEmptyArraysHereInEmitFastAsciiArrayJoin, \
1193 "No empty arrays here in EmitFastAsciiArrayJoin") \ 1193 "No empty arrays here in EmitFastAsciiArrayJoin") \
1194 V(kNonInitializerAssignmentToConst, \ 1194 V(kNonInitializerAssignmentToConst, \
1195 "non-initializer assignment to const") \ 1195 "non-initializer assignment to const") \
1196 V(kNonSmiIndex, "Non-smi index") \ 1196 V(kNonSmiIndex, "Non-smi index") \
1197 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \ 1197 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \
1198 V(kNonSmiValue, "Non-smi value") \ 1198 V(kNonSmiValue, "Non-smi value") \
1199 V(kNonObject, "Non-object value") \
1199 V(kNotEnoughVirtualRegistersForValues, \ 1200 V(kNotEnoughVirtualRegistersForValues, \
1200 "not enough virtual registers for values") \ 1201 "not enough virtual registers for values") \
1201 V(kNotEnoughSpillSlotsForOsr, \ 1202 V(kNotEnoughSpillSlotsForOsr, \
1202 "not enough spill slots for OSR") \ 1203 "not enough spill slots for OSR") \
1203 V(kNotEnoughVirtualRegistersRegalloc, \ 1204 V(kNotEnoughVirtualRegistersRegalloc, \
1204 "not enough virtual registers (regalloc)") \ 1205 "not enough virtual registers (regalloc)") \
1205 V(kObjectFoundInSmiOnlyArray, "object found in smi-only array") \ 1206 V(kObjectFoundInSmiOnlyArray, "object found in smi-only array") \
1206 V(kObjectLiteralWithComplexProperty, \ 1207 V(kObjectLiteralWithComplexProperty, \
1207 "Object literal with complex property") \ 1208 "Object literal with complex property") \
1208 V(kOddballInStringTableIsNotUndefinedOrTheHole, \ 1209 V(kOddballInStringTableIsNotUndefinedOrTheHole, \
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1345
1345 #define IS_TYPE_FUNCTION_DECL(type_) inline bool Is##type_(); 1346 #define IS_TYPE_FUNCTION_DECL(type_) inline bool Is##type_();
1346 OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) 1347 OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
1347 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) 1348 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
1348 #undef IS_TYPE_FUNCTION_DECL 1349 #undef IS_TYPE_FUNCTION_DECL
1349 1350
1350 inline bool IsFixedArrayBase(); 1351 inline bool IsFixedArrayBase();
1351 inline bool IsExternal(); 1352 inline bool IsExternal();
1352 inline bool IsAccessorInfo(); 1353 inline bool IsAccessorInfo();
1353 1354
1354 // Returns true if this object is an instance of the specified
1355 // function template.
1356 inline bool IsInstanceOf(FunctionTemplateInfo* type);
1357
1358 inline bool IsStruct(); 1355 inline bool IsStruct();
1359 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); 1356 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name();
1360 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 1357 STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
1361 #undef DECLARE_STRUCT_PREDICATE 1358 #undef DECLARE_STRUCT_PREDICATE
1362 1359
1363 INLINE(bool IsSpecObject()); 1360 INLINE(bool IsSpecObject());
1364 INLINE(bool IsSpecFunction()); 1361 INLINE(bool IsSpecFunction());
1365 1362
1366 // Oddball testing. 1363 // Oddball testing.
1367 INLINE(bool IsUndefined()); 1364 INLINE(bool IsUndefined());
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 MUST_USE_RESULT inline MaybeObject* GetElement(Isolate* isolate, 1484 MUST_USE_RESULT inline MaybeObject* GetElement(Isolate* isolate,
1488 uint32_t index); 1485 uint32_t index);
1489 // For use when we know that no exception can be thrown. 1486 // For use when we know that no exception can be thrown.
1490 inline Object* GetElementNoExceptionThrown(Isolate* isolate, uint32_t index); 1487 inline Object* GetElementNoExceptionThrown(Isolate* isolate, uint32_t index);
1491 MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Isolate* isolate, 1488 MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Isolate* isolate,
1492 Object* receiver, 1489 Object* receiver,
1493 uint32_t index); 1490 uint32_t index);
1494 1491
1495 // Return the object's prototype (might be Heap::null_value()). 1492 // Return the object's prototype (might be Heap::null_value()).
1496 Object* GetPrototype(Isolate* isolate); 1493 Object* GetPrototype(Isolate* isolate);
1494 Map* GetMarkerMap(Isolate* isolate);
1497 1495
1498 // Returns the permanent hash code associated with this object. May return 1496 // Returns the permanent hash code associated with this object. May return
1499 // undefined if not yet created. 1497 // undefined if not yet created.
1500 Object* GetHash(); 1498 Object* GetHash();
1501 1499
1502 // Returns the permanent hash code associated with this object depending on 1500 // Returns the permanent hash code associated with this object depending on
1503 // the actual object type. May create and store a hash code if needed and none 1501 // the actual object type. May create and store a hash code if needed and none
1504 // exists. 1502 // exists.
1505 // TODO(rafaelw): Remove isolate parameter when objects.cc is fully 1503 // TODO(rafaelw): Remove isolate parameter when objects.cc is fully
1506 // handlified. 1504 // handlified.
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
2331 // Computes the new capacity when expanding the elements of a JSObject. 2329 // Computes the new capacity when expanding the elements of a JSObject.
2332 static int NewElementsCapacity(int old_capacity) { 2330 static int NewElementsCapacity(int old_capacity) {
2333 // (old_capacity + 50%) + 16 2331 // (old_capacity + 50%) + 16
2334 return old_capacity + (old_capacity >> 1) + 16; 2332 return old_capacity + (old_capacity >> 1) + 16;
2335 } 2333 }
2336 2334
2337 // These methods do not perform access checks! 2335 // These methods do not perform access checks!
2338 AccessorPair* GetLocalPropertyAccessorPair(Name* name); 2336 AccessorPair* GetLocalPropertyAccessorPair(Name* name);
2339 AccessorPair* GetLocalElementAccessorPair(uint32_t index); 2337 AccessorPair* GetLocalElementAccessorPair(uint32_t index);
2340 2338
2341 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, 2339 static Handle<Object> SetFastElement(Handle<JSObject> object, uint32_t index,
2342 Object* value, 2340 Handle<Object> value,
2343 StrictModeFlag strict_mode, 2341 StrictModeFlag strict_mode,
2344 bool check_prototype); 2342 bool check_prototype);
2345
2346 MUST_USE_RESULT MaybeObject* SetDictionaryElement(
2347 uint32_t index,
2348 Object* value,
2349 PropertyAttributes attributes,
2350 StrictModeFlag strict_mode,
2351 bool check_prototype,
2352 SetPropertyMode set_mode = SET_PROPERTY);
2353
2354 MUST_USE_RESULT MaybeObject* SetFastDoubleElement(
2355 uint32_t index,
2356 Object* value,
2357 StrictModeFlag strict_mode,
2358 bool check_prototype = true);
2359 2343
2360 static Handle<Object> SetOwnElement(Handle<JSObject> object, 2344 static Handle<Object> SetOwnElement(Handle<JSObject> object,
2361 uint32_t index, 2345 uint32_t index,
2362 Handle<Object> value, 2346 Handle<Object> value,
2363 StrictModeFlag strict_mode); 2347 StrictModeFlag strict_mode);
2364 2348
2365 // Empty handle is returned if the element cannot be set to the given value. 2349 // Empty handle is returned if the element cannot be set to the given value.
2366 static Handle<Object> SetElement( 2350 static Handle<Object> SetElement(
2367 Handle<JSObject> object, 2351 Handle<JSObject> object,
2368 uint32_t index, 2352 uint32_t index,
2369 Handle<Object> value, 2353 Handle<Object> value,
2370 PropertyAttributes attr,
2371 StrictModeFlag strict_mode,
2372 bool check_prototype = true,
2373 SetPropertyMode set_mode = SET_PROPERTY);
2374
2375 // A Failure object is returned if GC is needed.
2376 MUST_USE_RESULT MaybeObject* SetElement(
2377 uint32_t index,
2378 Object* value,
2379 PropertyAttributes attributes, 2354 PropertyAttributes attributes,
2380 StrictModeFlag strict_mode, 2355 StrictModeFlag strict_mode,
2381 bool check_prototype = true, 2356 bool check_prototype = true,
2382 SetPropertyMode set_mode = SET_PROPERTY); 2357 SetPropertyMode set_mode = SET_PROPERTY);
2383 2358
2384 // Returns the index'th element. 2359 // Returns the index'th element.
2385 // The undefined object if index is out of bounds. 2360 // The undefined object if index is out of bounds.
2386 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, 2361 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver,
2387 uint32_t index); 2362 uint32_t index);
2388 2363
2389 enum SetFastElementsCapacitySmiMode { 2364 enum SetFastElementsCapacitySmiMode {
2390 kAllowSmiElements, 2365 kAllowSmiElements,
2391 kForceSmiElements, 2366 kForceSmiElements,
2392 kDontAllowSmiElements 2367 kDontAllowSmiElements
2393 }; 2368 };
2394 2369
2370 static Handle<FixedArray> SetFastElementsCapacityAndLength(
2371 Handle<JSObject> object,
2372 int capacity,
2373 int length,
2374 SetFastElementsCapacitySmiMode smi_mode);
2395 // Replace the elements' backing store with fast elements of the given 2375 // Replace the elements' backing store with fast elements of the given
2396 // capacity. Update the length for JSArrays. Returns the new backing 2376 // capacity. Update the length for JSArrays. Returns the new backing
2397 // store. 2377 // store.
2398 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( 2378 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(
2399 int capacity, 2379 int capacity,
2400 int length, 2380 int length,
2401 SetFastElementsCapacitySmiMode smi_mode); 2381 SetFastElementsCapacitySmiMode smi_mode);
2382 static void SetFastDoubleElementsCapacityAndLength(
2383 Handle<JSObject> object,
2384 int capacity,
2385 int length);
2402 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 2386 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
2403 int capacity, 2387 int capacity,
2404 int length); 2388 int length);
2405 2389
2406 // Lookup interceptors are used for handling properties controlled by host 2390 // Lookup interceptors are used for handling properties controlled by host
2407 // objects. 2391 // objects.
2408 inline bool HasNamedInterceptor(); 2392 inline bool HasNamedInterceptor();
2409 inline bool HasIndexedInterceptor(); 2393 inline bool HasIndexedInterceptor();
2410 2394
2411 // Support functions for v8 api (needed for correct interceptor behavior). 2395 // Support functions for v8 api (needed for correct interceptor behavior).
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( 2445 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap(
2462 Isolate* isolate, 2446 Isolate* isolate,
2463 ElementsKind elements_kind); 2447 ElementsKind elements_kind);
2464 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( 2448 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow(
2465 ElementsKind elements_kind); 2449 ElementsKind elements_kind);
2466 2450
2467 static void TransitionElementsKind(Handle<JSObject> object, 2451 static void TransitionElementsKind(Handle<JSObject> object,
2468 ElementsKind to_kind); 2452 ElementsKind to_kind);
2469 2453
2470 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); 2454 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
2471 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2472 2455
2473 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). 2456 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty().
2474 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); 2457 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map);
2475 static void GeneralizeFieldRepresentation(Handle<JSObject> object, 2458 static void GeneralizeFieldRepresentation(Handle<JSObject> object,
2476 int modify_index, 2459 int modify_index,
2477 Representation new_representation, 2460 Representation new_representation,
2478 StoreMode store_mode); 2461 StoreMode store_mode);
2479 2462
2480 // Convert the object to use the canonical dictionary 2463 // Convert the object to use the canonical dictionary
2481 // representation. If the object is expected to have additional properties 2464 // representation. If the object is expected to have additional properties
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 Handle<Object> old_value); 2635 Handle<Object> old_value);
2653 2636
2654 // Deliver change records to observers. May cause GC. 2637 // Deliver change records to observers. May cause GC.
2655 static void DeliverChangeRecords(Isolate* isolate); 2638 static void DeliverChangeRecords(Isolate* isolate);
2656 2639
2657 private: 2640 private:
2658 friend class DictionaryElementsAccessor; 2641 friend class DictionaryElementsAccessor;
2659 friend class JSReceiver; 2642 friend class JSReceiver;
2660 friend class Object; 2643 friend class Object;
2661 2644
2645 static void UpdateAllocationSite(Handle<JSObject> object,
2646 ElementsKind to_kind);
2647 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2648
2662 // Used from Object::GetProperty(). 2649 // Used from Object::GetProperty().
2663 static Handle<Object> GetPropertyWithFailedAccessCheck( 2650 static Handle<Object> GetPropertyWithFailedAccessCheck(
2664 Handle<JSObject> object, 2651 Handle<JSObject> object,
2665 Handle<Object> receiver, 2652 Handle<Object> receiver,
2666 LookupResult* result, 2653 LookupResult* result,
2667 Handle<Name> name, 2654 Handle<Name> name,
2668 PropertyAttributes* attributes); 2655 PropertyAttributes* attributes);
2669 2656
2670 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2657 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2671 Object* structure, 2658 Object* structure,
2672 uint32_t index, 2659 uint32_t index,
2673 Object* holder); 2660 Object* holder);
2674 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( 2661 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor(
2675 JSReceiver* receiver, 2662 JSReceiver* receiver,
2676 uint32_t index, 2663 uint32_t index,
2677 bool continue_search); 2664 bool continue_search);
2678 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( 2665 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor(
2679 JSReceiver* receiver, 2666 JSReceiver* receiver,
2680 uint32_t index, 2667 uint32_t index,
2681 bool continue_search); 2668 bool continue_search);
2682 static Handle<Object> SetElementWithCallback( 2669 static Handle<Object> SetElementWithCallback(
2683 Handle<JSObject> object, 2670 Handle<JSObject> object,
2684 Handle<Object> structure, 2671 Handle<Object> structure,
2685 uint32_t index, 2672 uint32_t index,
2686 Handle<Object> value, 2673 Handle<Object> value,
2687 Handle<JSObject> holder, 2674 Handle<JSObject> holder,
2688 StrictModeFlag strict_mode); 2675 StrictModeFlag strict_mode);
2689 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( 2676 static Handle<Object> SetElementWithInterceptor(
2677 Handle<JSObject> object,
2690 uint32_t index, 2678 uint32_t index,
2691 Object* value, 2679 Handle<Object> value,
2692 PropertyAttributes attributes, 2680 PropertyAttributes attributes,
2693 StrictModeFlag strict_mode, 2681 StrictModeFlag strict_mode,
2694 bool check_prototype, 2682 bool check_prototype,
2695 SetPropertyMode set_mode); 2683 SetPropertyMode set_mode);
2696 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 2684 static Handle<Object> SetElementWithoutInterceptor(
2685 Handle<JSObject> object,
2697 uint32_t index, 2686 uint32_t index,
2698 Object* value, 2687 Handle<Object> value,
2699 PropertyAttributes attributes, 2688 PropertyAttributes attributes,
2700 StrictModeFlag strict_mode, 2689 StrictModeFlag strict_mode,
2701 bool check_prototype, 2690 bool check_prototype,
2702 SetPropertyMode set_mode); 2691 SetPropertyMode set_mode);
2703 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( 2692 static Handle<Object> SetElementWithCallbackSetterInPrototypes(
2693 Handle<JSObject> object,
2704 uint32_t index, 2694 uint32_t index,
2705 Object* value, 2695 Handle<Object> value,
2706 bool* found, 2696 bool* found,
2707 StrictModeFlag strict_mode); 2697 StrictModeFlag strict_mode);
2698 static Handle<Object> SetDictionaryElement(
2699 Handle<JSObject> object,
2700 uint32_t index,
2701 Handle<Object> value,
2702 PropertyAttributes attributes,
2703 StrictModeFlag strict_mode,
2704 bool check_prototype,
2705 SetPropertyMode set_mode = SET_PROPERTY);
2706 static Handle<Object> SetFastDoubleElement(
2707 Handle<JSObject> object,
2708 uint32_t index,
2709 Handle<Object> value,
2710 StrictModeFlag strict_mode,
2711 bool check_prototype = true);
2708 2712
2709 // Searches the prototype chain for property 'name'. If it is found and 2713 // Searches the prototype chain for property 'name'. If it is found and
2710 // has a setter, invoke it and set '*done' to true. If it is found and is 2714 // has a setter, invoke it and set '*done' to true. If it is found and is
2711 // read-only, reject and set '*done' to true. Otherwise, set '*done' to 2715 // read-only, reject and set '*done' to true. Otherwise, set '*done' to
2712 // false. Can throw and return an empty handle with '*done==true'. 2716 // false. Can throw and return an empty handle with '*done==true'.
2713 static Handle<Object> SetPropertyViaPrototypes( 2717 static Handle<Object> SetPropertyViaPrototypes(
2714 Handle<JSObject> object, 2718 Handle<JSObject> object,
2715 Handle<Name> name, 2719 Handle<Name> name,
2716 Handle<Object> value, 2720 Handle<Object> value,
2717 PropertyAttributes attributes, 2721 PropertyAttributes attributes,
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
3356 // Is the descriptor array sorted and without duplicates? 3360 // Is the descriptor array sorted and without duplicates?
3357 bool IsSortedNoDuplicates(int valid_descriptors = -1); 3361 bool IsSortedNoDuplicates(int valid_descriptors = -1);
3358 3362
3359 // Is the descriptor array consistent with the back pointers in targets? 3363 // Is the descriptor array consistent with the back pointers in targets?
3360 bool IsConsistentWithBackPointers(Map* current_map); 3364 bool IsConsistentWithBackPointers(Map* current_map);
3361 3365
3362 // Are two DescriptorArrays equal? 3366 // Are two DescriptorArrays equal?
3363 bool IsEqualTo(DescriptorArray* other); 3367 bool IsEqualTo(DescriptorArray* other);
3364 #endif 3368 #endif
3365 3369
3366 // The maximum number of descriptors we want in a descriptor array (should
3367 // fit in a page).
3368 static const int kMaxNumberOfDescriptors = 1024 + 512;
3369
3370 // Returns the fixed array length required to hold number_of_descriptors 3370 // Returns the fixed array length required to hold number_of_descriptors
3371 // descriptors. 3371 // descriptors.
3372 static int LengthFor(int number_of_descriptors) { 3372 static int LengthFor(int number_of_descriptors) {
3373 return ToKeyIndex(number_of_descriptors); 3373 return ToKeyIndex(number_of_descriptors);
3374 } 3374 }
3375 3375
3376 private: 3376 private:
3377 // An entry in a DescriptorArray, represented as an (array, index) pair. 3377 // An entry in a DescriptorArray, represented as an (array, index) pair.
3378 class Entry { 3378 class Entry {
3379 public: 3379 public:
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3959 class SeededNumberDictionary 3959 class SeededNumberDictionary
3960 : public Dictionary<SeededNumberDictionaryShape, uint32_t> { 3960 : public Dictionary<SeededNumberDictionaryShape, uint32_t> {
3961 public: 3961 public:
3962 static SeededNumberDictionary* cast(Object* obj) { 3962 static SeededNumberDictionary* cast(Object* obj) {
3963 ASSERT(obj->IsDictionary()); 3963 ASSERT(obj->IsDictionary());
3964 return reinterpret_cast<SeededNumberDictionary*>(obj); 3964 return reinterpret_cast<SeededNumberDictionary*>(obj);
3965 } 3965 }
3966 3966
3967 // Type specific at put (default NONE attributes is used when adding). 3967 // Type specific at put (default NONE attributes is used when adding).
3968 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); 3968 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
3969 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry(
3970 Handle<SeededNumberDictionary> dictionary,
3971 uint32_t key,
3972 Handle<Object> value,
3973 PropertyDetails details);
3969 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, 3974 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key,
3970 Object* value, 3975 Object* value,
3971 PropertyDetails details); 3976 PropertyDetails details);
3972 3977
3973 // Set an existing entry or add a new one if needed. 3978 // Set an existing entry or add a new one if needed.
3974 // Return the updated dictionary. 3979 // Return the updated dictionary.
3975 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( 3980 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set(
3976 Handle<SeededNumberDictionary> dictionary, 3981 Handle<SeededNumberDictionary> dictionary,
3977 uint32_t index, 3982 uint32_t index,
3978 Handle<Object> value, 3983 Handle<Object> value,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
4583 }; 4588 };
4584 4589
4585 4590
4586 class ExternalByteArray: public ExternalArray { 4591 class ExternalByteArray: public ExternalArray {
4587 public: 4592 public:
4588 // Setter and getter. 4593 // Setter and getter.
4589 inline int8_t get_scalar(int index); 4594 inline int8_t get_scalar(int index);
4590 MUST_USE_RESULT inline MaybeObject* get(int index); 4595 MUST_USE_RESULT inline MaybeObject* get(int index);
4591 inline void set(int index, int8_t value); 4596 inline void set(int index, int8_t value);
4592 4597
4598 static Handle<Object> SetValue(Handle<ExternalByteArray> array,
4599 uint32_t index,
4600 Handle<Object> value);
4601
4593 // This accessor applies the correct conversion from Smi, HeapNumber 4602 // This accessor applies the correct conversion from Smi, HeapNumber
4594 // and undefined. 4603 // and undefined.
4595 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4604 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4596 4605
4597 // Casting. 4606 // Casting.
4598 static inline ExternalByteArray* cast(Object* obj); 4607 static inline ExternalByteArray* cast(Object* obj);
4599 4608
4600 // Dispatched behavior. 4609 // Dispatched behavior.
4601 DECLARE_PRINTER(ExternalByteArray) 4610 DECLARE_PRINTER(ExternalByteArray)
4602 DECLARE_VERIFIER(ExternalByteArray) 4611 DECLARE_VERIFIER(ExternalByteArray)
4603 4612
4604 private: 4613 private:
4605 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 4614 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
4606 }; 4615 };
4607 4616
4608 4617
4609 class ExternalUnsignedByteArray: public ExternalArray { 4618 class ExternalUnsignedByteArray: public ExternalArray {
4610 public: 4619 public:
4611 // Setter and getter. 4620 // Setter and getter.
4612 inline uint8_t get_scalar(int index); 4621 inline uint8_t get_scalar(int index);
4613 MUST_USE_RESULT inline MaybeObject* get(int index); 4622 MUST_USE_RESULT inline MaybeObject* get(int index);
4614 inline void set(int index, uint8_t value); 4623 inline void set(int index, uint8_t value);
4615 4624
4625 static Handle<Object> SetValue(Handle<ExternalUnsignedByteArray> array,
4626 uint32_t index,
4627 Handle<Object> value);
4628
4616 // This accessor applies the correct conversion from Smi, HeapNumber 4629 // This accessor applies the correct conversion from Smi, HeapNumber
4617 // and undefined. 4630 // and undefined.
4618 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4631 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4619 4632
4620 // Casting. 4633 // Casting.
4621 static inline ExternalUnsignedByteArray* cast(Object* obj); 4634 static inline ExternalUnsignedByteArray* cast(Object* obj);
4622 4635
4623 // Dispatched behavior. 4636 // Dispatched behavior.
4624 DECLARE_PRINTER(ExternalUnsignedByteArray) 4637 DECLARE_PRINTER(ExternalUnsignedByteArray)
4625 DECLARE_VERIFIER(ExternalUnsignedByteArray) 4638 DECLARE_VERIFIER(ExternalUnsignedByteArray)
4626 4639
4627 private: 4640 private:
4628 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 4641 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
4629 }; 4642 };
4630 4643
4631 4644
4632 class ExternalShortArray: public ExternalArray { 4645 class ExternalShortArray: public ExternalArray {
4633 public: 4646 public:
4634 // Setter and getter. 4647 // Setter and getter.
4635 inline int16_t get_scalar(int index); 4648 inline int16_t get_scalar(int index);
4636 MUST_USE_RESULT inline MaybeObject* get(int index); 4649 MUST_USE_RESULT inline MaybeObject* get(int index);
4637 inline void set(int index, int16_t value); 4650 inline void set(int index, int16_t value);
4638 4651
4652 static Handle<Object> SetValue(Handle<ExternalShortArray> array,
4653 uint32_t index,
4654 Handle<Object> value);
4655
4639 // This accessor applies the correct conversion from Smi, HeapNumber 4656 // This accessor applies the correct conversion from Smi, HeapNumber
4640 // and undefined. 4657 // and undefined.
4641 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4658 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4642 4659
4643 // Casting. 4660 // Casting.
4644 static inline ExternalShortArray* cast(Object* obj); 4661 static inline ExternalShortArray* cast(Object* obj);
4645 4662
4646 // Dispatched behavior. 4663 // Dispatched behavior.
4647 DECLARE_PRINTER(ExternalShortArray) 4664 DECLARE_PRINTER(ExternalShortArray)
4648 DECLARE_VERIFIER(ExternalShortArray) 4665 DECLARE_VERIFIER(ExternalShortArray)
4649 4666
4650 private: 4667 private:
4651 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 4668 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
4652 }; 4669 };
4653 4670
4654 4671
4655 class ExternalUnsignedShortArray: public ExternalArray { 4672 class ExternalUnsignedShortArray: public ExternalArray {
4656 public: 4673 public:
4657 // Setter and getter. 4674 // Setter and getter.
4658 inline uint16_t get_scalar(int index); 4675 inline uint16_t get_scalar(int index);
4659 MUST_USE_RESULT inline MaybeObject* get(int index); 4676 MUST_USE_RESULT inline MaybeObject* get(int index);
4660 inline void set(int index, uint16_t value); 4677 inline void set(int index, uint16_t value);
4661 4678
4679 static Handle<Object> SetValue(Handle<ExternalUnsignedShortArray> array,
4680 uint32_t index,
4681 Handle<Object> value);
4682
4662 // This accessor applies the correct conversion from Smi, HeapNumber 4683 // This accessor applies the correct conversion from Smi, HeapNumber
4663 // and undefined. 4684 // and undefined.
4664 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4685 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4665 4686
4666 // Casting. 4687 // Casting.
4667 static inline ExternalUnsignedShortArray* cast(Object* obj); 4688 static inline ExternalUnsignedShortArray* cast(Object* obj);
4668 4689
4669 // Dispatched behavior. 4690 // Dispatched behavior.
4670 DECLARE_PRINTER(ExternalUnsignedShortArray) 4691 DECLARE_PRINTER(ExternalUnsignedShortArray)
4671 DECLARE_VERIFIER(ExternalUnsignedShortArray) 4692 DECLARE_VERIFIER(ExternalUnsignedShortArray)
4672 4693
4673 private: 4694 private:
4674 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 4695 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
4675 }; 4696 };
4676 4697
4677 4698
4678 class ExternalIntArray: public ExternalArray { 4699 class ExternalIntArray: public ExternalArray {
4679 public: 4700 public:
4680 // Setter and getter. 4701 // Setter and getter.
4681 inline int32_t get_scalar(int index); 4702 inline int32_t get_scalar(int index);
4682 MUST_USE_RESULT inline MaybeObject* get(int index); 4703 MUST_USE_RESULT inline MaybeObject* get(int index);
4683 inline void set(int index, int32_t value); 4704 inline void set(int index, int32_t value);
4684 4705
4706 static Handle<Object> SetValue(Handle<ExternalIntArray> array,
4707 uint32_t index,
4708 Handle<Object> value);
4709
4685 // This accessor applies the correct conversion from Smi, HeapNumber 4710 // This accessor applies the correct conversion from Smi, HeapNumber
4686 // and undefined. 4711 // and undefined.
4687 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4712 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4688 4713
4689 // Casting. 4714 // Casting.
4690 static inline ExternalIntArray* cast(Object* obj); 4715 static inline ExternalIntArray* cast(Object* obj);
4691 4716
4692 // Dispatched behavior. 4717 // Dispatched behavior.
4693 DECLARE_PRINTER(ExternalIntArray) 4718 DECLARE_PRINTER(ExternalIntArray)
4694 DECLARE_VERIFIER(ExternalIntArray) 4719 DECLARE_VERIFIER(ExternalIntArray)
4695 4720
4696 private: 4721 private:
4697 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 4722 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
4698 }; 4723 };
4699 4724
4700 4725
4701 class ExternalUnsignedIntArray: public ExternalArray { 4726 class ExternalUnsignedIntArray: public ExternalArray {
4702 public: 4727 public:
4703 // Setter and getter. 4728 // Setter and getter.
4704 inline uint32_t get_scalar(int index); 4729 inline uint32_t get_scalar(int index);
4705 MUST_USE_RESULT inline MaybeObject* get(int index); 4730 MUST_USE_RESULT inline MaybeObject* get(int index);
4706 inline void set(int index, uint32_t value); 4731 inline void set(int index, uint32_t value);
4707 4732
4733 static Handle<Object> SetValue(Handle<ExternalUnsignedIntArray> array,
4734 uint32_t index,
4735 Handle<Object> value);
4736
4708 // This accessor applies the correct conversion from Smi, HeapNumber 4737 // This accessor applies the correct conversion from Smi, HeapNumber
4709 // and undefined. 4738 // and undefined.
4710 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4739 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4711 4740
4712 // Casting. 4741 // Casting.
4713 static inline ExternalUnsignedIntArray* cast(Object* obj); 4742 static inline ExternalUnsignedIntArray* cast(Object* obj);
4714 4743
4715 // Dispatched behavior. 4744 // Dispatched behavior.
4716 DECLARE_PRINTER(ExternalUnsignedIntArray) 4745 DECLARE_PRINTER(ExternalUnsignedIntArray)
4717 DECLARE_VERIFIER(ExternalUnsignedIntArray) 4746 DECLARE_VERIFIER(ExternalUnsignedIntArray)
4718 4747
4719 private: 4748 private:
4720 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 4749 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
4721 }; 4750 };
4722 4751
4723 4752
4724 class ExternalFloatArray: public ExternalArray { 4753 class ExternalFloatArray: public ExternalArray {
4725 public: 4754 public:
4726 // Setter and getter. 4755 // Setter and getter.
4727 inline float get_scalar(int index); 4756 inline float get_scalar(int index);
4728 MUST_USE_RESULT inline MaybeObject* get(int index); 4757 MUST_USE_RESULT inline MaybeObject* get(int index);
4729 inline void set(int index, float value); 4758 inline void set(int index, float value);
4730 4759
4760 static Handle<Object> SetValue(Handle<ExternalFloatArray> array,
4761 uint32_t index,
4762 Handle<Object> value);
4763
4731 // This accessor applies the correct conversion from Smi, HeapNumber 4764 // This accessor applies the correct conversion from Smi, HeapNumber
4732 // and undefined. 4765 // and undefined.
4733 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4766 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4734 4767
4735 // Casting. 4768 // Casting.
4736 static inline ExternalFloatArray* cast(Object* obj); 4769 static inline ExternalFloatArray* cast(Object* obj);
4737 4770
4738 // Dispatched behavior. 4771 // Dispatched behavior.
4739 DECLARE_PRINTER(ExternalFloatArray) 4772 DECLARE_PRINTER(ExternalFloatArray)
4740 DECLARE_VERIFIER(ExternalFloatArray) 4773 DECLARE_VERIFIER(ExternalFloatArray)
4741 4774
4742 private: 4775 private:
4743 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 4776 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
4744 }; 4777 };
4745 4778
4746 4779
4747 class ExternalDoubleArray: public ExternalArray { 4780 class ExternalDoubleArray: public ExternalArray {
4748 public: 4781 public:
4749 // Setter and getter. 4782 // Setter and getter.
4750 inline double get_scalar(int index); 4783 inline double get_scalar(int index);
4751 MUST_USE_RESULT inline MaybeObject* get(int index); 4784 MUST_USE_RESULT inline MaybeObject* get(int index);
4752 inline void set(int index, double value); 4785 inline void set(int index, double value);
4753 4786
4787 static Handle<Object> SetValue(Handle<ExternalDoubleArray> array,
4788 uint32_t index,
4789 Handle<Object> value);
4790
4754 // This accessor applies the correct conversion from Smi, HeapNumber 4791 // This accessor applies the correct conversion from Smi, HeapNumber
4755 // and undefined. 4792 // and undefined.
4756 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4793 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4757 4794
4758 // Casting. 4795 // Casting.
4759 static inline ExternalDoubleArray* cast(Object* obj); 4796 static inline ExternalDoubleArray* cast(Object* obj);
4760 4797
4761 // Dispatched behavior. 4798 // Dispatched behavior.
4762 DECLARE_PRINTER(ExternalDoubleArray) 4799 DECLARE_PRINTER(ExternalDoubleArray)
4763 DECLARE_VERIFIER(ExternalDoubleArray) 4800 DECLARE_VERIFIER(ExternalDoubleArray)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
4986 5023
4987 // No more than 16 kinds. The value is currently encoded in four bits in 5024 // No more than 16 kinds. The value is currently encoded in four bits in
4988 // Flags. 5025 // Flags.
4989 STATIC_ASSERT(NUMBER_OF_KINDS <= 16); 5026 STATIC_ASSERT(NUMBER_OF_KINDS <= 16);
4990 5027
4991 static const char* Kind2String(Kind kind); 5028 static const char* Kind2String(Kind kind);
4992 5029
4993 // Types of stubs. 5030 // Types of stubs.
4994 enum StubType { 5031 enum StubType {
4995 NORMAL, 5032 NORMAL,
4996 FIELD, 5033 FAST
4997 CONSTANT,
4998 CALLBACKS,
4999 INTERCEPTOR,
5000 TRANSITION,
5001 NONEXISTENT
5002 }; 5034 };
5003 5035
5004 typedef int ExtraICState; 5036 typedef int ExtraICState;
5005 5037
5006 static const ExtraICState kNoExtraICState = 0; 5038 static const ExtraICState kNoExtraICState = 0;
5007 5039
5008 static const int kPrologueOffsetNotSet = -1; 5040 static const int kPrologueOffsetNotSet = -1;
5009 5041
5010 #ifdef ENABLE_DISASSEMBLER 5042 #ifdef ENABLE_DISASSEMBLER
5011 // Printing 5043 // Printing
5012 static const char* ICState2String(InlineCacheState state); 5044 static const char* ICState2String(InlineCacheState state);
5013 static const char* StubType2String(StubType type); 5045 static const char* StubType2String(StubType type);
5014 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); 5046 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra);
5015 void Disassemble(const char* name, FILE* out = stdout); 5047 void Disassemble(const char* name, FILE* out = stdout);
5016 #endif // ENABLE_DISASSEMBLER 5048 #endif // ENABLE_DISASSEMBLER
5017 5049
5018 // [instruction_size]: Size of the native instructions 5050 // [instruction_size]: Size of the native instructions
5019 inline int instruction_size(); 5051 inline int instruction_size();
5020 inline void set_instruction_size(int value); 5052 inline void set_instruction_size(int value);
5021 5053
5022 // [relocation_info]: Code relocation information 5054 // [relocation_info]: Code relocation information
5023 DECL_ACCESSORS(relocation_info, ByteArray) 5055 DECL_ACCESSORS(relocation_info, ByteArray)
5024 void InvalidateRelocation(); 5056 void InvalidateRelocation();
5057 void InvalidateEmbeddedObjects();
5025 5058
5026 // [handler_table]: Fixed array containing offsets of exception handlers. 5059 // [handler_table]: Fixed array containing offsets of exception handlers.
5027 DECL_ACCESSORS(handler_table, FixedArray) 5060 DECL_ACCESSORS(handler_table, FixedArray)
5028 5061
5029 // [deoptimization_data]: Array containing data for deopt. 5062 // [deoptimization_data]: Array containing data for deopt.
5030 DECL_ACCESSORS(deoptimization_data, FixedArray) 5063 DECL_ACCESSORS(deoptimization_data, FixedArray)
5031 5064
5032 // [raw_type_feedback_info]: This field stores various things, depending on 5065 // [raw_type_feedback_info]: This field stores various things, depending on
5033 // the kind of the code object. 5066 // the kind of the code object.
5034 // FUNCTION => type feedback information. 5067 // FUNCTION => type feedback information.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
5102 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } 5135 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; }
5103 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } 5136 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; }
5104 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } 5137 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
5105 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; } 5138 inline bool is_compare_nil_ic_stub() { return kind() == COMPARE_NIL_IC; }
5106 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; } 5139 inline bool is_to_boolean_ic_stub() { return kind() == TO_BOOLEAN_IC; }
5107 inline bool is_keyed_stub(); 5140 inline bool is_keyed_stub();
5108 5141
5109 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. 5142 // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
5110 inline int major_key(); 5143 inline int major_key();
5111 inline void set_major_key(int value); 5144 inline void set_major_key(int value);
5145 inline bool has_major_key();
5112 5146
5113 // For kind STUB or ICs, tells whether or not a code object was generated by 5147 // For kind STUB or ICs, tells whether or not a code object was generated by
5114 // the optimizing compiler (but it may not be an optimized function). 5148 // the optimizing compiler (but it may not be an optimized function).
5115 bool is_crankshafted(); 5149 bool is_crankshafted();
5116 inline void set_is_crankshafted(bool value); 5150 inline void set_is_crankshafted(bool value);
5117 5151
5118 // For stubs, tells whether they should always exist, so that they can be 5152 // For stubs, tells whether they should always exist, so that they can be
5119 // called from other stubs. 5153 // called from other stubs.
5120 inline bool is_pregenerated(); 5154 inline bool is_pregenerated();
5121 inline void set_is_pregenerated(bool value); 5155 inline void set_is_pregenerated(bool value);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 // Get the safepoint entry for the given pc. 5225 // Get the safepoint entry for the given pc.
5192 SafepointEntry GetSafepointEntry(Address pc); 5226 SafepointEntry GetSafepointEntry(Address pc);
5193 5227
5194 // Find an object in a stub with a specified map 5228 // Find an object in a stub with a specified map
5195 Object* FindNthObject(int n, Map* match_map); 5229 Object* FindNthObject(int n, Map* match_map);
5196 void ReplaceNthObject(int n, Map* match_map, Object* replace_with); 5230 void ReplaceNthObject(int n, Map* match_map, Object* replace_with);
5197 5231
5198 // Find the first map in an IC stub. 5232 // Find the first map in an IC stub.
5199 Map* FindFirstMap(); 5233 Map* FindFirstMap();
5200 void FindAllMaps(MapHandleList* maps); 5234 void FindAllMaps(MapHandleList* maps);
5235 void FindAllTypes(TypeHandleList* types);
5201 void ReplaceFirstMap(Map* replace); 5236 void ReplaceFirstMap(Map* replace);
5202 5237
5203 // Find the first handler in an IC stub. 5238 // Find the first handler in an IC stub.
5204 Code* FindFirstHandler(); 5239 Code* FindFirstHandler();
5205 5240
5206 // Find |length| handlers and put them into |code_list|. Returns false if not 5241 // Find |length| handlers and put them into |code_list|. Returns false if not
5207 // enough handlers can be found. 5242 // enough handlers can be found.
5208 bool FindHandlers(CodeHandleList* code_list, int length = -1); 5243 bool FindHandlers(CodeHandleList* code_list, int length = -1);
5209 5244
5210 // Find the first name in an IC stub. 5245 // Find the first name in an IC stub.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
5246 Kind kind, 5281 Kind kind,
5247 InlineCacheState ic_state = UNINITIALIZED, 5282 InlineCacheState ic_state = UNINITIALIZED,
5248 ExtraICState extra_ic_state = kNoExtraICState, 5283 ExtraICState extra_ic_state = kNoExtraICState,
5249 StubType type = NORMAL, 5284 StubType type = NORMAL,
5250 int argc = -1, 5285 int argc = -1,
5251 InlineCacheHolderFlag holder = OWN_MAP); 5286 InlineCacheHolderFlag holder = OWN_MAP);
5252 5287
5253 static inline Flags ComputeMonomorphicFlags( 5288 static inline Flags ComputeMonomorphicFlags(
5254 Kind kind, 5289 Kind kind,
5255 ExtraICState extra_ic_state = kNoExtraICState, 5290 ExtraICState extra_ic_state = kNoExtraICState,
5291 InlineCacheHolderFlag holder = OWN_MAP,
5256 StubType type = NORMAL, 5292 StubType type = NORMAL,
5257 int argc = -1, 5293 int argc = -1);
5258 InlineCacheHolderFlag holder = OWN_MAP);
5259 5294
5260 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); 5295 static inline InlineCacheState ExtractICStateFromFlags(Flags flags);
5261 static inline StubType ExtractTypeFromFlags(Flags flags); 5296 static inline StubType ExtractTypeFromFlags(Flags flags);
5262 static inline Kind ExtractKindFromFlags(Flags flags); 5297 static inline Kind ExtractKindFromFlags(Flags flags);
5263 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); 5298 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
5264 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags); 5299 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
5265 static inline ExtraICState ExtractExtendedExtraICStateFromFlags(Flags flags); 5300 static inline ExtraICState ExtractExtendedExtraICStateFromFlags(Flags flags);
5266 static inline int ExtractArgumentsCountFromFlags(Flags flags); 5301 static inline int ExtractArgumentsCountFromFlags(Flags flags);
5267 5302
5268 static inline Flags RemoveTypeFromFlags(Flags flags); 5303 static inline Flags RemoveTypeFromFlags(Flags flags);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
5416 class FullCodeFlagsHasDeoptimizationSupportField: 5451 class FullCodeFlagsHasDeoptimizationSupportField:
5417 public BitField<bool, 0, 1> {}; // NOLINT 5452 public BitField<bool, 0, 1> {}; // NOLINT
5418 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {}; 5453 class FullCodeFlagsHasDebugBreakSlotsField: public BitField<bool, 1, 1> {};
5419 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {}; 5454 class FullCodeFlagsIsCompiledOptimizable: public BitField<bool, 2, 1> {};
5420 5455
5421 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1; 5456 static const int kAllowOSRAtLoopNestingLevelOffset = kFullCodeFlags + 1;
5422 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1; 5457 static const int kProfilerTicksOffset = kAllowOSRAtLoopNestingLevelOffset + 1;
5423 5458
5424 // Flags layout. BitField<type, shift, size>. 5459 // Flags layout. BitField<type, shift, size>.
5425 class ICStateField: public BitField<InlineCacheState, 0, 3> {}; 5460 class ICStateField: public BitField<InlineCacheState, 0, 3> {};
5426 class TypeField: public BitField<StubType, 3, 3> {}; 5461 class TypeField: public BitField<StubType, 3, 1> {};
5427 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {}; 5462 class CacheHolderField: public BitField<InlineCacheHolderFlag, 6, 1> {};
5428 class KindField: public BitField<Kind, 7, 4> {}; 5463 class KindField: public BitField<Kind, 7, 4> {};
5429 class IsPregeneratedField: public BitField<bool, 11, 1> {}; 5464 class IsPregeneratedField: public BitField<bool, 11, 1> {};
5430 class ExtraICStateField: public BitField<ExtraICState, 12, 5> {}; 5465 class ExtraICStateField: public BitField<ExtraICState, 12, 5> {};
5431 class ExtendedExtraICStateField: public BitField<ExtraICState, 12, 5466 class ExtendedExtraICStateField: public BitField<ExtraICState, 12,
5432 PlatformSmiTagging::kSmiValueSize - 12 + 1> {}; // NOLINT 5467 PlatformSmiTagging::kSmiValueSize - 12 + 1> {}; // NOLINT
5433 STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift); 5468 STATIC_ASSERT(ExtraICStateField::kShift == ExtendedExtraICStateField::kShift);
5434 5469
5435 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION) 5470 // KindSpecificFlags1 layout (STUB and OPTIMIZED_FUNCTION)
5436 static const int kStackSlotsFirstBit = 0; 5471 static const int kStackSlotsFirstBit = 0;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5558 // described by this map. The group is deoptimized whenever an object 5593 // described by this map. The group is deoptimized whenever an object
5559 // described by this map changes shape (and transitions to a new map), 5594 // described by this map changes shape (and transitions to a new map),
5560 // possibly invalidating the assumptions embedded in the code. 5595 // possibly invalidating the assumptions embedded in the code.
5561 kPrototypeCheckGroup, 5596 kPrototypeCheckGroup,
5562 // Group of code that depends on elements not being added to objects with 5597 // Group of code that depends on elements not being added to objects with
5563 // this map. 5598 // this map.
5564 kElementsCantBeAddedGroup, 5599 kElementsCantBeAddedGroup,
5565 // Group of code that depends on global property values in property cells 5600 // Group of code that depends on global property values in property cells
5566 // not being changed. 5601 // not being changed.
5567 kPropertyCellChangedGroup, 5602 kPropertyCellChangedGroup,
5568 kGroupCount = kPropertyCellChangedGroup + 1 5603 // Group of code that depends on tenuring information in AllocationSites
5604 // not being changed.
5605 kAllocationSiteTenuringChangedGroup,
5606 // Group of code that depends on element transition information in
5607 // AllocationSites not being changed.
5608 kAllocationSiteTransitionChangedGroup,
5609 kGroupCount = kAllocationSiteTransitionChangedGroup + 1
5569 }; 5610 };
5570 5611
5571 // Array for holding the index of the first code object of each group. 5612 // Array for holding the index of the first code object of each group.
5572 // The last element stores the total number of code objects. 5613 // The last element stores the total number of code objects.
5573 class GroupStartIndexes { 5614 class GroupStartIndexes {
5574 public: 5615 public:
5575 explicit GroupStartIndexes(DependentCode* entries); 5616 explicit GroupStartIndexes(DependentCode* entries);
5576 void Recompute(DependentCode* entries); 5617 void Recompute(DependentCode* entries);
5577 int at(int i) { return start_indexes_[i]; } 5618 int at(int i) { return start_indexes_[i]; }
5578 int number_of_entries() { return start_indexes_[kGroupCount]; } 5619 int number_of_entries() { return start_indexes_[kGroupCount]; }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 inline void set_bit_field(byte value); 5693 inline void set_bit_field(byte value);
5653 5694
5654 // Bit field 2. 5695 // Bit field 2.
5655 inline byte bit_field2(); 5696 inline byte bit_field2();
5656 inline void set_bit_field2(byte value); 5697 inline void set_bit_field2(byte value);
5657 5698
5658 // Bit field 3. 5699 // Bit field 3.
5659 inline uint32_t bit_field3(); 5700 inline uint32_t bit_field3();
5660 inline void set_bit_field3(uint32_t bits); 5701 inline void set_bit_field3(uint32_t bits);
5661 5702
5662 class EnumLengthBits: public BitField<int, 0, 11> {}; 5703 class EnumLengthBits: public BitField<int,
5663 class NumberOfOwnDescriptorsBits: public BitField<int, 11, 11> {}; 5704 0, kDescriptorIndexBitCount> {}; // NOLINT
5664 class IsShared: public BitField<bool, 22, 1> {}; 5705 class NumberOfOwnDescriptorsBits: public BitField<int,
5665 class FunctionWithPrototype: public BitField<bool, 23, 1> {}; 5706 kDescriptorIndexBitCount, kDescriptorIndexBitCount> {}; // NOLINT
5666 class DictionaryMap: public BitField<bool, 24, 1> {}; 5707 STATIC_ASSERT(kDescriptorIndexBitCount + kDescriptorIndexBitCount == 20);
5667 class OwnsDescriptors: public BitField<bool, 25, 1> {}; 5708 class IsShared: public BitField<bool, 20, 1> {};
5668 class IsObserved: public BitField<bool, 26, 1> {}; 5709 class FunctionWithPrototype: public BitField<bool, 21, 1> {};
5669 class Deprecated: public BitField<bool, 27, 1> {}; 5710 class DictionaryMap: public BitField<bool, 22, 1> {};
5670 class IsFrozen: public BitField<bool, 28, 1> {}; 5711 class OwnsDescriptors: public BitField<bool, 23, 1> {};
5671 class IsUnstable: public BitField<bool, 29, 1> {}; 5712 class HasInstanceCallHandler: public BitField<bool, 24, 1> {};
5672 class IsMigrationTarget: public BitField<bool, 30, 1> {}; 5713 class Deprecated: public BitField<bool, 25, 1> {};
5714 class IsFrozen: public BitField<bool, 26, 1> {};
5715 class IsUnstable: public BitField<bool, 27, 1> {};
5716 class IsMigrationTarget: public BitField<bool, 28, 1> {};
5673 5717
5674 // Tells whether the object in the prototype property will be used 5718 // Tells whether the object in the prototype property will be used
5675 // for instances created from this function. If the prototype 5719 // for instances created from this function. If the prototype
5676 // property is set to a value that is not a JSObject, the prototype 5720 // property is set to a value that is not a JSObject, the prototype
5677 // property will not be used to create instances of the function. 5721 // property will not be used to create instances of the function.
5678 // See ECMA-262, 13.2.2. 5722 // See ECMA-262, 13.2.2.
5679 inline void set_non_instance_prototype(bool value); 5723 inline void set_non_instance_prototype(bool value);
5680 inline bool has_non_instance_prototype(); 5724 inline bool has_non_instance_prototype();
5681 5725
5682 // Tells whether function has special prototype property. If not, prototype 5726 // Tells whether function has special prototype property. If not, prototype
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5721 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549. 5765 // See https://bugzilla.mozilla.org/show_bug.cgi?id=248549.
5722 inline void set_is_undetectable() { 5766 inline void set_is_undetectable() {
5723 set_bit_field(bit_field() | (1 << kIsUndetectable)); 5767 set_bit_field(bit_field() | (1 << kIsUndetectable));
5724 } 5768 }
5725 5769
5726 inline bool is_undetectable() { 5770 inline bool is_undetectable() {
5727 return ((1 << kIsUndetectable) & bit_field()) != 0; 5771 return ((1 << kIsUndetectable) & bit_field()) != 0;
5728 } 5772 }
5729 5773
5730 // Tells whether the instance has a call-as-function handler. 5774 // Tells whether the instance has a call-as-function handler.
5731 inline void set_has_instance_call_handler() { 5775 inline void set_is_observed() {
5732 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); 5776 set_bit_field(bit_field() | (1 << kIsObserved));
5733 } 5777 }
5734 5778
5735 inline bool has_instance_call_handler() { 5779 inline bool is_observed() {
5736 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; 5780 return ((1 << kIsObserved) & bit_field()) != 0;
5737 } 5781 }
5738 5782
5739 inline void set_is_extensible(bool value); 5783 inline void set_is_extensible(bool value);
5740 inline bool is_extensible(); 5784 inline bool is_extensible();
5741 5785
5742 inline void set_elements_kind(ElementsKind elements_kind) { 5786 inline void set_elements_kind(ElementsKind elements_kind) {
5743 ASSERT(elements_kind < kElementsKindCount); 5787 ASSERT(elements_kind < kElementsKindCount);
5744 ASSERT(kElementsKindCount <= (1 << kElementsKindBitCount)); 5788 ASSERT(kElementsKindCount <= (1 << kElementsKindBitCount));
5745 ASSERT(!is_observed() ||
5746 elements_kind == DICTIONARY_ELEMENTS ||
5747 elements_kind == NON_STRICT_ARGUMENTS_ELEMENTS ||
5748 IsExternalArrayElementsKind(elements_kind));
5749 set_bit_field2((bit_field2() & ~kElementsKindMask) | 5789 set_bit_field2((bit_field2() & ~kElementsKindMask) |
5750 (elements_kind << kElementsKindShift)); 5790 (elements_kind << kElementsKindShift));
5751 ASSERT(this->elements_kind() == elements_kind); 5791 ASSERT(this->elements_kind() == elements_kind);
5752 } 5792 }
5753 5793
5754 inline ElementsKind elements_kind() { 5794 inline ElementsKind elements_kind() {
5755 return static_cast<ElementsKind>( 5795 return static_cast<ElementsKind>(
5756 (bit_field2() & kElementsKindMask) >> kElementsKindShift); 5796 (bit_field2() & kElementsKindMask) >> kElementsKindShift);
5757 } 5797 }
5758 5798
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
5981 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number)); 6021 set_bit_field3(NumberOfOwnDescriptorsBits::update(bit_field3(), number));
5982 } 6022 }
5983 6023
5984 inline Cell* RetrieveDescriptorsPointer(); 6024 inline Cell* RetrieveDescriptorsPointer();
5985 6025
5986 int EnumLength() { 6026 int EnumLength() {
5987 return EnumLengthBits::decode(bit_field3()); 6027 return EnumLengthBits::decode(bit_field3());
5988 } 6028 }
5989 6029
5990 void SetEnumLength(int length) { 6030 void SetEnumLength(int length) {
5991 if (length != kInvalidEnumCache) { 6031 if (length != kInvalidEnumCacheSentinel) {
5992 ASSERT(length >= 0); 6032 ASSERT(length >= 0);
5993 ASSERT(length == 0 || instance_descriptors()->HasEnumCache()); 6033 ASSERT(length == 0 || instance_descriptors()->HasEnumCache());
5994 ASSERT(length <= NumberOfOwnDescriptors()); 6034 ASSERT(length <= NumberOfOwnDescriptors());
5995 } 6035 }
5996 set_bit_field3(EnumLengthBits::update(bit_field3(), length)); 6036 set_bit_field3(EnumLengthBits::update(bit_field3(), length));
5997 } 6037 }
5998 6038
5999 inline bool owns_descriptors(); 6039 inline bool owns_descriptors();
6000 inline void set_owns_descriptors(bool is_shared); 6040 inline void set_owns_descriptors(bool is_shared);
6001 inline bool is_observed(); 6041 inline bool has_instance_call_handler();
6002 inline void set_is_observed(bool is_observed); 6042 inline void set_has_instance_call_handler();
6003 inline void freeze(); 6043 inline void freeze();
6004 inline bool is_frozen(); 6044 inline bool is_frozen();
6005 inline void mark_unstable(); 6045 inline void mark_unstable();
6006 inline bool is_stable(); 6046 inline bool is_stable();
6007 inline void set_migration_target(bool value); 6047 inline void set_migration_target(bool value);
6008 inline bool is_migration_target(); 6048 inline bool is_migration_target();
6009 inline void deprecate(); 6049 inline void deprecate();
6010 inline bool is_deprecated(); 6050 inline bool is_deprecated();
6011 inline bool CanBeDeprecated(); 6051 inline bool CanBeDeprecated();
6012 // Returns a non-deprecated version of the input. If the input was not 6052 // Returns a non-deprecated version of the input. If the input was not
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
6199 // and the values are the maps the are transitioned to. 6239 // and the values are the maps the are transitioned to.
6200 static const int kMaxCachedPrototypeTransitions = 256; 6240 static const int kMaxCachedPrototypeTransitions = 256;
6201 static Handle<Map> GetPrototypeTransition(Handle<Map> map, 6241 static Handle<Map> GetPrototypeTransition(Handle<Map> map,
6202 Handle<Object> prototype); 6242 Handle<Object> prototype);
6203 static Handle<Map> PutPrototypeTransition(Handle<Map> map, 6243 static Handle<Map> PutPrototypeTransition(Handle<Map> map,
6204 Handle<Object> prototype, 6244 Handle<Object> prototype,
6205 Handle<Map> target_map); 6245 Handle<Map> target_map);
6206 6246
6207 static const int kMaxPreAllocatedPropertyFields = 255; 6247 static const int kMaxPreAllocatedPropertyFields = 255;
6208 6248
6209 // Constant for denoting that the enum cache is not yet initialized.
6210 static const int kInvalidEnumCache = EnumLengthBits::kMax;
6211
6212 // Layout description. 6249 // Layout description.
6213 static const int kInstanceSizesOffset = HeapObject::kHeaderSize; 6250 static const int kInstanceSizesOffset = HeapObject::kHeaderSize;
6214 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize; 6251 static const int kInstanceAttributesOffset = kInstanceSizesOffset + kIntSize;
6215 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize; 6252 static const int kPrototypeOffset = kInstanceAttributesOffset + kIntSize;
6216 static const int kConstructorOffset = kPrototypeOffset + kPointerSize; 6253 static const int kConstructorOffset = kPrototypeOffset + kPointerSize;
6217 // Storage for the transition array is overloaded to directly contain a back 6254 // Storage for the transition array is overloaded to directly contain a back
6218 // pointer if unused. When the map has transitions, the back pointer is 6255 // pointer if unused. When the map has transitions, the back pointer is
6219 // transferred to the transition array and accessed through an extra 6256 // transferred to the transition array and accessed through an extra
6220 // indirection. 6257 // indirection.
6221 static const int kTransitionsOrBackPointerOffset = 6258 static const int kTransitionsOrBackPointerOffset =
(...skipping 29 matching lines...) Expand all
6251 6288
6252 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset); 6289 STATIC_CHECK(kInstanceTypeOffset == Internals::kMapInstanceTypeOffset);
6253 6290
6254 // Bit positions for bit field. 6291 // Bit positions for bit field.
6255 static const int kUnused = 0; // To be used for marking recently used maps. 6292 static const int kUnused = 0; // To be used for marking recently used maps.
6256 static const int kHasNonInstancePrototype = 1; 6293 static const int kHasNonInstancePrototype = 1;
6257 static const int kIsHiddenPrototype = 2; 6294 static const int kIsHiddenPrototype = 2;
6258 static const int kHasNamedInterceptor = 3; 6295 static const int kHasNamedInterceptor = 3;
6259 static const int kHasIndexedInterceptor = 4; 6296 static const int kHasIndexedInterceptor = 4;
6260 static const int kIsUndetectable = 5; 6297 static const int kIsUndetectable = 5;
6261 static const int kHasInstanceCallHandler = 6; 6298 static const int kIsObserved = 6;
6262 static const int kIsAccessCheckNeeded = 7; 6299 static const int kIsAccessCheckNeeded = 7;
6263 6300
6264 // Bit positions for bit field 2 6301 // Bit positions for bit field 2
6265 static const int kIsExtensible = 0; 6302 static const int kIsExtensible = 0;
6266 static const int kStringWrapperSafeForDefaultValueOf = 1; 6303 static const int kStringWrapperSafeForDefaultValueOf = 1;
6267 static const int kAttachedToSharedFunctionInfo = 2; 6304 static const int kAttachedToSharedFunctionInfo = 2;
6268 // No bits can be used after kElementsKindFirstBit, they are all reserved for 6305 // No bits can be used after kElementsKindFirstBit, they are all reserved for
6269 // storing ElementKind. 6306 // storing ElementKind.
6270 static const int kElementsKindShift = 3; 6307 static const int kElementsKindShift = 3;
6271 static const int kElementsKindBitCount = 5; 6308 static const int kElementsKindBitCount = 5;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
6464 V(Math, log, MathLog) \ 6501 V(Math, log, MathLog) \
6465 V(Math, sin, MathSin) \ 6502 V(Math, sin, MathSin) \
6466 V(Math, cos, MathCos) \ 6503 V(Math, cos, MathCos) \
6467 V(Math, tan, MathTan) \ 6504 V(Math, tan, MathTan) \
6468 V(Math, asin, MathASin) \ 6505 V(Math, asin, MathASin) \
6469 V(Math, acos, MathACos) \ 6506 V(Math, acos, MathACos) \
6470 V(Math, atan, MathATan) \ 6507 V(Math, atan, MathATan) \
6471 V(Math, exp, MathExp) \ 6508 V(Math, exp, MathExp) \
6472 V(Math, sqrt, MathSqrt) \ 6509 V(Math, sqrt, MathSqrt) \
6473 V(Math, pow, MathPow) \ 6510 V(Math, pow, MathPow) \
6474 V(Math, random, MathRandom) \
6475 V(Math, max, MathMax) \ 6511 V(Math, max, MathMax) \
6476 V(Math, min, MathMin) \ 6512 V(Math, min, MathMin) \
6477 V(Math, imul, MathImul) 6513 V(Math, imul, MathImul)
6478 6514
6479 enum BuiltinFunctionId { 6515 enum BuiltinFunctionId {
6480 kArrayCode, 6516 kArrayCode,
6481 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \ 6517 #define DECLARE_FUNCTION_ID(ignored1, ignore2, name) \
6482 k##name, 6518 k##name,
6483 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID) 6519 FUNCTIONS_WITH_ID_LIST(DECLARE_FUNCTION_ID)
6484 #undef DECLARE_FUNCTION_ID 6520 #undef DECLARE_FUNCTION_ID
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after
8068 8104
8069 class AllocationSite: public Struct { 8105 class AllocationSite: public Struct {
8070 public: 8106 public:
8071 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; 8107 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
8072 8108
8073 DECL_ACCESSORS(transition_info, Object) 8109 DECL_ACCESSORS(transition_info, Object)
8074 // nested_site threads a list of sites that represent nested literals 8110 // nested_site threads a list of sites that represent nested literals
8075 // walked in a particular order. So [[1, 2], 1, 2] will have one 8111 // walked in a particular order. So [[1, 2], 1, 2] will have one
8076 // nested_site, but [[1, 2], 3, [4]] will have a list of two. 8112 // nested_site, but [[1, 2], 3, [4]] will have a list of two.
8077 DECL_ACCESSORS(nested_site, Object) 8113 DECL_ACCESSORS(nested_site, Object)
8114 DECL_ACCESSORS(memento_found_count, Smi)
8115 DECL_ACCESSORS(memento_create_count, Smi)
8116 DECL_ACCESSORS(pretenure_decision, Smi)
8078 DECL_ACCESSORS(dependent_code, DependentCode) 8117 DECL_ACCESSORS(dependent_code, DependentCode)
8079 DECL_ACCESSORS(weak_next, Object) 8118 DECL_ACCESSORS(weak_next, Object)
8080 8119
8081 inline void Initialize(); 8120 inline void Initialize();
8082 8121
8083 bool HasNestedSites() { 8122 bool HasNestedSites() {
8084 return nested_site()->IsAllocationSite(); 8123 return nested_site()->IsAllocationSite();
8085 } 8124 }
8086 8125
8087 // This method is expensive, it should only be called for reporting. 8126 // This method is expensive, it should only be called for reporting.
8088 bool IsNestedSite(); 8127 bool IsNestedSite();
8089 8128
8129 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {};
8130 class UnusedBits: public BitField<int, 15, 14> {};
8131 class DoNotInlineBit: public BitField<bool, 29, 1> {};
8132
8090 ElementsKind GetElementsKind() { 8133 ElementsKind GetElementsKind() {
8091 ASSERT(!SitePointsToLiteral()); 8134 ASSERT(!SitePointsToLiteral());
8092 return static_cast<ElementsKind>(Smi::cast(transition_info())->value()); 8135 int value = Smi::cast(transition_info())->value();
8136 return ElementsKindBits::decode(value);
8093 } 8137 }
8094 8138
8095 void SetElementsKind(ElementsKind kind) { 8139 void SetElementsKind(ElementsKind kind) {
8096 set_transition_info(Smi::FromInt(static_cast<int>(kind))); 8140 int value = Smi::cast(transition_info())->value();
8141 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)),
8142 SKIP_WRITE_BARRIER);
8143 }
8144
8145 bool CanInlineCall() {
8146 int value = Smi::cast(transition_info())->value();
8147 return DoNotInlineBit::decode(value) == 0;
8148 }
8149
8150 void SetDoNotInlineCall() {
8151 int value = Smi::cast(transition_info())->value();
8152 set_transition_info(Smi::FromInt(DoNotInlineBit::update(value, true)),
8153 SKIP_WRITE_BARRIER);
8097 } 8154 }
8098 8155
8099 bool SitePointsToLiteral() { 8156 bool SitePointsToLiteral() {
8100 // If transition_info is a smi, then it represents an ElementsKind 8157 // If transition_info is a smi, then it represents an ElementsKind
8101 // for a constructed array. Otherwise, it must be a boilerplate 8158 // for a constructed array. Otherwise, it must be a boilerplate
8102 // for an object or array literal. 8159 // for an object or array literal.
8103 return transition_info()->IsJSArray() || transition_info()->IsJSObject(); 8160 return transition_info()->IsJSArray() || transition_info()->IsJSObject();
8104 } 8161 }
8105 8162
8163 MaybeObject* DigestTransitionFeedback(ElementsKind to_kind);
8164
8165 enum Reason {
8166 TENURING,
8167 TRANSITIONS
8168 };
8169
8170 void AddDependentCompilationInfo(Reason reason, CompilationInfo* info);
8171 void AddDependentCode(Reason reason, Handle<Code> code);
8172
8106 DECLARE_PRINTER(AllocationSite) 8173 DECLARE_PRINTER(AllocationSite)
8107 DECLARE_VERIFIER(AllocationSite) 8174 DECLARE_VERIFIER(AllocationSite)
8108 8175
8109 static inline AllocationSite* cast(Object* obj); 8176 static inline AllocationSite* cast(Object* obj);
8110 static inline AllocationSiteMode GetMode( 8177 static inline AllocationSiteMode GetMode(
8111 ElementsKind boilerplate_elements_kind); 8178 ElementsKind boilerplate_elements_kind);
8112 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); 8179 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
8113 static inline bool CanTrack(InstanceType type); 8180 static inline bool CanTrack(InstanceType type);
8114 8181
8115 static const int kTransitionInfoOffset = HeapObject::kHeaderSize; 8182 static const int kTransitionInfoOffset = HeapObject::kHeaderSize;
8116 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize; 8183 static const int kNestedSiteOffset = kTransitionInfoOffset + kPointerSize;
8117 static const int kDependentCodeOffset = kNestedSiteOffset + kPointerSize; 8184 static const int kMementoFoundCountOffset = kNestedSiteOffset + kPointerSize;
8185 static const int kMementoCreateCountOffset =
8186 kMementoFoundCountOffset + kPointerSize;
8187 static const int kPretenureDecisionOffset =
8188 kMementoCreateCountOffset + kPointerSize;
8189 static const int kDependentCodeOffset =
8190 kPretenureDecisionOffset + kPointerSize;
8118 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize; 8191 static const int kWeakNextOffset = kDependentCodeOffset + kPointerSize;
8119 static const int kSize = kWeakNextOffset + kPointerSize; 8192 static const int kSize = kWeakNextOffset + kPointerSize;
8120 8193
8194 // During mark compact we need to take special care for the dependent code
8195 // field.
8196 static const int kPointerFieldsBeginOffset = kTransitionInfoOffset;
8197 static const int kPointerFieldsEndOffset = kDependentCodeOffset;
8198
8199 // For other visitors, use the fixed body descriptor below.
8121 typedef FixedBodyDescriptor<HeapObject::kHeaderSize, 8200 typedef FixedBodyDescriptor<HeapObject::kHeaderSize,
8122 kDependentCodeOffset + kPointerSize, 8201 kDependentCodeOffset + kPointerSize,
8123 kSize> BodyDescriptor; 8202 kSize> BodyDescriptor;
8124 8203
8125 private: 8204 private:
8205 inline DependentCode::DependencyGroup ToDependencyGroup(Reason reason);
8126 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); 8206 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite);
8127 }; 8207 };
8128 8208
8129 8209
8130 class AllocationMemento: public Struct { 8210 class AllocationMemento: public Struct {
8131 public: 8211 public:
8132 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; 8212 static const int kAllocationSiteOffset = HeapObject::kHeaderSize;
8133 static const int kSize = kAllocationSiteOffset + kPointerSize; 8213 static const int kSize = kAllocationSiteOffset + kPointerSize;
8134 8214
8135 DECL_ACCESSORS(allocation_site, Object) 8215 DECL_ACCESSORS(allocation_site, Object)
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
9543 9623
9544 // [byte_length]: length in bytes 9624 // [byte_length]: length in bytes
9545 DECL_ACCESSORS(byte_length, Object) 9625 DECL_ACCESSORS(byte_length, Object)
9546 9626
9547 // [flags] 9627 // [flags]
9548 DECL_ACCESSORS(flag, Smi) 9628 DECL_ACCESSORS(flag, Smi)
9549 9629
9550 inline bool is_external(); 9630 inline bool is_external();
9551 inline void set_is_external(bool value); 9631 inline void set_is_external(bool value);
9552 9632
9633 inline bool should_be_freed();
9634 inline void set_should_be_freed(bool value);
9635
9553 // [weak_next]: linked list of array buffers. 9636 // [weak_next]: linked list of array buffers.
9554 DECL_ACCESSORS(weak_next, Object) 9637 DECL_ACCESSORS(weak_next, Object)
9555 9638
9556 // [weak_first_array]: weak linked list of views. 9639 // [weak_first_array]: weak linked list of views.
9557 DECL_ACCESSORS(weak_first_view, Object) 9640 DECL_ACCESSORS(weak_first_view, Object)
9558 9641
9559 // Casting. 9642 // Casting.
9560 static inline JSArrayBuffer* cast(Object* obj); 9643 static inline JSArrayBuffer* cast(Object* obj);
9561 9644
9562 // Neutering. Only neuters the buffer, not associated typed arrays. 9645 // Neutering. Only neuters the buffer, not associated typed arrays.
9563 void Neuter(); 9646 void Neuter();
9564 9647
9565 // Dispatched behavior. 9648 // Dispatched behavior.
9566 DECLARE_PRINTER(JSArrayBuffer) 9649 DECLARE_PRINTER(JSArrayBuffer)
9567 DECLARE_VERIFIER(JSArrayBuffer) 9650 DECLARE_VERIFIER(JSArrayBuffer)
9568 9651
9569 static const int kBackingStoreOffset = JSObject::kHeaderSize; 9652 static const int kBackingStoreOffset = JSObject::kHeaderSize;
9570 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; 9653 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize;
9571 static const int kFlagOffset = kByteLengthOffset + kPointerSize; 9654 static const int kFlagOffset = kByteLengthOffset + kPointerSize;
9572 static const int kWeakNextOffset = kFlagOffset + kPointerSize; 9655 static const int kWeakNextOffset = kFlagOffset + kPointerSize;
9573 static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize; 9656 static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize;
9574 static const int kSize = kWeakFirstViewOffset + kPointerSize; 9657 static const int kSize = kWeakFirstViewOffset + kPointerSize;
9575 9658
9576 static const int kSizeWithInternalFields = 9659 static const int kSizeWithInternalFields =
9577 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 9660 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
9578 9661
9579 private: 9662 private:
9580 // Bit position in a flag 9663 // Bit position in a flag
9581 static const int kIsExternalBit = 0; 9664 static const int kIsExternalBit = 0;
9665 static const int kShouldBeFreed = 1;
9582 9666
9583 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 9667 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
9584 }; 9668 };
9585 9669
9586 9670
9587 class JSArrayBufferView: public JSObject { 9671 class JSArrayBufferView: public JSObject {
9588 public: 9672 public:
9589 // [buffer]: ArrayBuffer that this typed array views. 9673 // [buffer]: ArrayBuffer that this typed array views.
9590 DECL_ACCESSORS(buffer, Object) 9674 DECL_ACCESSORS(buffer, Object)
9591 9675
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
9709 // - slow, backing storage is a HashTable with numbers as keys. 9793 // - slow, backing storage is a HashTable with numbers as keys.
9710 class JSArray: public JSObject { 9794 class JSArray: public JSObject {
9711 public: 9795 public:
9712 // [length]: The length property. 9796 // [length]: The length property.
9713 DECL_ACCESSORS(length, Object) 9797 DECL_ACCESSORS(length, Object)
9714 9798
9715 // Overload the length setter to skip write barrier when the length 9799 // Overload the length setter to skip write barrier when the length
9716 // is set to a smi. This matches the set function on FixedArray. 9800 // is set to a smi. This matches the set function on FixedArray.
9717 inline void set_length(Smi* length); 9801 inline void set_length(Smi* length);
9718 9802
9803 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array,
9804 uint32_t index,
9805 Handle<Object> value);
9806
9719 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, 9807 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index,
9720 Object* value); 9808 Object* value);
9721 9809
9722 // Initialize the array with the given capacity. The function may 9810 // Initialize the array with the given capacity. The function may
9723 // fail due to out-of-memory situations, but only if the requested 9811 // fail due to out-of-memory situations, but only if the requested
9724 // capacity is non-zero. 9812 // capacity is non-zero.
9725 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0); 9813 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0);
9726 9814
9727 // Initializes the array to a certain length. 9815 // Initializes the array to a certain length.
9728 inline bool AllowsSetElementsLength(); 9816 inline bool AllowsSetElementsLength();
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
10183 kIndexedPropertyHandlerOffset + kPointerSize; 10271 kIndexedPropertyHandlerOffset + kPointerSize;
10184 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize; 10272 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize;
10185 static const int kSignatureOffset = kClassNameOffset + kPointerSize; 10273 static const int kSignatureOffset = kClassNameOffset + kPointerSize;
10186 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize; 10274 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize;
10187 static const int kAccessCheckInfoOffset = 10275 static const int kAccessCheckInfoOffset =
10188 kInstanceCallHandlerOffset + kPointerSize; 10276 kInstanceCallHandlerOffset + kPointerSize;
10189 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize; 10277 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize;
10190 static const int kLengthOffset = kFlagOffset + kPointerSize; 10278 static const int kLengthOffset = kFlagOffset + kPointerSize;
10191 static const int kSize = kLengthOffset + kPointerSize; 10279 static const int kSize = kLengthOffset + kPointerSize;
10192 10280
10281 // Returns true if |object| is an instance of this function template.
10282 bool IsTemplateFor(Object* object);
10283 bool IsTemplateFor(Map* map);
10284
10193 private: 10285 private:
10194 // Bit position in the flag, from least significant bit position. 10286 // Bit position in the flag, from least significant bit position.
10195 static const int kHiddenPrototypeBit = 0; 10287 static const int kHiddenPrototypeBit = 0;
10196 static const int kUndetectableBit = 1; 10288 static const int kUndetectableBit = 1;
10197 static const int kNeedsAccessCheckBit = 2; 10289 static const int kNeedsAccessCheckBit = 2;
10198 static const int kReadOnlyPrototypeBit = 3; 10290 static const int kReadOnlyPrototypeBit = 3;
10199 static const int kRemovePrototypeBit = 4; 10291 static const int kRemovePrototypeBit = 4;
10200 static const int kDoNotCacheBit = 5; 10292 static const int kDoNotCacheBit = 5;
10201 10293
10202 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 10294 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
10488 } else { 10580 } else {
10489 value &= ~(1 << bit_position); 10581 value &= ~(1 << bit_position);
10490 } 10582 }
10491 return value; 10583 return value;
10492 } 10584 }
10493 }; 10585 };
10494 10586
10495 } } // namespace v8::internal 10587 } } // namespace v8::internal
10496 10588
10497 #endif // V8_OBJECTS_H_ 10589 #endif // V8_OBJECTS_H_
OLDNEW
« include/v8-platform.h ('K') | « src/mksnapshot.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698