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

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: whitespace 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') | src/objects.cc » ('J')
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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 // Computes the new capacity when expanding the elements of a JSObject. 2330 // Computes the new capacity when expanding the elements of a JSObject.
2331 static int NewElementsCapacity(int old_capacity) { 2331 static int NewElementsCapacity(int old_capacity) {
2332 // (old_capacity + 50%) + 16 2332 // (old_capacity + 50%) + 16
2333 return old_capacity + (old_capacity >> 1) + 16; 2333 return old_capacity + (old_capacity >> 1) + 16;
2334 } 2334 }
2335 2335
2336 // These methods do not perform access checks! 2336 // These methods do not perform access checks!
2337 AccessorPair* GetLocalPropertyAccessorPair(Name* name); 2337 AccessorPair* GetLocalPropertyAccessorPair(Name* name);
2338 AccessorPair* GetLocalElementAccessorPair(uint32_t index); 2338 AccessorPair* GetLocalElementAccessorPair(uint32_t index);
2339 2339
2340 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, 2340 static Handle<Object> SetFastElement(Handle<JSObject> object, uint32_t index,
2341 Object* value, 2341 Handle<Object> value,
2342 StrictModeFlag strict_mode, 2342 StrictModeFlag strict_mode,
2343 bool check_prototype); 2343 bool check_prototype);
2344 2344
2345 MUST_USE_RESULT MaybeObject* SetDictionaryElement( 2345 static Handle<Object> SetDictionaryElement(
Michael Starzinger 2013/11/13 12:24:45 It looks like this method is only used from within
rafaelw 2013/11/13 20:56:47 Done.
2346 Handle<JSObject> object,
2346 uint32_t index, 2347 uint32_t index,
2347 Object* value, 2348 Handle<Object> value,
2348 PropertyAttributes attributes, 2349 PropertyAttributes attributes,
2349 StrictModeFlag strict_mode, 2350 StrictModeFlag strict_mode,
2350 bool check_prototype, 2351 bool check_prototype,
2351 SetPropertyMode set_mode = SET_PROPERTY); 2352 SetPropertyMode set_mode = SET_PROPERTY);
2352 2353
2353 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( 2354 static Handle<Object> SetFastDoubleElement(
Michael Starzinger 2013/11/13 12:24:45 Likewise.
rafaelw 2013/11/13 20:56:47 Done.
2355 Handle<JSObject> object,
2354 uint32_t index, 2356 uint32_t index,
2355 Object* value, 2357 Handle<Object> value,
2356 StrictModeFlag strict_mode, 2358 StrictModeFlag strict_mode,
2357 bool check_prototype = true); 2359 bool check_prototype = true);
2358 2360
2359 static Handle<Object> SetOwnElement(Handle<JSObject> object, 2361 static Handle<Object> SetOwnElement(Handle<JSObject> object,
2360 uint32_t index, 2362 uint32_t index,
2361 Handle<Object> value, 2363 Handle<Object> value,
2362 StrictModeFlag strict_mode); 2364 StrictModeFlag strict_mode);
2363 2365
2364 // Empty handle is returned if the element cannot be set to the given value. 2366 // Empty handle is returned if the element cannot be set to the given value.
2365 static Handle<Object> SetElement( 2367 static Handle<Object> SetElement(
2366 Handle<JSObject> object, 2368 Handle<JSObject> object,
2367 uint32_t index, 2369 uint32_t index,
2368 Handle<Object> value, 2370 Handle<Object> value,
2369 PropertyAttributes attr,
2370 StrictModeFlag strict_mode,
2371 bool check_prototype = true,
2372 SetPropertyMode set_mode = SET_PROPERTY);
2373
2374 // A Failure object is returned if GC is needed.
2375 MUST_USE_RESULT MaybeObject* SetElement(
2376 uint32_t index,
2377 Object* value,
2378 PropertyAttributes attributes, 2371 PropertyAttributes attributes,
2379 StrictModeFlag strict_mode, 2372 StrictModeFlag strict_mode,
2380 bool check_prototype = true, 2373 bool check_prototype = true,
2381 SetPropertyMode set_mode = SET_PROPERTY); 2374 SetPropertyMode set_mode = SET_PROPERTY);
2382 2375
2383 // Returns the index'th element. 2376 // Returns the index'th element.
2384 // The undefined object if index is out of bounds. 2377 // The undefined object if index is out of bounds.
2385 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver, 2378 MUST_USE_RESULT MaybeObject* GetElementWithInterceptor(Object* receiver,
2386 uint32_t index); 2379 uint32_t index);
2387 2380
2388 enum SetFastElementsCapacitySmiMode { 2381 enum SetFastElementsCapacitySmiMode {
2389 kAllowSmiElements, 2382 kAllowSmiElements,
2390 kForceSmiElements, 2383 kForceSmiElements,
2391 kDontAllowSmiElements 2384 kDontAllowSmiElements
2392 }; 2385 };
2393 2386
2387 static Handle<FixedArray> SetFastElementsCapacityAndLength(
2388 Handle<JSObject> object,
2389 int capacity,
2390 int length,
2391 SetFastElementsCapacitySmiMode smi_mode);
2394 // Replace the elements' backing store with fast elements of the given 2392 // Replace the elements' backing store with fast elements of the given
2395 // capacity. Update the length for JSArrays. Returns the new backing 2393 // capacity. Update the length for JSArrays. Returns the new backing
2396 // store. 2394 // store.
2397 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( 2395 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(
2398 int capacity, 2396 int capacity,
2399 int length, 2397 int length,
2400 SetFastElementsCapacitySmiMode smi_mode); 2398 SetFastElementsCapacitySmiMode smi_mode);
2399 static void SetFastDoubleElementsCapacityAndLength(
2400 Handle<JSObject> object,
2401 int capacity,
2402 int length);
2401 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( 2403 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength(
2402 int capacity, 2404 int capacity,
2403 int length); 2405 int length);
2404 2406
2405 // Lookup interceptors are used for handling properties controlled by host 2407 // Lookup interceptors are used for handling properties controlled by host
2406 // objects. 2408 // objects.
2407 inline bool HasNamedInterceptor(); 2409 inline bool HasNamedInterceptor();
2408 inline bool HasIndexedInterceptor(); 2410 inline bool HasIndexedInterceptor();
2409 2411
2410 // Support functions for v8 api (needed for correct interceptor behavior). 2412 // Support functions for v8 api (needed for correct interceptor behavior).
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2460 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( 2462 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap(
2461 Isolate* isolate, 2463 Isolate* isolate,
2462 ElementsKind elements_kind); 2464 ElementsKind elements_kind);
2463 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( 2465 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow(
2464 ElementsKind elements_kind); 2466 ElementsKind elements_kind);
2465 2467
2466 static void TransitionElementsKind(Handle<JSObject> object, 2468 static void TransitionElementsKind(Handle<JSObject> object,
2467 ElementsKind to_kind); 2469 ElementsKind to_kind);
2468 2470
2469 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); 2471 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
2472 static void UpdateAllocationSite(Handle<JSObject> object,
Michael Starzinger 2013/11/13 12:24:45 Likewise.
rafaelw 2013/11/13 20:56:47 Done.
2473 ElementsKind to_kind);
2470 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); 2474 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2471 2475
2472 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). 2476 // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty().
2473 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map); 2477 static void MigrateToMap(Handle<JSObject> object, Handle<Map> new_map);
2474 static void GeneralizeFieldRepresentation(Handle<JSObject> object, 2478 static void GeneralizeFieldRepresentation(Handle<JSObject> object,
2475 int modify_index, 2479 int modify_index,
2476 Representation new_representation, 2480 Representation new_representation,
2477 StoreMode store_mode); 2481 StoreMode store_mode);
2478 2482
2479 // Convert the object to use the canonical dictionary 2483 // Convert the object to use the canonical dictionary
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 JSReceiver* receiver, 2682 JSReceiver* receiver,
2679 uint32_t index, 2683 uint32_t index,
2680 bool continue_search); 2684 bool continue_search);
2681 static Handle<Object> SetElementWithCallback( 2685 static Handle<Object> SetElementWithCallback(
2682 Handle<JSObject> object, 2686 Handle<JSObject> object,
2683 Handle<Object> structure, 2687 Handle<Object> structure,
2684 uint32_t index, 2688 uint32_t index,
2685 Handle<Object> value, 2689 Handle<Object> value,
2686 Handle<JSObject> holder, 2690 Handle<JSObject> holder,
2687 StrictModeFlag strict_mode); 2691 StrictModeFlag strict_mode);
2688 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor( 2692 static Handle<Object> SetElementWithInterceptor(
2693 Handle<JSObject> object,
2689 uint32_t index, 2694 uint32_t index,
2690 Object* value, 2695 Handle<Object> value,
2691 PropertyAttributes attributes, 2696 PropertyAttributes attributes,
2692 StrictModeFlag strict_mode, 2697 StrictModeFlag strict_mode,
2693 bool check_prototype, 2698 bool check_prototype,
2694 SetPropertyMode set_mode); 2699 SetPropertyMode set_mode);
2695 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 2700 static Handle<Object> SetElementWithoutInterceptor(
2701 Handle<JSObject> object,
2696 uint32_t index, 2702 uint32_t index,
2697 Object* value, 2703 Handle<Object> value,
2698 PropertyAttributes attributes, 2704 PropertyAttributes attributes,
2699 StrictModeFlag strict_mode, 2705 StrictModeFlag strict_mode,
2700 bool check_prototype, 2706 bool check_prototype,
2701 SetPropertyMode set_mode); 2707 SetPropertyMode set_mode);
2702 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( 2708 static Handle<Object> SetElementWithCallbackSetterInPrototypes(
2709 Handle<JSObject> object,
2703 uint32_t index, 2710 uint32_t index,
2704 Object* value, 2711 Handle<Object> value,
2705 bool* found, 2712 bool* found,
2706 StrictModeFlag strict_mode); 2713 StrictModeFlag strict_mode);
2707 2714
2708 // Searches the prototype chain for property 'name'. If it is found and 2715 // Searches the prototype chain for property 'name'. If it is found and
2709 // has a setter, invoke it and set '*done' to true. If it is found and is 2716 // has a setter, invoke it and set '*done' to true. If it is found and is
2710 // read-only, reject and set '*done' to true. Otherwise, set '*done' to 2717 // read-only, reject and set '*done' to true. Otherwise, set '*done' to
2711 // false. Can throw and return an empty handle with '*done==true'. 2718 // false. Can throw and return an empty handle with '*done==true'.
2712 static Handle<Object> SetPropertyViaPrototypes( 2719 static Handle<Object> SetPropertyViaPrototypes(
2713 Handle<JSObject> object, 2720 Handle<JSObject> object,
2714 Handle<Name> name, 2721 Handle<Name> name,
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3958 class SeededNumberDictionary 3965 class SeededNumberDictionary
3959 : public Dictionary<SeededNumberDictionaryShape, uint32_t> { 3966 : public Dictionary<SeededNumberDictionaryShape, uint32_t> {
3960 public: 3967 public:
3961 static SeededNumberDictionary* cast(Object* obj) { 3968 static SeededNumberDictionary* cast(Object* obj) {
3962 ASSERT(obj->IsDictionary()); 3969 ASSERT(obj->IsDictionary());
3963 return reinterpret_cast<SeededNumberDictionary*>(obj); 3970 return reinterpret_cast<SeededNumberDictionary*>(obj);
3964 } 3971 }
3965 3972
3966 // Type specific at put (default NONE attributes is used when adding). 3973 // Type specific at put (default NONE attributes is used when adding).
3967 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value); 3974 MUST_USE_RESULT MaybeObject* AtNumberPut(uint32_t key, Object* value);
3975 MUST_USE_RESULT static Handle<SeededNumberDictionary> AddNumberEntry(
3976 Handle<SeededNumberDictionary> dictionary,
3977 uint32_t key,
3978 Handle<Object> value,
3979 PropertyDetails details);
Michael Starzinger 2013/11/13 12:24:45 nit: Indentation is off.
rafaelw 2013/11/13 20:56:47 Done.
3968 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key, 3980 MUST_USE_RESULT MaybeObject* AddNumberEntry(uint32_t key,
3969 Object* value, 3981 Object* value,
3970 PropertyDetails details); 3982 PropertyDetails details);
3971 3983
3972 // Set an existing entry or add a new one if needed. 3984 // Set an existing entry or add a new one if needed.
3973 // Return the updated dictionary. 3985 // Return the updated dictionary.
3974 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set( 3986 MUST_USE_RESULT static Handle<SeededNumberDictionary> Set(
3975 Handle<SeededNumberDictionary> dictionary, 3987 Handle<SeededNumberDictionary> dictionary,
3976 uint32_t index, 3988 uint32_t index,
3977 Handle<Object> value, 3989 Handle<Object> value,
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
4582 }; 4594 };
4583 4595
4584 4596
4585 class ExternalByteArray: public ExternalArray { 4597 class ExternalByteArray: public ExternalArray {
4586 public: 4598 public:
4587 // Setter and getter. 4599 // Setter and getter.
4588 inline int8_t get_scalar(int index); 4600 inline int8_t get_scalar(int index);
4589 MUST_USE_RESULT inline MaybeObject* get(int index); 4601 MUST_USE_RESULT inline MaybeObject* get(int index);
4590 inline void set(int index, int8_t value); 4602 inline void set(int index, int8_t value);
4591 4603
4604 static Handle<Object> SetValue(Handle<ExternalByteArray> array,
4605 uint32_t index,
4606 Handle<Object> value);
4607
4592 // This accessor applies the correct conversion from Smi, HeapNumber 4608 // This accessor applies the correct conversion from Smi, HeapNumber
4593 // and undefined. 4609 // and undefined.
4594 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4610 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4595 4611
4596 // Casting. 4612 // Casting.
4597 static inline ExternalByteArray* cast(Object* obj); 4613 static inline ExternalByteArray* cast(Object* obj);
4598 4614
4599 // Dispatched behavior. 4615 // Dispatched behavior.
4600 DECLARE_PRINTER(ExternalByteArray) 4616 DECLARE_PRINTER(ExternalByteArray)
4601 DECLARE_VERIFIER(ExternalByteArray) 4617 DECLARE_VERIFIER(ExternalByteArray)
4602 4618
4603 private: 4619 private:
4604 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray); 4620 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalByteArray);
4605 }; 4621 };
4606 4622
4607 4623
4608 class ExternalUnsignedByteArray: public ExternalArray { 4624 class ExternalUnsignedByteArray: public ExternalArray {
4609 public: 4625 public:
4610 // Setter and getter. 4626 // Setter and getter.
4611 inline uint8_t get_scalar(int index); 4627 inline uint8_t get_scalar(int index);
4612 MUST_USE_RESULT inline MaybeObject* get(int index); 4628 MUST_USE_RESULT inline MaybeObject* get(int index);
4613 inline void set(int index, uint8_t value); 4629 inline void set(int index, uint8_t value);
4614 4630
4631 static Handle<Object> SetValue(Handle<ExternalUnsignedByteArray> array,
4632 uint32_t index,
4633 Handle<Object> value);
4634
4615 // This accessor applies the correct conversion from Smi, HeapNumber 4635 // This accessor applies the correct conversion from Smi, HeapNumber
4616 // and undefined. 4636 // and undefined.
4617 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4637 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4618 4638
4619 // Casting. 4639 // Casting.
4620 static inline ExternalUnsignedByteArray* cast(Object* obj); 4640 static inline ExternalUnsignedByteArray* cast(Object* obj);
4621 4641
4622 // Dispatched behavior. 4642 // Dispatched behavior.
4623 DECLARE_PRINTER(ExternalUnsignedByteArray) 4643 DECLARE_PRINTER(ExternalUnsignedByteArray)
4624 DECLARE_VERIFIER(ExternalUnsignedByteArray) 4644 DECLARE_VERIFIER(ExternalUnsignedByteArray)
4625 4645
4626 private: 4646 private:
4627 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray); 4647 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedByteArray);
4628 }; 4648 };
4629 4649
4630 4650
4631 class ExternalShortArray: public ExternalArray { 4651 class ExternalShortArray: public ExternalArray {
4632 public: 4652 public:
4633 // Setter and getter. 4653 // Setter and getter.
4634 inline int16_t get_scalar(int index); 4654 inline int16_t get_scalar(int index);
4635 MUST_USE_RESULT inline MaybeObject* get(int index); 4655 MUST_USE_RESULT inline MaybeObject* get(int index);
4636 inline void set(int index, int16_t value); 4656 inline void set(int index, int16_t value);
4637 4657
4658 static Handle<Object> SetValue(Handle<ExternalShortArray> array,
4659 uint32_t index,
4660 Handle<Object> value);
4661
4638 // This accessor applies the correct conversion from Smi, HeapNumber 4662 // This accessor applies the correct conversion from Smi, HeapNumber
4639 // and undefined. 4663 // and undefined.
4640 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4664 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4641 4665
4642 // Casting. 4666 // Casting.
4643 static inline ExternalShortArray* cast(Object* obj); 4667 static inline ExternalShortArray* cast(Object* obj);
4644 4668
4645 // Dispatched behavior. 4669 // Dispatched behavior.
4646 DECLARE_PRINTER(ExternalShortArray) 4670 DECLARE_PRINTER(ExternalShortArray)
4647 DECLARE_VERIFIER(ExternalShortArray) 4671 DECLARE_VERIFIER(ExternalShortArray)
4648 4672
4649 private: 4673 private:
4650 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray); 4674 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalShortArray);
4651 }; 4675 };
4652 4676
4653 4677
4654 class ExternalUnsignedShortArray: public ExternalArray { 4678 class ExternalUnsignedShortArray: public ExternalArray {
4655 public: 4679 public:
4656 // Setter and getter. 4680 // Setter and getter.
4657 inline uint16_t get_scalar(int index); 4681 inline uint16_t get_scalar(int index);
4658 MUST_USE_RESULT inline MaybeObject* get(int index); 4682 MUST_USE_RESULT inline MaybeObject* get(int index);
4659 inline void set(int index, uint16_t value); 4683 inline void set(int index, uint16_t value);
4660 4684
4685 static Handle<Object> SetValue(Handle<ExternalUnsignedShortArray> array,
4686 uint32_t index,
4687 Handle<Object> value);
4688
4661 // This accessor applies the correct conversion from Smi, HeapNumber 4689 // This accessor applies the correct conversion from Smi, HeapNumber
4662 // and undefined. 4690 // and undefined.
4663 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4691 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4664 4692
4665 // Casting. 4693 // Casting.
4666 static inline ExternalUnsignedShortArray* cast(Object* obj); 4694 static inline ExternalUnsignedShortArray* cast(Object* obj);
4667 4695
4668 // Dispatched behavior. 4696 // Dispatched behavior.
4669 DECLARE_PRINTER(ExternalUnsignedShortArray) 4697 DECLARE_PRINTER(ExternalUnsignedShortArray)
4670 DECLARE_VERIFIER(ExternalUnsignedShortArray) 4698 DECLARE_VERIFIER(ExternalUnsignedShortArray)
4671 4699
4672 private: 4700 private:
4673 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray); 4701 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedShortArray);
4674 }; 4702 };
4675 4703
4676 4704
4677 class ExternalIntArray: public ExternalArray { 4705 class ExternalIntArray: public ExternalArray {
4678 public: 4706 public:
4679 // Setter and getter. 4707 // Setter and getter.
4680 inline int32_t get_scalar(int index); 4708 inline int32_t get_scalar(int index);
4681 MUST_USE_RESULT inline MaybeObject* get(int index); 4709 MUST_USE_RESULT inline MaybeObject* get(int index);
4682 inline void set(int index, int32_t value); 4710 inline void set(int index, int32_t value);
4683 4711
4712 static Handle<Object> SetValue(Handle<ExternalIntArray> array,
4713 uint32_t index,
4714 Handle<Object> value);
4715
4684 // This accessor applies the correct conversion from Smi, HeapNumber 4716 // This accessor applies the correct conversion from Smi, HeapNumber
4685 // and undefined. 4717 // and undefined.
4686 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4718 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4687 4719
4688 // Casting. 4720 // Casting.
4689 static inline ExternalIntArray* cast(Object* obj); 4721 static inline ExternalIntArray* cast(Object* obj);
4690 4722
4691 // Dispatched behavior. 4723 // Dispatched behavior.
4692 DECLARE_PRINTER(ExternalIntArray) 4724 DECLARE_PRINTER(ExternalIntArray)
4693 DECLARE_VERIFIER(ExternalIntArray) 4725 DECLARE_VERIFIER(ExternalIntArray)
4694 4726
4695 private: 4727 private:
4696 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray); 4728 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalIntArray);
4697 }; 4729 };
4698 4730
4699 4731
4700 class ExternalUnsignedIntArray: public ExternalArray { 4732 class ExternalUnsignedIntArray: public ExternalArray {
4701 public: 4733 public:
4702 // Setter and getter. 4734 // Setter and getter.
4703 inline uint32_t get_scalar(int index); 4735 inline uint32_t get_scalar(int index);
4704 MUST_USE_RESULT inline MaybeObject* get(int index); 4736 MUST_USE_RESULT inline MaybeObject* get(int index);
4705 inline void set(int index, uint32_t value); 4737 inline void set(int index, uint32_t value);
4706 4738
4739 static Handle<Object> SetValue(Handle<ExternalUnsignedIntArray> array,
4740 uint32_t index,
4741 Handle<Object> value);
4742
4707 // This accessor applies the correct conversion from Smi, HeapNumber 4743 // This accessor applies the correct conversion from Smi, HeapNumber
4708 // and undefined. 4744 // and undefined.
4709 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4745 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4710 4746
4711 // Casting. 4747 // Casting.
4712 static inline ExternalUnsignedIntArray* cast(Object* obj); 4748 static inline ExternalUnsignedIntArray* cast(Object* obj);
4713 4749
4714 // Dispatched behavior. 4750 // Dispatched behavior.
4715 DECLARE_PRINTER(ExternalUnsignedIntArray) 4751 DECLARE_PRINTER(ExternalUnsignedIntArray)
4716 DECLARE_VERIFIER(ExternalUnsignedIntArray) 4752 DECLARE_VERIFIER(ExternalUnsignedIntArray)
4717 4753
4718 private: 4754 private:
4719 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray); 4755 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalUnsignedIntArray);
4720 }; 4756 };
4721 4757
4722 4758
4723 class ExternalFloatArray: public ExternalArray { 4759 class ExternalFloatArray: public ExternalArray {
4724 public: 4760 public:
4725 // Setter and getter. 4761 // Setter and getter.
4726 inline float get_scalar(int index); 4762 inline float get_scalar(int index);
4727 MUST_USE_RESULT inline MaybeObject* get(int index); 4763 MUST_USE_RESULT inline MaybeObject* get(int index);
4728 inline void set(int index, float value); 4764 inline void set(int index, float value);
4729 4765
4766 static Handle<Object> SetValue(Handle<ExternalFloatArray> array,
4767 uint32_t index,
4768 Handle<Object> value);
4769
4730 // This accessor applies the correct conversion from Smi, HeapNumber 4770 // This accessor applies the correct conversion from Smi, HeapNumber
4731 // and undefined. 4771 // and undefined.
4732 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4772 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4733 4773
4734 // Casting. 4774 // Casting.
4735 static inline ExternalFloatArray* cast(Object* obj); 4775 static inline ExternalFloatArray* cast(Object* obj);
4736 4776
4737 // Dispatched behavior. 4777 // Dispatched behavior.
4738 DECLARE_PRINTER(ExternalFloatArray) 4778 DECLARE_PRINTER(ExternalFloatArray)
4739 DECLARE_VERIFIER(ExternalFloatArray) 4779 DECLARE_VERIFIER(ExternalFloatArray)
4740 4780
4741 private: 4781 private:
4742 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray); 4782 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalFloatArray);
4743 }; 4783 };
4744 4784
4745 4785
4746 class ExternalDoubleArray: public ExternalArray { 4786 class ExternalDoubleArray: public ExternalArray {
4747 public: 4787 public:
4748 // Setter and getter. 4788 // Setter and getter.
4749 inline double get_scalar(int index); 4789 inline double get_scalar(int index);
4750 MUST_USE_RESULT inline MaybeObject* get(int index); 4790 MUST_USE_RESULT inline MaybeObject* get(int index);
4751 inline void set(int index, double value); 4791 inline void set(int index, double value);
4752 4792
4793 static Handle<Object> SetValue(Handle<ExternalDoubleArray> array,
4794 uint32_t index,
4795 Handle<Object> value);
4796
4753 // This accessor applies the correct conversion from Smi, HeapNumber 4797 // This accessor applies the correct conversion from Smi, HeapNumber
4754 // and undefined. 4798 // and undefined.
4755 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value); 4799 MUST_USE_RESULT MaybeObject* SetValue(uint32_t index, Object* value);
4756 4800
4757 // Casting. 4801 // Casting.
4758 static inline ExternalDoubleArray* cast(Object* obj); 4802 static inline ExternalDoubleArray* cast(Object* obj);
4759 4803
4760 // Dispatched behavior. 4804 // Dispatched behavior.
4761 DECLARE_PRINTER(ExternalDoubleArray) 4805 DECLARE_PRINTER(ExternalDoubleArray)
4762 DECLARE_VERIFIER(ExternalDoubleArray) 4806 DECLARE_VERIFIER(ExternalDoubleArray)
(...skipping 4934 matching lines...) Expand 10 before | Expand all | Expand 10 after
9697 // - slow, backing storage is a HashTable with numbers as keys. 9741 // - slow, backing storage is a HashTable with numbers as keys.
9698 class JSArray: public JSObject { 9742 class JSArray: public JSObject {
9699 public: 9743 public:
9700 // [length]: The length property. 9744 // [length]: The length property.
9701 DECL_ACCESSORS(length, Object) 9745 DECL_ACCESSORS(length, Object)
9702 9746
9703 // Overload the length setter to skip write barrier when the length 9747 // Overload the length setter to skip write barrier when the length
9704 // is set to a smi. This matches the set function on FixedArray. 9748 // is set to a smi. This matches the set function on FixedArray.
9705 inline void set_length(Smi* length); 9749 inline void set_length(Smi* length);
9706 9750
9751 static void JSArrayUpdateLengthFromIndex(Handle<JSArray> array,
9752 uint32_t index,
9753 Handle<Object> value);
9754
9707 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, 9755 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index,
9708 Object* value); 9756 Object* value);
9709 9757
9710 // Initialize the array with the given capacity. The function may 9758 // Initialize the array with the given capacity. The function may
9711 // fail due to out-of-memory situations, but only if the requested 9759 // fail due to out-of-memory situations, but only if the requested
9712 // capacity is non-zero. 9760 // capacity is non-zero.
9713 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0); 9761 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0);
9714 9762
9715 // Initializes the array to a certain length. 9763 // Initializes the array to a certain length.
9716 inline bool AllowsSetElementsLength(); 9764 inline bool AllowsSetElementsLength();
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
10476 } else { 10524 } else {
10477 value &= ~(1 << bit_position); 10525 value &= ~(1 << bit_position);
10478 } 10526 }
10479 return value; 10527 return value;
10480 } 10528 }
10481 }; 10529 };
10482 10530
10483 } } // namespace v8::internal 10531 } } // namespace v8::internal
10484 10532
10485 #endif // V8_OBJECTS_H_ 10533 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/objects.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698