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

Side by Side Diff: src/objects.h

Issue 66803002: Handlify JSObject::SetElement & brethren (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: sync Created 7 years, 1 month 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/factory.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 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 // Computes the new capacity when expanding the elements of a JSObject. 2332 // Computes the new capacity when expanding the elements of a JSObject.
2333 static int NewElementsCapacity(int old_capacity) { 2333 static int NewElementsCapacity(int old_capacity) {
2334 // (old_capacity + 50%) + 16 2334 // (old_capacity + 50%) + 16
2335 return old_capacity + (old_capacity >> 1) + 16; 2335 return old_capacity + (old_capacity >> 1) + 16;
2336 } 2336 }
2337 2337
2338 // These methods do not perform access checks! 2338 // These methods do not perform access checks!
2339 AccessorPair* GetLocalPropertyAccessorPair(Name* name); 2339 AccessorPair* GetLocalPropertyAccessorPair(Name* name);
2340 AccessorPair* GetLocalElementAccessorPair(uint32_t index); 2340 AccessorPair* GetLocalElementAccessorPair(uint32_t index);
2341 2341
2342 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, 2342 static Handle<Object> SetFastElement(Handle<JSObject> object, uint32_t index,
2343 Object* value, 2343 Handle<Object> value,
2344 StrictModeFlag strict_mode, 2344 StrictModeFlag strict_mode,
2345 bool check_prototype); 2345 bool check_prototype);
2346
2347 MUST_USE_RESULT MaybeObject* SetDictionaryElement(
2348 uint32_t index,
2349 Object* value,
2350 PropertyAttributes attributes,
2351 StrictModeFlag strict_mode,
2352 bool check_prototype,
2353 SetPropertyMode set_mode = SET_PROPERTY);
2354
2355 MUST_USE_RESULT MaybeObject* SetFastDoubleElement(
2356 uint32_t index,
2357 Object* value,
2358 StrictModeFlag strict_mode,
2359 bool check_prototype = true);
2360 2346
2361 static Handle<Object> SetOwnElement(Handle<JSObject> object, 2347 static Handle<Object> SetOwnElement(Handle<JSObject> object,
2362 uint32_t index, 2348 uint32_t index,
2363 Handle<Object> value, 2349 Handle<Object> value,
2364 StrictModeFlag strict_mode); 2350 StrictModeFlag strict_mode);
2365 2351
2366 // Empty handle is returned if the element cannot be set to the given value. 2352 // Empty handle is returned if the element cannot be set to the given value.
2367 static Handle<Object> SetElement( 2353 static Handle<Object> SetElement(
2368 Handle<JSObject> object, 2354 Handle<JSObject> object,
2369 uint32_t index, 2355 uint32_t index,
2370 Handle<Object> value, 2356 Handle<Object> value,
2371 PropertyAttributes attr,
2372 StrictModeFlag strict_mode,
2373 bool check_prototype = true,
2374 SetPropertyMode set_mode = SET_PROPERTY);
2375
2376 // A Failure object is returned if GC is needed.
2377 MUST_USE_RESULT MaybeObject* SetElement(
2378 uint32_t index,
2379 Object* value,
2380 PropertyAttributes attributes, 2357 PropertyAttributes attributes,
2381 StrictModeFlag strict_mode, 2358 StrictModeFlag strict_mode,
2382 bool check_prototype = true, 2359 bool check_prototype = true,
2383 SetPropertyMode set_mode = SET_PROPERTY); 2360 SetPropertyMode set_mode = SET_PROPERTY);
2384 2361
2385 // Returns the index'th element. 2362 // Returns the index'th element.
2386 // The undefined object if index is out of bounds. 2363 // The undefined object if index is out of bounds.
2387 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, 2364 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver,
2388 uint32_t index); 2365 uint32_t index);
2389 2366
2390 enum SetFastElementsCapacitySmiMode { 2367 enum SetFastElementsCapacitySmiMode {
2391 kAllowSmiElements, 2368 kAllowSmiElements,
2392 kForceSmiElements, 2369 kForceSmiElements,
2393 kDontAllowSmiElements 2370 kDontAllowSmiElements
2394 }; 2371 };
2395 2372
2373 static Handle<FixedArray> SetFastElementsCapacityAndLength(
2374 Handle<JSObject> object,
2375 int capacity,
2376 int length,
2377 SetFastElementsCapacitySmiMode smi_mode);
2396 // Replace the elements' backing store with fast elements of the given 2378 // Replace the elements' backing store with fast elements of the given
2397 // capacity. Update the length for JSArrays. Returns the new backing 2379 // capacity. Update the length for JSArrays. Returns the new backing
2398 // store. 2380 // store.
2399 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( 2381 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(
2400 int capacity, 2382 int capacity,
2401 int length, 2383 int length,
2402 SetFastElementsCapacitySmiMode smi_mode); 2384 SetFastElementsCapacitySmiMode smi_mode);
2385 static void SetFastDoubleElementsCapacityAndLength(
2386 Handle<JSObject> object,
2387 int capacity,
2388 int length);
2403 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 2389 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
2404 int capacity, 2390 int capacity,
2405 int length); 2391 int length);
2406 2392
2407 // Lookup interceptors are used for handling properties controlled by host 2393 // Lookup interceptors are used for handling properties controlled by host
2408 // objects. 2394 // objects.
2409 inline bool HasNamedInterceptor(); 2395 inline bool HasNamedInterceptor();
2410 inline bool HasIndexedInterceptor(); 2396 inline bool HasIndexedInterceptor();
2411 2397
2412 // Support functions for v8 api (needed for correct interceptor behavior). 2398 // Support functions for v8 api (needed for correct interceptor behavior).
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2462 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( 2448 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap(
2463 Isolate* isolate, 2449 Isolate* isolate,
2464 ElementsKind elements_kind); 2450 ElementsKind elements_kind);
2465 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( 2451 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow(
2466 ElementsKind elements_kind); 2452 ElementsKind elements_kind);
2467 2453
2468 static void TransitionElementsKind(Handle<JSObject> object, 2454 static void TransitionElementsKind(Handle<JSObject> object,
2469 ElementsKind to_kind); 2455 ElementsKind to_kind);
2470 2456
2471 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); 2457 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
2472 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2473 2458
2474 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). 2459 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty().
2475 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); 2460 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map);
2476 static void GeneralizeFieldRepresentation(Handle<JSObject> object, 2461 static void GeneralizeFieldRepresentation(Handle<JSObject> object,
2477 int modify_index, 2462 int modify_index,
2478 Representation new_representation, 2463 Representation new_representation,
2479 StoreMode store_mode); 2464 StoreMode store_mode);
2480 2465
2481 // Convert the object to use the canonical dictionary 2466 // Convert the object to use the canonical dictionary
2482 // representation. If the object is expected to have additional properties 2467 // representation. If the object is expected to have additional properties
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 Handle<Object> old_value); 2638 Handle<Object> old_value);
2654 2639
2655 // Deliver change records to observers. May cause GC. 2640 // Deliver change records to observers. May cause GC.
2656 static void DeliverChangeRecords(Isolate* isolate); 2641 static void DeliverChangeRecords(Isolate* isolate);
2657 2642
2658 private: 2643 private:
2659 friend class DictionaryElementsAccessor; 2644 friend class DictionaryElementsAccessor;
2660 friend class JSReceiver; 2645 friend class JSReceiver;
2661 friend class Object; 2646 friend class Object;
2662 2647
2648 static void UpdateAllocationSite(Handle<JSObject> object,
2649 ElementsKind to_kind);
2650 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2651
2663 // Used from Object::GetProperty(). 2652 // Used from Object::GetProperty().
2664 static Handle<Object> GetPropertyWithFailedAccessCheck( 2653 static Handle<Object> GetPropertyWithFailedAccessCheck(
2665 Handle<JSObject> object, 2654 Handle<JSObject> object,
2666 Handle<Object> receiver, 2655 Handle<Object> receiver,
2667 LookupResult* result, 2656 LookupResult* result,
2668 Handle<Name> name, 2657 Handle<Name> name,
2669 PropertyAttributes* attributes); 2658 PropertyAttributes* attributes);
2670 2659
2671 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2660 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2672 Object* structure, 2661 Object* structure,
2673 uint32_t index, 2662 uint32_t index,
2674 Object* holder); 2663 Object* holder);
2675 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( 2664 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor(
2676 JSReceiver* receiver, 2665 JSReceiver* receiver,
2677 uint32_t index, 2666 uint32_t index,
2678 bool continue_search); 2667 bool continue_search);
2679 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( 2668 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor(
2680 JSReceiver* receiver, 2669 JSReceiver* receiver,
2681 uint32_t index, 2670 uint32_t index,
2682 bool continue_search); 2671 bool continue_search);
2683 static Handle<Object> SetElementWithCallback( 2672 static Handle<Object> SetElementWithCallback(
2684 Handle<JSObject> object, 2673 Handle<JSObject> object,
2685 Handle<Object> structure, 2674 Handle<Object> structure,
2686 uint32_t index, 2675 uint32_t index,
2687 Handle<Object> value, 2676 Handle<Object> value,
2688 Handle<JSObject> holder, 2677 Handle<JSObject> holder,
2689 StrictModeFlag strict_mode); 2678 StrictModeFlag strict_mode);
2690 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( 2679 static Handle<Object> SetElementWithInterceptor(
2680 Handle<JSObject> object,
2691 uint32_t index, 2681 uint32_t index,
2692 Object* value, 2682 Handle<Object> value,
2693 PropertyAttributes attributes, 2683 PropertyAttributes attributes,
2694 StrictModeFlag strict_mode, 2684 StrictModeFlag strict_mode,
2695 bool check_prototype, 2685 bool check_prototype,
2696 SetPropertyMode set_mode); 2686 SetPropertyMode set_mode);
2697 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 2687 static Handle<Object> SetElementWithoutInterceptor(
2688 Handle<JSObject> object,
2698 uint32_t index, 2689 uint32_t index,
2699 Object* value, 2690 Handle<Object> value,
2700 PropertyAttributes attributes, 2691 PropertyAttributes attributes,
2701 StrictModeFlag strict_mode, 2692 StrictModeFlag strict_mode,
2702 bool check_prototype, 2693 bool check_prototype,
2703 SetPropertyMode set_mode); 2694 SetPropertyMode set_mode);
2704 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( 2695 static Handle<Object> SetElementWithCallbackSetterInPrototypes(
2696 Handle<JSObject> object,
2705 uint32_t index, 2697 uint32_t index,
2706 Object* value, 2698 Handle<Object> value,
2707 bool* found, 2699 bool* found,
2708 StrictModeFlag strict_mode); 2700 StrictModeFlag strict_mode);
2701 static Handle<Object> SetDictionaryElement(
2702 Handle<JSObject> object,
2703 uint32_t index,
2704 Handle<Object> value,
2705 PropertyAttributes attributes,
2706 StrictModeFlag strict_mode,
2707 bool check_prototype,
2708 SetPropertyMode set_mode = SET_PROPERTY);
2709 static Handle<Object> SetFastDoubleElement(
2710 Handle<JSObject> object,
2711 uint32_t index,
2712 Handle<Object> value,
2713 StrictModeFlag strict_mode,
2714 bool check_prototype = true);
2709 2715
2710 // Searches the prototype chain for property 'name'. If it is found and 2716 // Searches the prototype chain for property 'name'. If it is found and
2711 // has a setter, invoke it and set '*done' to true. If it is found and is 2717 // has a setter, invoke it and set '*done' to true. If it is found and is
2712 // read-only, reject and set '*done' to true. Otherwise, set '*done' to 2718 // read-only, reject and set '*done' to true. Otherwise, set '*done' to
2713 // false. Can throw and return an empty handle with '*done==true'. 2719 // false. Can throw and return an empty handle with '*done==true'.
2714 static Handle<Object> SetPropertyViaPrototypes( 2720 static Handle<Object> SetPropertyViaPrototypes(
2715 Handle<JSObject> object, 2721 Handle<JSObject> object,
2716 Handle<Name> name, 2722 Handle<Name> name,
2717 Handle<Object> value, 2723 Handle<Object> value,
2718 PropertyAttributes attributes, 2724 PropertyAttributes attributes,
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3960 class SeededNumberDictionary 3966 class SeededNumberDictionary
3961 : public Dictionary<SeededNumberDictionaryShape, uint32_t> { 3967 : public Dictionary<SeededNumberDictionaryShape, uint32_t> {
3962 public: 3968 public:
3963 static SeededNumberDictionary* cast(Object* obj) { 3969 static SeededNumberDictionary* cast(Object* obj) {
3964 ASSERT(obj->IsDictionary()); 3970 ASSERT(obj->IsDictionary());
3965 return reinterpret_cast<SeededNumberDictionary*>(obj); 3971 return reinterpret_cast<SeededNumberDictionary*>(obj);
3966 } 3972 }
3967 3973
3968 // Type specific at put (default NONE attributes is used when adding). 3974 // Type specific at put (default NONE attributes is used when adding).
3969 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); 3975 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
3976 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry(
3977 Handle<SeededNumberDictionary> dictionary,
3978 uint32_t key,
3979 Handle<Object> value,
3980 PropertyDetails details);
3970 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, 3981 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key,
3971 Object* value, 3982 Object* value,
3972 PropertyDetails details); 3983 PropertyDetails details);
3973 3984
3974 // Set an existing entry or add a new one if needed. 3985 // Set an existing entry or add a new one if needed.
3975 // Return the updated dictionary. 3986 // Return the updated dictionary.
3976 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( 3987 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set(
3977 Handle<SeededNumberDictionary> dictionary, 3988 Handle<SeededNumberDictionary> dictionary,
3978 uint32_t index, 3989 uint32_t index,
3979 Handle<Object> value, 3990 Handle<Object> value,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
4584 }; 4595 };
4585 4596
4586 4597
4587 class ExternalByteArray: public ExternalArray { 4598 class ExternalByteArray: public ExternalArray {
4588 public: 4599 public:
4589 // Setter and getter. 4600 // Setter and getter.
4590 inline int8_t get_scalar(int index); 4601 inline int8_t get_scalar(int index);
4591 MUST_USE_RESULT inline MaybeObject* get(int index); 4602 MUST_USE_RESULT inline MaybeObject* get(int index);
4592 inline void set(int index, int8_t value); 4603 inline void set(int index, int8_t value);
4593 4604
4605 static Handle<Object> SetValue(Handle<ExternalByteArray> array,
4606 uint32_t index,
4607 Handle<Object> value);
4608
4594 // This accessor applies the correct conversion from Smi, HeapNumber 4609 // This accessor applies the correct conversion from Smi, HeapNumber
4595 // and undefined. 4610 // and undefined.
4596 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4611 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4597 4612
4598 // Casting. 4613 // Casting.
4599 static inline ExternalByteArray* cast(Object* obj); 4614 static inline ExternalByteArray* cast(Object* obj);
4600 4615
4601 // Dispatched behavior. 4616 // Dispatched behavior.
4602 DECLARE_PRINTER(ExternalByteArray) 4617 DECLARE_PRINTER(ExternalByteArray)
4603 DECLARE_VERIFIER(ExternalByteArray) 4618 DECLARE_VERIFIER(ExternalByteArray)
4604 4619
4605 private: 4620 private:
4606 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 4621 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
4607 }; 4622 };
4608 4623
4609 4624
4610 class ExternalUnsignedByteArray: public ExternalArray { 4625 class ExternalUnsignedByteArray: public ExternalArray {
4611 public: 4626 public:
4612 // Setter and getter. 4627 // Setter and getter.
4613 inline uint8_t get_scalar(int index); 4628 inline uint8_t get_scalar(int index);
4614 MUST_USE_RESULT inline MaybeObject* get(int index); 4629 MUST_USE_RESULT inline MaybeObject* get(int index);
4615 inline void set(int index, uint8_t value); 4630 inline void set(int index, uint8_t value);
4616 4631
4632 static Handle<Object> SetValue(Handle<ExternalUnsignedByteArray> array,
4633 uint32_t index,
4634 Handle<Object> value);
4635
4617 // This accessor applies the correct conversion from Smi, HeapNumber 4636 // This accessor applies the correct conversion from Smi, HeapNumber
4618 // and undefined. 4637 // and undefined.
4619 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4638 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4620 4639
4621 // Casting. 4640 // Casting.
4622 static inline ExternalUnsignedByteArray* cast(Object* obj); 4641 static inline ExternalUnsignedByteArray* cast(Object* obj);
4623 4642
4624 // Dispatched behavior. 4643 // Dispatched behavior.
4625 DECLARE_PRINTER(ExternalUnsignedByteArray) 4644 DECLARE_PRINTER(ExternalUnsignedByteArray)
4626 DECLARE_VERIFIER(ExternalUnsignedByteArray) 4645 DECLARE_VERIFIER(ExternalUnsignedByteArray)
4627 4646
4628 private: 4647 private:
4629 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 4648 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
4630 }; 4649 };
4631 4650
4632 4651
4633 class ExternalShortArray: public ExternalArray { 4652 class ExternalShortArray: public ExternalArray {
4634 public: 4653 public:
4635 // Setter and getter. 4654 // Setter and getter.
4636 inline int16_t get_scalar(int index); 4655 inline int16_t get_scalar(int index);
4637 MUST_USE_RESULT inline MaybeObject* get(int index); 4656 MUST_USE_RESULT inline MaybeObject* get(int index);
4638 inline void set(int index, int16_t value); 4657 inline void set(int index, int16_t value);
4639 4658
4659 static Handle<Object> SetValue(Handle<ExternalShortArray> array,
4660 uint32_t index,
4661 Handle<Object> value);
4662
4640 // This accessor applies the correct conversion from Smi, HeapNumber 4663 // This accessor applies the correct conversion from Smi, HeapNumber
4641 // and undefined. 4664 // and undefined.
4642 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4665 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4643 4666
4644 // Casting. 4667 // Casting.
4645 static inline ExternalShortArray* cast(Object* obj); 4668 static inline ExternalShortArray* cast(Object* obj);
4646 4669
4647 // Dispatched behavior. 4670 // Dispatched behavior.
4648 DECLARE_PRINTER(ExternalShortArray) 4671 DECLARE_PRINTER(ExternalShortArray)
4649 DECLARE_VERIFIER(ExternalShortArray) 4672 DECLARE_VERIFIER(ExternalShortArray)
4650 4673
4651 private: 4674 private:
4652 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 4675 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
4653 }; 4676 };
4654 4677
4655 4678
4656 class ExternalUnsignedShortArray: public ExternalArray { 4679 class ExternalUnsignedShortArray: public ExternalArray {
4657 public: 4680 public:
4658 // Setter and getter. 4681 // Setter and getter.
4659 inline uint16_t get_scalar(int index); 4682 inline uint16_t get_scalar(int index);
4660 MUST_USE_RESULT inline MaybeObject* get(int index); 4683 MUST_USE_RESULT inline MaybeObject* get(int index);
4661 inline void set(int index, uint16_t value); 4684 inline void set(int index, uint16_t value);
4662 4685
4686 static Handle<Object> SetValue(Handle<ExternalUnsignedShortArray> array,
4687 uint32_t index,
4688 Handle<Object> value);
4689
4663 // This accessor applies the correct conversion from Smi, HeapNumber 4690 // This accessor applies the correct conversion from Smi, HeapNumber
4664 // and undefined. 4691 // and undefined.
4665 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4692 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4666 4693
4667 // Casting. 4694 // Casting.
4668 static inline ExternalUnsignedShortArray* cast(Object* obj); 4695 static inline ExternalUnsignedShortArray* cast(Object* obj);
4669 4696
4670 // Dispatched behavior. 4697 // Dispatched behavior.
4671 DECLARE_PRINTER(ExternalUnsignedShortArray) 4698 DECLARE_PRINTER(ExternalUnsignedShortArray)
4672 DECLARE_VERIFIER(ExternalUnsignedShortArray) 4699 DECLARE_VERIFIER(ExternalUnsignedShortArray)
4673 4700
4674 private: 4701 private:
4675 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 4702 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
4676 }; 4703 };
4677 4704
4678 4705
4679 class ExternalIntArray: public ExternalArray { 4706 class ExternalIntArray: public ExternalArray {
4680 public: 4707 public:
4681 // Setter and getter. 4708 // Setter and getter.
4682 inline int32_t get_scalar(int index); 4709 inline int32_t get_scalar(int index);
4683 MUST_USE_RESULT inline MaybeObject* get(int index); 4710 MUST_USE_RESULT inline MaybeObject* get(int index);
4684 inline void set(int index, int32_t value); 4711 inline void set(int index, int32_t value);
4685 4712
4713 static Handle<Object> SetValue(Handle<ExternalIntArray> array,
4714 uint32_t index,
4715 Handle<Object> value);
4716
4686 // This accessor applies the correct conversion from Smi, HeapNumber 4717 // This accessor applies the correct conversion from Smi, HeapNumber
4687 // and undefined. 4718 // and undefined.
4688 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4719 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4689 4720
4690 // Casting. 4721 // Casting.
4691 static inline ExternalIntArray* cast(Object* obj); 4722 static inline ExternalIntArray* cast(Object* obj);
4692 4723
4693 // Dispatched behavior. 4724 // Dispatched behavior.
4694 DECLARE_PRINTER(ExternalIntArray) 4725 DECLARE_PRINTER(ExternalIntArray)
4695 DECLARE_VERIFIER(ExternalIntArray) 4726 DECLARE_VERIFIER(ExternalIntArray)
4696 4727
4697 private: 4728 private:
4698 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 4729 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
4699 }; 4730 };
4700 4731
4701 4732
4702 class ExternalUnsignedIntArray: public ExternalArray { 4733 class ExternalUnsignedIntArray: public ExternalArray {
4703 public: 4734 public:
4704 // Setter and getter. 4735 // Setter and getter.
4705 inline uint32_t get_scalar(int index); 4736 inline uint32_t get_scalar(int index);
4706 MUST_USE_RESULT inline MaybeObject* get(int index); 4737 MUST_USE_RESULT inline MaybeObject* get(int index);
4707 inline void set(int index, uint32_t value); 4738 inline void set(int index, uint32_t value);
4708 4739
4740 static Handle<Object> SetValue(Handle<ExternalUnsignedIntArray> array,
4741 uint32_t index,
4742 Handle<Object> value);
4743
4709 // This accessor applies the correct conversion from Smi, HeapNumber 4744 // This accessor applies the correct conversion from Smi, HeapNumber
4710 // and undefined. 4745 // and undefined.
4711 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4746 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4712 4747
4713 // Casting. 4748 // Casting.
4714 static inline ExternalUnsignedIntArray* cast(Object* obj); 4749 static inline ExternalUnsignedIntArray* cast(Object* obj);
4715 4750
4716 // Dispatched behavior. 4751 // Dispatched behavior.
4717 DECLARE_PRINTER(ExternalUnsignedIntArray) 4752 DECLARE_PRINTER(ExternalUnsignedIntArray)
4718 DECLARE_VERIFIER(ExternalUnsignedIntArray) 4753 DECLARE_VERIFIER(ExternalUnsignedIntArray)
4719 4754
4720 private: 4755 private:
4721 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 4756 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
4722 }; 4757 };
4723 4758
4724 4759
4725 class ExternalFloatArray: public ExternalArray { 4760 class ExternalFloatArray: public ExternalArray {
4726 public: 4761 public:
4727 // Setter and getter. 4762 // Setter and getter.
4728 inline float get_scalar(int index); 4763 inline float get_scalar(int index);
4729 MUST_USE_RESULT inline MaybeObject* get(int index); 4764 MUST_USE_RESULT inline MaybeObject* get(int index);
4730 inline void set(int index, float value); 4765 inline void set(int index, float value);
4731 4766
4767 static Handle<Object> SetValue(Handle<ExternalFloatArray> array,
4768 uint32_t index,
4769 Handle<Object> value);
4770
4732 // This accessor applies the correct conversion from Smi, HeapNumber 4771 // This accessor applies the correct conversion from Smi, HeapNumber
4733 // and undefined. 4772 // and undefined.
4734 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4773 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4735 4774
4736 // Casting. 4775 // Casting.
4737 static inline ExternalFloatArray* cast(Object* obj); 4776 static inline ExternalFloatArray* cast(Object* obj);
4738 4777
4739 // Dispatched behavior. 4778 // Dispatched behavior.
4740 DECLARE_PRINTER(ExternalFloatArray) 4779 DECLARE_PRINTER(ExternalFloatArray)
4741 DECLARE_VERIFIER(ExternalFloatArray) 4780 DECLARE_VERIFIER(ExternalFloatArray)
4742 4781
4743 private: 4782 private:
4744 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 4783 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
4745 }; 4784 };
4746 4785
4747 4786
4748 class ExternalDoubleArray: public ExternalArray { 4787 class ExternalDoubleArray: public ExternalArray {
4749 public: 4788 public:
4750 // Setter and getter. 4789 // Setter and getter.
4751 inline double get_scalar(int index); 4790 inline double get_scalar(int index);
4752 MUST_USE_RESULT inline MaybeObject* get(int index); 4791 MUST_USE_RESULT inline MaybeObject* get(int index);
4753 inline void set(int index, double value); 4792 inline void set(int index, double value);
4754 4793
4794 static Handle<Object> SetValue(Handle<ExternalDoubleArray> array,
4795 uint32_t index,
4796 Handle<Object> value);
4797
4755 // This accessor applies the correct conversion from Smi, HeapNumber 4798 // This accessor applies the correct conversion from Smi, HeapNumber
4756 // and undefined. 4799 // and undefined.
4757 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4800 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4758 4801
4759 // Casting. 4802 // Casting.
4760 static inline ExternalDoubleArray* cast(Object* obj); 4803 static inline ExternalDoubleArray* cast(Object* obj);
4761 4804
4762 // Dispatched behavior. 4805 // Dispatched behavior.
4763 DECLARE_PRINTER(ExternalDoubleArray) 4806 DECLARE_PRINTER(ExternalDoubleArray)
4764 DECLARE_VERIFIER(ExternalDoubleArray) 4807 DECLARE_VERIFIER(ExternalDoubleArray)
(...skipping 4980 matching lines...) Expand 10 before | Expand all | Expand 10 after
9745 // - slow, backing storage is a HashTable with numbers as keys. 9788 // - slow, backing storage is a HashTable with numbers as keys.
9746 class JSArray: public JSObject { 9789 class JSArray: public JSObject {
9747 public: 9790 public:
9748 // [length]: The length property. 9791 // [length]: The length property.
9749 DECL_ACCESSORS(length, Object) 9792 DECL_ACCESSORS(length, Object)
9750 9793
9751 // Overload the length setter to skip write barrier when the length 9794 // Overload the length setter to skip write barrier when the length
9752 // is set to a smi. This matches the set function on FixedArray. 9795 // is set to a smi. This matches the set function on FixedArray.
9753 inline void set_length(Smi* length); 9796 inline void set_length(Smi* length);
9754 9797
9798 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array,
9799 uint32_t index,
9800 Handle<Object> value);
9801
9755 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, 9802 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index,
9756 Object* value); 9803 Object* value);
9757 9804
9758 // Initialize the array with the given capacity. The function may 9805 // Initialize the array with the given capacity. The function may
9759 // fail due to out-of-memory situations, but only if the requested 9806 // fail due to out-of-memory situations, but only if the requested
9760 // capacity is non-zero. 9807 // capacity is non-zero.
9761 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0); 9808 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0);
9762 9809
9763 // Initializes the array to a certain length. 9810 // Initializes the array to a certain length.
9764 inline bool AllowsSetElementsLength(); 9811 inline bool AllowsSetElementsLength();
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
10524 } else { 10571 } else {
10525 value &= ~(1 << bit_position); 10572 value &= ~(1 << bit_position);
10526 } 10573 }
10527 return value; 10574 return value;
10528 } 10575 }
10529 }; 10576 };
10530 10577
10531 } } // namespace v8::internal 10578 } } // namespace v8::internal
10532 10579
10533 #endif // V8_OBJECTS_H_ 10580 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698