| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE; | 160 && HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE; |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 |
| 164 bool Object::IsString() { | 164 bool Object::IsString() { |
| 165 return Object::IsHeapObject() | 165 return Object::IsHeapObject() |
| 166 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; | 166 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; |
| 167 } | 167 } |
| 168 | 168 |
| 169 | 169 |
| 170 bool Object::IsSpecObject() { |
| 171 return Object::IsHeapObject() |
| 172 && HeapObject::cast(this)->map()->instance_type() >= FIRST_SPEC_OBJECT_TYPE; |
| 173 } |
| 174 |
| 175 |
| 170 bool Object::IsSymbol() { | 176 bool Object::IsSymbol() { |
| 171 if (!this->IsHeapObject()) return false; | 177 if (!this->IsHeapObject()) return false; |
| 172 uint32_t type = HeapObject::cast(this)->map()->instance_type(); | 178 uint32_t type = HeapObject::cast(this)->map()->instance_type(); |
| 173 // Because the symbol tag is non-zero and no non-string types have the | 179 // Because the symbol tag is non-zero and no non-string types have the |
| 174 // symbol bit set we can test for symbols with a very simple test | 180 // symbol bit set we can test for symbols with a very simple test |
| 175 // operation. | 181 // operation. |
| 176 ASSERT(kSymbolTag != 0); | 182 ASSERT(kSymbolTag != 0); |
| 177 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); | 183 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); |
| 178 return (type & kIsSymbolMask) != 0; | 184 return (type & kIsSymbolMask) != 0; |
| 179 } | 185 } |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 Object* array = READ_FIELD(this, kElementsOffset); | 1222 Object* array = READ_FIELD(this, kElementsOffset); |
| 1217 ASSERT(array->HasValidElements()); | 1223 ASSERT(array->HasValidElements()); |
| 1218 return reinterpret_cast<HeapObject*>(array); | 1224 return reinterpret_cast<HeapObject*>(array); |
| 1219 } | 1225 } |
| 1220 | 1226 |
| 1221 | 1227 |
| 1222 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { | 1228 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { |
| 1223 ASSERT(map()->has_fast_elements() == | 1229 ASSERT(map()->has_fast_elements() == |
| 1224 (value->map() == GetHeap()->fixed_array_map() || | 1230 (value->map() == GetHeap()->fixed_array_map() || |
| 1225 value->map() == GetHeap()->fixed_cow_array_map())); | 1231 value->map() == GetHeap()->fixed_cow_array_map())); |
| 1232 ASSERT(map()->has_fast_double_elements() == |
| 1233 value->IsFixedDoubleArray()); |
| 1226 ASSERT(value->HasValidElements()); | 1234 ASSERT(value->HasValidElements()); |
| 1227 WRITE_FIELD(this, kElementsOffset, value); | 1235 WRITE_FIELD(this, kElementsOffset, value); |
| 1228 WRITE_BARRIER(GetHeap(), this, kElementsOffset, value); | 1236 WRITE_BARRIER(GetHeap(), this, kElementsOffset, value); |
| 1229 } | 1237 } |
| 1230 | 1238 |
| 1231 | 1239 |
| 1232 void JSObject::initialize_properties() { | 1240 void JSObject::initialize_properties() { |
| 1233 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); | 1241 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 1234 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1242 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
| 1235 } | 1243 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 | 1503 |
| 1496 void FixedArray::set(int index, Object* value) { | 1504 void FixedArray::set(int index, Object* value) { |
| 1497 ASSERT(map() != HEAP->fixed_cow_array_map()); | 1505 ASSERT(map() != HEAP->fixed_cow_array_map()); |
| 1498 ASSERT(index >= 0 && index < this->length()); | 1506 ASSERT(index >= 0 && index < this->length()); |
| 1499 int offset = kHeaderSize + index * kPointerSize; | 1507 int offset = kHeaderSize + index * kPointerSize; |
| 1500 WRITE_FIELD(this, offset, value); | 1508 WRITE_FIELD(this, offset, value); |
| 1501 WRITE_BARRIER(GetHeap(), this, offset, value); | 1509 WRITE_BARRIER(GetHeap(), this, offset, value); |
| 1502 } | 1510 } |
| 1503 | 1511 |
| 1504 | 1512 |
| 1513 inline bool FixedDoubleArray::is_the_hole_nan(double value) { |
| 1514 return BitCast<uint64_t, double>(value) == kHoleNanInt64; |
| 1515 } |
| 1516 |
| 1517 |
| 1518 inline double FixedDoubleArray::hole_nan_as_double() { |
| 1519 return BitCast<double, uint64_t>(kHoleNanInt64); |
| 1520 } |
| 1521 |
| 1522 |
| 1523 inline double FixedDoubleArray::canonical_not_the_hole_nan_as_double() { |
| 1524 ASSERT(BitCast<uint64_t>(OS::nan_value()) != kHoleNanInt64); |
| 1525 ASSERT((BitCast<uint64_t>(OS::nan_value()) >> 32) != kHoleNanUpper32); |
| 1526 return OS::nan_value(); |
| 1527 } |
| 1528 |
| 1529 |
| 1505 double FixedDoubleArray::get(int index) { | 1530 double FixedDoubleArray::get(int index) { |
| 1506 ASSERT(map() != HEAP->fixed_cow_array_map() && | 1531 ASSERT(map() != HEAP->fixed_cow_array_map() && |
| 1507 map() != HEAP->fixed_array_map()); | 1532 map() != HEAP->fixed_array_map()); |
| 1508 ASSERT(index >= 0 && index < this->length()); | 1533 ASSERT(index >= 0 && index < this->length()); |
| 1509 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); | 1534 double result = READ_DOUBLE_FIELD(this, kHeaderSize + index * kDoubleSize); |
| 1510 ASSERT(!is_the_hole_nan(result)); | 1535 ASSERT(!is_the_hole_nan(result)); |
| 1511 return result; | 1536 return result; |
| 1512 } | 1537 } |
| 1513 | 1538 |
| 1514 | 1539 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 | 1858 |
| 1834 void DescriptorArray::Swap(int first, int second) { | 1859 void DescriptorArray::Swap(int first, int second) { |
| 1835 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); | 1860 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); |
| 1836 FixedArray* content_array = GetContentArray(); | 1861 FixedArray* content_array = GetContentArray(); |
| 1837 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); | 1862 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); |
| 1838 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); | 1863 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); |
| 1839 } | 1864 } |
| 1840 | 1865 |
| 1841 | 1866 |
| 1842 template<typename Shape, typename Key> | 1867 template<typename Shape, typename Key> |
| 1868 int HashTable<Shape, Key>::ComputeCapacity(int at_least_space_for) { |
| 1869 const int kMinCapacity = 32; |
| 1870 int capacity = RoundUpToPowerOf2(at_least_space_for * 2); |
| 1871 if (capacity < kMinCapacity) { |
| 1872 capacity = kMinCapacity; // Guarantee min capacity. |
| 1873 } |
| 1874 return capacity; |
| 1875 } |
| 1876 |
| 1877 |
| 1878 template<typename Shape, typename Key> |
| 1843 int HashTable<Shape, Key>::FindEntry(Key key) { | 1879 int HashTable<Shape, Key>::FindEntry(Key key) { |
| 1844 return FindEntry(GetIsolate(), key); | 1880 return FindEntry(GetIsolate(), key); |
| 1845 } | 1881 } |
| 1846 | 1882 |
| 1847 | 1883 |
| 1848 // Find entry for key otherwise return kNotFound. | 1884 // Find entry for key otherwise return kNotFound. |
| 1849 template<typename Shape, typename Key> | 1885 template<typename Shape, typename Key> |
| 1850 int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) { | 1886 int HashTable<Shape, Key>::FindEntry(Isolate* isolate, Key key) { |
| 1851 uint32_t capacity = Capacity(); | 1887 uint32_t capacity = Capacity(); |
| 1852 uint32_t entry = FirstProbe(Shape::Hash(key), capacity); | 1888 uint32_t entry = FirstProbe(Shape::Hash(key), capacity); |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 int Code::arguments_count() { | 2664 int Code::arguments_count() { |
| 2629 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); | 2665 ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB); |
| 2630 return ExtractArgumentsCountFromFlags(flags()); | 2666 return ExtractArgumentsCountFromFlags(flags()); |
| 2631 } | 2667 } |
| 2632 | 2668 |
| 2633 | 2669 |
| 2634 int Code::major_key() { | 2670 int Code::major_key() { |
| 2635 ASSERT(kind() == STUB || | 2671 ASSERT(kind() == STUB || |
| 2636 kind() == UNARY_OP_IC || | 2672 kind() == UNARY_OP_IC || |
| 2637 kind() == BINARY_OP_IC || | 2673 kind() == BINARY_OP_IC || |
| 2638 kind() == COMPARE_IC); | 2674 kind() == COMPARE_IC || |
| 2675 kind() == TO_BOOLEAN_IC); |
| 2639 return READ_BYTE_FIELD(this, kStubMajorKeyOffset); | 2676 return READ_BYTE_FIELD(this, kStubMajorKeyOffset); |
| 2640 } | 2677 } |
| 2641 | 2678 |
| 2642 | 2679 |
| 2643 void Code::set_major_key(int major) { | 2680 void Code::set_major_key(int major) { |
| 2644 ASSERT(kind() == STUB || | 2681 ASSERT(kind() == STUB || |
| 2645 kind() == UNARY_OP_IC || | 2682 kind() == UNARY_OP_IC || |
| 2646 kind() == BINARY_OP_IC || | 2683 kind() == BINARY_OP_IC || |
| 2647 kind() == COMPARE_IC); | 2684 kind() == COMPARE_IC || |
| 2685 kind() == TO_BOOLEAN_IC); |
| 2648 ASSERT(0 <= major && major < 256); | 2686 ASSERT(0 <= major && major < 256); |
| 2649 WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major); | 2687 WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major); |
| 2650 } | 2688 } |
| 2651 | 2689 |
| 2652 | 2690 |
| 2653 bool Code::optimizable() { | 2691 bool Code::optimizable() { |
| 2654 ASSERT(kind() == FUNCTION); | 2692 ASSERT(kind() == FUNCTION); |
| 2655 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; | 2693 return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; |
| 2656 } | 2694 } |
| 2657 | 2695 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2779 return READ_BYTE_FIELD(this, kCompareStateOffset); | 2817 return READ_BYTE_FIELD(this, kCompareStateOffset); |
| 2780 } | 2818 } |
| 2781 | 2819 |
| 2782 | 2820 |
| 2783 void Code::set_compare_state(byte value) { | 2821 void Code::set_compare_state(byte value) { |
| 2784 ASSERT(is_compare_ic_stub()); | 2822 ASSERT(is_compare_ic_stub()); |
| 2785 WRITE_BYTE_FIELD(this, kCompareStateOffset, value); | 2823 WRITE_BYTE_FIELD(this, kCompareStateOffset, value); |
| 2786 } | 2824 } |
| 2787 | 2825 |
| 2788 | 2826 |
| 2827 byte Code::to_boolean_state() { |
| 2828 ASSERT(is_to_boolean_ic_stub()); |
| 2829 return READ_BYTE_FIELD(this, kToBooleanTypeOffset); |
| 2830 } |
| 2831 |
| 2832 |
| 2833 void Code::set_to_boolean_state(byte value) { |
| 2834 ASSERT(is_to_boolean_ic_stub()); |
| 2835 WRITE_BYTE_FIELD(this, kToBooleanTypeOffset, value); |
| 2836 } |
| 2837 |
| 2789 bool Code::is_inline_cache_stub() { | 2838 bool Code::is_inline_cache_stub() { |
| 2790 Kind kind = this->kind(); | 2839 Kind kind = this->kind(); |
| 2791 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; | 2840 return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND; |
| 2792 } | 2841 } |
| 2793 | 2842 |
| 2794 | 2843 |
| 2795 Code::Flags Code::ComputeFlags(Kind kind, | 2844 Code::Flags Code::ComputeFlags(Kind kind, |
| 2796 InLoopFlag in_loop, | 2845 InLoopFlag in_loop, |
| 2797 InlineCacheState ic_state, | 2846 InlineCacheState ic_state, |
| 2798 ExtraICState extra_ic_state, | 2847 ExtraICState extra_ic_state, |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 kIndexedPropertyHandlerOffset) | 3133 kIndexedPropertyHandlerOffset) |
| 3085 ACCESSORS(FunctionTemplateInfo, instance_template, Object, | 3134 ACCESSORS(FunctionTemplateInfo, instance_template, Object, |
| 3086 kInstanceTemplateOffset) | 3135 kInstanceTemplateOffset) |
| 3087 ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset) | 3136 ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset) |
| 3088 ACCESSORS(FunctionTemplateInfo, signature, Object, kSignatureOffset) | 3137 ACCESSORS(FunctionTemplateInfo, signature, Object, kSignatureOffset) |
| 3089 ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object, | 3138 ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object, |
| 3090 kInstanceCallHandlerOffset) | 3139 kInstanceCallHandlerOffset) |
| 3091 ACCESSORS(FunctionTemplateInfo, access_check_info, Object, | 3140 ACCESSORS(FunctionTemplateInfo, access_check_info, Object, |
| 3092 kAccessCheckInfoOffset) | 3141 kAccessCheckInfoOffset) |
| 3093 ACCESSORS(FunctionTemplateInfo, flag, Smi, kFlagOffset) | 3142 ACCESSORS(FunctionTemplateInfo, flag, Smi, kFlagOffset) |
| 3094 ACCESSORS(FunctionTemplateInfo, prototype_attributes, Smi, | |
| 3095 kPrototypeAttributesOffset) | |
| 3096 | 3143 |
| 3097 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset) | 3144 ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset) |
| 3098 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, | 3145 ACCESSORS(ObjectTemplateInfo, internal_field_count, Object, |
| 3099 kInternalFieldCountOffset) | 3146 kInternalFieldCountOffset) |
| 3100 | 3147 |
| 3101 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset) | 3148 ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset) |
| 3102 ACCESSORS(SignatureInfo, args, Object, kArgsOffset) | 3149 ACCESSORS(SignatureInfo, args, Object, kArgsOffset) |
| 3103 | 3150 |
| 3104 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) | 3151 ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset) |
| 3105 | 3152 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3140 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 3187 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
| 3141 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 3188 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) |
| 3142 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object, | 3189 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object, |
| 3143 kThisPropertyAssignmentsOffset) | 3190 kThisPropertyAssignmentsOffset) |
| 3144 | 3191 |
| 3145 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, | 3192 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, |
| 3146 kHiddenPrototypeBit) | 3193 kHiddenPrototypeBit) |
| 3147 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) | 3194 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) |
| 3148 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, | 3195 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, |
| 3149 kNeedsAccessCheckBit) | 3196 kNeedsAccessCheckBit) |
| 3197 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, |
| 3198 kReadOnlyPrototypeBit) |
| 3150 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, | 3199 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, |
| 3151 kIsExpressionBit) | 3200 kIsExpressionBit) |
| 3152 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, | 3201 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, |
| 3153 kIsTopLevelBit) | 3202 kIsTopLevelBit) |
| 3154 BOOL_GETTER(SharedFunctionInfo, | 3203 BOOL_GETTER(SharedFunctionInfo, |
| 3155 compiler_hints, | 3204 compiler_hints, |
| 3156 has_only_simple_this_property_assignments, | 3205 has_only_simple_this_property_assignments, |
| 3157 kHasOnlySimpleThisPropertyAssignments) | 3206 kHasOnlySimpleThisPropertyAssignments) |
| 3158 BOOL_ACCESSORS(SharedFunctionInfo, | 3207 BOOL_ACCESSORS(SharedFunctionInfo, |
| 3159 compiler_hints, | 3208 compiler_hints, |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3604 | 3653 |
| 3605 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 3654 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
| 3606 Code* value) { | 3655 Code* value) { |
| 3607 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3656 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
| 3608 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); | 3657 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); |
| 3609 ASSERT(!HEAP->InNewSpace(value)); | 3658 ASSERT(!HEAP->InNewSpace(value)); |
| 3610 } | 3659 } |
| 3611 | 3660 |
| 3612 | 3661 |
| 3613 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 3662 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| 3663 ACCESSORS(JSProxy, padding, Object, kPaddingOffset) |
| 3614 | 3664 |
| 3615 | 3665 |
| 3616 Address Foreign::address() { | 3666 Address Foreign::address() { |
| 3617 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset)); | 3667 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kAddressOffset)); |
| 3618 } | 3668 } |
| 3619 | 3669 |
| 3620 | 3670 |
| 3621 void Foreign::set_address(Address value) { | 3671 void Foreign::set_address(Address value) { |
| 3622 WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value)); | 3672 WRITE_INTPTR_FIELD(this, kAddressOffset, OffsetFrom(value)); |
| 3623 } | 3673 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3849 return map()->has_named_interceptor(); | 3899 return map()->has_named_interceptor(); |
| 3850 } | 3900 } |
| 3851 | 3901 |
| 3852 | 3902 |
| 3853 bool JSObject::HasIndexedInterceptor() { | 3903 bool JSObject::HasIndexedInterceptor() { |
| 3854 return map()->has_indexed_interceptor(); | 3904 return map()->has_indexed_interceptor(); |
| 3855 } | 3905 } |
| 3856 | 3906 |
| 3857 | 3907 |
| 3858 bool JSObject::AllowsSetElementsLength() { | 3908 bool JSObject::AllowsSetElementsLength() { |
| 3859 bool result = elements()->IsFixedArray(); | 3909 bool result = elements()->IsFixedArray() || |
| 3910 elements()->IsFixedDoubleArray(); |
| 3860 ASSERT(result == !HasExternalArrayElements()); | 3911 ASSERT(result == !HasExternalArrayElements()); |
| 3861 return result; | 3912 return result; |
| 3862 } | 3913 } |
| 3863 | 3914 |
| 3864 | 3915 |
| 3865 MaybeObject* JSObject::EnsureWritableFastElements() { | 3916 MaybeObject* JSObject::EnsureWritableFastElements() { |
| 3866 ASSERT(HasFastElements()); | 3917 ASSERT(HasFastElements()); |
| 3867 FixedArray* elems = FixedArray::cast(elements()); | 3918 FixedArray* elems = FixedArray::cast(elements()); |
| 3868 Isolate* isolate = GetIsolate(); | 3919 Isolate* isolate = GetIsolate(); |
| 3869 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; | 3920 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3999 } | 4050 } |
| 4000 return SlowAsArrayIndex(index); | 4051 return SlowAsArrayIndex(index); |
| 4001 } | 4052 } |
| 4002 | 4053 |
| 4003 | 4054 |
| 4004 Object* JSReceiver::GetPrototype() { | 4055 Object* JSReceiver::GetPrototype() { |
| 4005 return HeapObject::cast(this)->map()->prototype(); | 4056 return HeapObject::cast(this)->map()->prototype(); |
| 4006 } | 4057 } |
| 4007 | 4058 |
| 4008 | 4059 |
| 4060 bool JSReceiver::HasProperty(String* name) { |
| 4061 if (IsJSProxy()) { |
| 4062 return JSProxy::cast(this)->HasPropertyWithHandler(name); |
| 4063 } |
| 4064 return GetPropertyAttribute(name) != ABSENT; |
| 4065 } |
| 4066 |
| 4067 |
| 4068 bool JSReceiver::HasLocalProperty(String* name) { |
| 4069 if (IsJSProxy()) { |
| 4070 return JSProxy::cast(this)->HasPropertyWithHandler(name); |
| 4071 } |
| 4072 return GetLocalPropertyAttribute(name) != ABSENT; |
| 4073 } |
| 4074 |
| 4075 |
| 4009 PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { | 4076 PropertyAttributes JSReceiver::GetPropertyAttribute(String* key) { |
| 4010 return GetPropertyAttributeWithReceiver(this, key); | 4077 return GetPropertyAttributeWithReceiver(this, key); |
| 4011 } | 4078 } |
| 4012 | 4079 |
| 4013 // TODO(504): this may be useful in other places too where JSGlobalProxy | 4080 // TODO(504): this may be useful in other places too where JSGlobalProxy |
| 4014 // is used. | 4081 // is used. |
| 4015 Object* JSObject::BypassGlobalProxy() { | 4082 Object* JSObject::BypassGlobalProxy() { |
| 4016 if (IsJSGlobalProxy()) { | 4083 if (IsJSGlobalProxy()) { |
| 4017 Object* proto = GetPrototype(); | 4084 Object* proto = GetPrototype(); |
| 4018 if (proto->IsNull()) return GetHeap()->undefined_value(); | 4085 if (proto->IsNull()) return GetHeap()->undefined_value(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4047 | 4114 |
| 4048 MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) { | 4115 MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) { |
| 4049 ASSERT(!IsJSGlobalProxy()); | 4116 ASSERT(!IsJSGlobalProxy()); |
| 4050 return SetPropertyPostInterceptor(GetHeap()->hidden_symbol(), | 4117 return SetPropertyPostInterceptor(GetHeap()->hidden_symbol(), |
| 4051 hidden_obj, | 4118 hidden_obj, |
| 4052 DONT_ENUM, | 4119 DONT_ENUM, |
| 4053 kNonStrictMode); | 4120 kNonStrictMode); |
| 4054 } | 4121 } |
| 4055 | 4122 |
| 4056 | 4123 |
| 4124 bool JSObject::HasHiddenProperties() { |
| 4125 return !GetHiddenProperties(OMIT_CREATION)->ToObjectChecked()->IsUndefined(); |
| 4126 } |
| 4127 |
| 4128 |
| 4057 bool JSObject::HasElement(uint32_t index) { | 4129 bool JSObject::HasElement(uint32_t index) { |
| 4058 return HasElementWithReceiver(this, index); | 4130 return HasElementWithReceiver(this, index); |
| 4059 } | 4131 } |
| 4060 | 4132 |
| 4061 | 4133 |
| 4062 bool AccessorInfo::all_can_read() { | 4134 bool AccessorInfo::all_can_read() { |
| 4063 return BooleanBit::get(flag(), kAllCanReadBit); | 4135 return BooleanBit::get(flag(), kAllCanReadBit); |
| 4064 } | 4136 } |
| 4065 | 4137 |
| 4066 | 4138 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4162 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { | 4234 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { |
| 4163 return String::cast(other)->Hash(); | 4235 return String::cast(other)->Hash(); |
| 4164 } | 4236 } |
| 4165 | 4237 |
| 4166 | 4238 |
| 4167 MaybeObject* StringDictionaryShape::AsObject(String* key) { | 4239 MaybeObject* StringDictionaryShape::AsObject(String* key) { |
| 4168 return key; | 4240 return key; |
| 4169 } | 4241 } |
| 4170 | 4242 |
| 4171 | 4243 |
| 4244 bool ObjectHashTableShape::IsMatch(JSObject* key, Object* other) { |
| 4245 return key == JSObject::cast(other); |
| 4246 } |
| 4247 |
| 4248 |
| 4249 uint32_t ObjectHashTableShape::Hash(JSObject* key) { |
| 4250 MaybeObject* maybe_hash = key->GetIdentityHash(JSObject::OMIT_CREATION); |
| 4251 ASSERT(!maybe_hash->IsFailure()); |
| 4252 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); |
| 4253 } |
| 4254 |
| 4255 |
| 4256 uint32_t ObjectHashTableShape::HashForObject(JSObject* key, Object* other) { |
| 4257 MaybeObject* maybe_hash = JSObject::cast(other)->GetIdentityHash( |
| 4258 JSObject::OMIT_CREATION); |
| 4259 ASSERT(!maybe_hash->IsFailure()); |
| 4260 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); |
| 4261 } |
| 4262 |
| 4263 |
| 4264 MaybeObject* ObjectHashTableShape::AsObject(JSObject* key) { |
| 4265 return key; |
| 4266 } |
| 4267 |
| 4268 |
| 4172 void Map::ClearCodeCache(Heap* heap) { | 4269 void Map::ClearCodeCache(Heap* heap) { |
| 4173 // No write barrier is needed since empty_fixed_array is not in new space. | 4270 // No write barrier is needed since empty_fixed_array is not in new space. |
| 4174 // Please note this function is used during marking: | 4271 // Please note this function is used during marking: |
| 4175 // - MarkCompactCollector::MarkUnmarkedObject | 4272 // - MarkCompactCollector::MarkUnmarkedObject |
| 4176 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array())); | 4273 ASSERT(!heap->InNewSpace(heap->raw_unchecked_empty_fixed_array())); |
| 4177 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array()); | 4274 WRITE_FIELD(this, kCodeCacheOffset, heap->raw_unchecked_empty_fixed_array()); |
| 4178 } | 4275 } |
| 4179 | 4276 |
| 4180 | 4277 |
| 4181 void JSArray::EnsureSize(int required_size) { | 4278 void JSArray::EnsureSize(int required_size) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4312 #undef WRITE_INT_FIELD | 4409 #undef WRITE_INT_FIELD |
| 4313 #undef READ_SHORT_FIELD | 4410 #undef READ_SHORT_FIELD |
| 4314 #undef WRITE_SHORT_FIELD | 4411 #undef WRITE_SHORT_FIELD |
| 4315 #undef READ_BYTE_FIELD | 4412 #undef READ_BYTE_FIELD |
| 4316 #undef WRITE_BYTE_FIELD | 4413 #undef WRITE_BYTE_FIELD |
| 4317 | 4414 |
| 4318 | 4415 |
| 4319 } } // namespace v8::internal | 4416 } } // namespace v8::internal |
| 4320 | 4417 |
| 4321 #endif // V8_OBJECTS_INL_H_ | 4418 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |