| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 return Failure::Exception(); | 786 return Failure::Exception(); |
| 787 } | 787 } |
| 788 | 788 |
| 789 | 789 |
| 790 bool Object::HasSpecificClassOf(String* name) { | 790 bool Object::HasSpecificClassOf(String* name) { |
| 791 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); | 791 return this->IsJSObject() && (JSObject::cast(this)->class_name() == name); |
| 792 } | 792 } |
| 793 | 793 |
| 794 | 794 |
| 795 MaybeObject* Object::GetElement(uint32_t index) { | 795 MaybeObject* Object::GetElement(uint32_t index) { |
| 796 // GetElement can trigger a getter which can cause allocation. |
| 797 // This was not always the case. This ASSERT is here to catch |
| 798 // leftover incorrect uses. |
| 799 ASSERT(HEAP->IsAllocationAllowed()); |
| 796 return GetElementWithReceiver(this, index); | 800 return GetElementWithReceiver(this, index); |
| 797 } | 801 } |
| 798 | 802 |
| 799 | 803 |
| 800 Object* Object::GetElementNoExceptionThrown(uint32_t index) { | 804 Object* Object::GetElementNoExceptionThrown(uint32_t index) { |
| 801 MaybeObject* maybe = GetElementWithReceiver(this, index); | 805 MaybeObject* maybe = GetElementWithReceiver(this, index); |
| 802 ASSERT(!maybe->IsFailure()); | 806 ASSERT(!maybe->IsFailure()); |
| 803 Object* result = NULL; // Initialization to please compiler. | 807 Object* result = NULL; // Initialization to please compiler. |
| 804 maybe->ToObject(&result); | 808 maybe->ToObject(&result); |
| 805 return result; | 809 return result; |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 } | 2694 } |
| 2691 | 2695 |
| 2692 | 2696 |
| 2693 Code::Flags Code::ComputeFlags(Kind kind, | 2697 Code::Flags Code::ComputeFlags(Kind kind, |
| 2694 InLoopFlag in_loop, | 2698 InLoopFlag in_loop, |
| 2695 InlineCacheState ic_state, | 2699 InlineCacheState ic_state, |
| 2696 ExtraICState extra_ic_state, | 2700 ExtraICState extra_ic_state, |
| 2697 PropertyType type, | 2701 PropertyType type, |
| 2698 int argc, | 2702 int argc, |
| 2699 InlineCacheHolderFlag holder) { | 2703 InlineCacheHolderFlag holder) { |
| 2700 // Extra IC state is only allowed for monomorphic call IC stubs. | 2704 // Extra IC state is only allowed for monomorphic call IC stubs |
| 2705 // or for store IC stubs. |
| 2701 ASSERT(extra_ic_state == kNoExtraICState || | 2706 ASSERT(extra_ic_state == kNoExtraICState || |
| 2702 (kind == CALL_IC && (ic_state == MONOMORPHIC || | 2707 (kind == CALL_IC && (ic_state == MONOMORPHIC || |
| 2703 ic_state == MONOMORPHIC_PROTOTYPE_FAILURE))); | 2708 ic_state == MONOMORPHIC_PROTOTYPE_FAILURE)) || |
| 2709 (kind == STORE_IC) || |
| 2710 (kind == KEYED_STORE_IC)); |
| 2704 // Compute the bit mask. | 2711 // Compute the bit mask. |
| 2705 int bits = kind << kFlagsKindShift; | 2712 int bits = kind << kFlagsKindShift; |
| 2706 if (in_loop) bits |= kFlagsICInLoopMask; | 2713 if (in_loop) bits |= kFlagsICInLoopMask; |
| 2707 bits |= ic_state << kFlagsICStateShift; | 2714 bits |= ic_state << kFlagsICStateShift; |
| 2708 bits |= type << kFlagsTypeShift; | 2715 bits |= type << kFlagsTypeShift; |
| 2709 bits |= extra_ic_state << kFlagsExtraICStateShift; | 2716 bits |= extra_ic_state << kFlagsExtraICStateShift; |
| 2710 bits |= argc << kFlagsArgumentsCountShift; | 2717 bits |= argc << kFlagsArgumentsCountShift; |
| 2711 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; | 2718 if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask; |
| 2712 // Cast to flags and validate result before returning it. | 2719 // Cast to flags and validate result before returning it. |
| 2713 Flags result = static_cast<Flags>(bits); | 2720 Flags result = static_cast<Flags>(bits); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2836 { MaybeObject* maybe_obj = CopyDropTransitions(); | 2843 { MaybeObject* maybe_obj = CopyDropTransitions(); |
| 2837 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 2844 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2838 } | 2845 } |
| 2839 Map* new_map = Map::cast(obj); | 2846 Map* new_map = Map::cast(obj); |
| 2840 new_map->set_has_fast_elements(false); | 2847 new_map->set_has_fast_elements(false); |
| 2841 COUNTERS->map_fast_to_slow_elements()->Increment(); | 2848 COUNTERS->map_fast_to_slow_elements()->Increment(); |
| 2842 return new_map; | 2849 return new_map; |
| 2843 } | 2850 } |
| 2844 | 2851 |
| 2845 | 2852 |
| 2853 MaybeObject* Map::GetPixelArrayElementsMap() { |
| 2854 if (has_pixel_array_elements()) return this; |
| 2855 // TODO(danno): Special case empty object map (or most common case) |
| 2856 // to return a pre-canned pixel array map. |
| 2857 Object* obj; |
| 2858 { MaybeObject* maybe_obj = CopyDropTransitions(); |
| 2859 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2860 } |
| 2861 Map* new_map = Map::cast(obj); |
| 2862 new_map->set_has_fast_elements(false); |
| 2863 new_map->set_has_pixel_array_elements(true); |
| 2864 COUNTERS->map_to_pixel_array_elements()->Increment(); |
| 2865 return new_map; |
| 2866 } |
| 2867 |
| 2868 |
| 2846 ACCESSORS(Map, instance_descriptors, DescriptorArray, | 2869 ACCESSORS(Map, instance_descriptors, DescriptorArray, |
| 2847 kInstanceDescriptorsOffset) | 2870 kInstanceDescriptorsOffset) |
| 2848 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 2871 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) |
| 2849 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 2872 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
| 2850 | 2873 |
| 2851 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 2874 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
| 2852 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) | 2875 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) |
| 2853 ACCESSORS_GCSAFE(JSFunction, next_function_link, Object, | 2876 ACCESSORS_GCSAFE(JSFunction, next_function_link, Object, |
| 2854 kNextFunctionLinkOffset) | 2877 kNextFunctionLinkOffset) |
| 2855 | 2878 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3812 GetHeap()->hidden_symbol(), | 3835 GetHeap()->hidden_symbol(), |
| 3813 &attributes)->ToObjectUnchecked(); | 3836 &attributes)->ToObjectUnchecked(); |
| 3814 return result; | 3837 return result; |
| 3815 } | 3838 } |
| 3816 | 3839 |
| 3817 | 3840 |
| 3818 MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) { | 3841 MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) { |
| 3819 ASSERT(!IsJSGlobalProxy()); | 3842 ASSERT(!IsJSGlobalProxy()); |
| 3820 return SetPropertyPostInterceptor(GetHeap()->hidden_symbol(), | 3843 return SetPropertyPostInterceptor(GetHeap()->hidden_symbol(), |
| 3821 hidden_obj, | 3844 hidden_obj, |
| 3822 DONT_ENUM); | 3845 DONT_ENUM, |
| 3846 kNonStrictMode); |
| 3823 } | 3847 } |
| 3824 | 3848 |
| 3825 | 3849 |
| 3826 bool JSObject::HasElement(uint32_t index) { | 3850 bool JSObject::HasElement(uint32_t index) { |
| 3827 return HasElementWithReceiver(this, index); | 3851 return HasElementWithReceiver(this, index); |
| 3828 } | 3852 } |
| 3829 | 3853 |
| 3830 | 3854 |
| 3831 bool AccessorInfo::all_can_read() { | 3855 bool AccessorInfo::all_can_read() { |
| 3832 return BooleanBit::get(flag(), kAllCanReadBit); | 3856 return BooleanBit::get(flag(), kAllCanReadBit); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4073 #undef WRITE_INT_FIELD | 4097 #undef WRITE_INT_FIELD |
| 4074 #undef READ_SHORT_FIELD | 4098 #undef READ_SHORT_FIELD |
| 4075 #undef WRITE_SHORT_FIELD | 4099 #undef WRITE_SHORT_FIELD |
| 4076 #undef READ_BYTE_FIELD | 4100 #undef READ_BYTE_FIELD |
| 4077 #undef WRITE_BYTE_FIELD | 4101 #undef WRITE_BYTE_FIELD |
| 4078 | 4102 |
| 4079 | 4103 |
| 4080 } } // namespace v8::internal | 4104 } } // namespace v8::internal |
| 4081 | 4105 |
| 4082 #endif // V8_OBJECTS_INL_H_ | 4106 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |