| OLD | NEW |
| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 bool Object::HasValidElements() { | 272 bool Object::HasValidElements() { |
| 273 // Dictionary is covered under FixedArray. | 273 // Dictionary is covered under FixedArray. |
| 274 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || | 274 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray() || |
| 275 IsFixedTypedArrayBase(); | 275 IsFixedTypedArrayBase(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 | 278 |
| 279 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, | 279 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, |
| 280 Representation representation) { | 280 Representation representation) { |
| 281 if (FLAG_track_fields && representation.IsSmi() && IsUninitialized()) { | 281 if (representation.IsSmi() && IsUninitialized()) { |
| 282 return Smi::FromInt(0); | 282 return Smi::FromInt(0); |
| 283 } | 283 } |
| 284 if (!FLAG_track_double_fields) return this; | |
| 285 if (!representation.IsDouble()) return this; | 284 if (!representation.IsDouble()) return this; |
| 286 if (IsUninitialized()) { | 285 if (IsUninitialized()) { |
| 287 return heap->AllocateHeapNumber(0); | 286 return heap->AllocateHeapNumber(0); |
| 288 } | 287 } |
| 289 return heap->AllocateHeapNumber(Number()); | 288 return heap->AllocateHeapNumber(Number()); |
| 290 } | 289 } |
| 291 | 290 |
| 292 | 291 |
| 293 StringShape::StringShape(String* str) | 292 StringShape::StringShape(String* str) |
| 294 : type_(str->map()->instance_type()) { | 293 : type_(str->map()->instance_type()) { |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 919 |
| 921 bool Object::IsPrimitive() { | 920 bool Object::IsPrimitive() { |
| 922 return IsOddball() || IsNumber() || IsString(); | 921 return IsOddball() || IsNumber() || IsString(); |
| 923 } | 922 } |
| 924 | 923 |
| 925 | 924 |
| 926 bool Object::IsJSGlobalProxy() { | 925 bool Object::IsJSGlobalProxy() { |
| 927 bool result = IsHeapObject() && | 926 bool result = IsHeapObject() && |
| 928 (HeapObject::cast(this)->map()->instance_type() == | 927 (HeapObject::cast(this)->map()->instance_type() == |
| 929 JS_GLOBAL_PROXY_TYPE); | 928 JS_GLOBAL_PROXY_TYPE); |
| 930 ASSERT(!result || IsAccessCheckNeeded()); | 929 ASSERT(!result || |
| 930 HeapObject::cast(this)->map()->is_access_check_needed()); |
| 931 return result; | 931 return result; |
| 932 } | 932 } |
| 933 | 933 |
| 934 | 934 |
| 935 bool Object::IsGlobalObject() { | 935 bool Object::IsGlobalObject() { |
| 936 if (!IsHeapObject()) return false; | 936 if (!IsHeapObject()) return false; |
| 937 | 937 |
| 938 InstanceType type = HeapObject::cast(this)->map()->instance_type(); | 938 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
| 939 return type == JS_GLOBAL_OBJECT_TYPE || | 939 return type == JS_GLOBAL_OBJECT_TYPE || |
| 940 type == JS_BUILTINS_OBJECT_TYPE; | 940 type == JS_BUILTINS_OBJECT_TYPE; |
| 941 } | 941 } |
| 942 | 942 |
| 943 | 943 |
| 944 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) | 944 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) |
| 945 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) | 945 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) |
| 946 | 946 |
| 947 | 947 |
| 948 bool Object::IsUndetectableObject() { | 948 bool Object::IsUndetectableObject() { |
| 949 return IsHeapObject() | 949 return IsHeapObject() |
| 950 && HeapObject::cast(this)->map()->is_undetectable(); | 950 && HeapObject::cast(this)->map()->is_undetectable(); |
| 951 } | 951 } |
| 952 | 952 |
| 953 | 953 |
| 954 bool Object::IsAccessCheckNeeded() { | 954 bool Object::IsAccessCheckNeeded() { |
| 955 return IsHeapObject() | 955 if (!IsHeapObject()) return false; |
| 956 && HeapObject::cast(this)->map()->is_access_check_needed(); | 956 if (IsJSGlobalProxy()) { |
| 957 JSGlobalProxy* proxy = JSGlobalProxy::cast(this); |
| 958 GlobalObject* global = |
| 959 proxy->GetIsolate()->context()->global_object(); |
| 960 return proxy->IsDetachedFrom(global); |
| 961 } |
| 962 return HeapObject::cast(this)->map()->is_access_check_needed(); |
| 957 } | 963 } |
| 958 | 964 |
| 959 | 965 |
| 960 bool Object::IsStruct() { | 966 bool Object::IsStruct() { |
| 961 if (!IsHeapObject()) return false; | 967 if (!IsHeapObject()) return false; |
| 962 switch (HeapObject::cast(this)->map()->instance_type()) { | 968 switch (HeapObject::cast(this)->map()->instance_type()) { |
| 963 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; | 969 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; |
| 964 STRUCT_LIST(MAKE_STRUCT_CASE) | 970 STRUCT_LIST(MAKE_STRUCT_CASE) |
| 965 #undef MAKE_STRUCT_CASE | 971 #undef MAKE_STRUCT_CASE |
| 966 default: return false; | 972 default: return false; |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 return TRACK_ALLOCATION_SITE; | 1474 return TRACK_ALLOCATION_SITE; |
| 1469 } | 1475 } |
| 1470 | 1476 |
| 1471 return DONT_TRACK_ALLOCATION_SITE; | 1477 return DONT_TRACK_ALLOCATION_SITE; |
| 1472 } | 1478 } |
| 1473 | 1479 |
| 1474 | 1480 |
| 1475 AllocationSiteMode AllocationSite::GetMode(ElementsKind from, | 1481 AllocationSiteMode AllocationSite::GetMode(ElementsKind from, |
| 1476 ElementsKind to) { | 1482 ElementsKind to) { |
| 1477 if (IsFastSmiElementsKind(from) && | 1483 if (IsFastSmiElementsKind(from) && |
| 1478 IsMoreGeneralElementsKindTransition(from, to)) { | 1484 IsMoreGeneralElementsKindTransition(from, to)) { |
| 1479 return TRACK_ALLOCATION_SITE; | 1485 return TRACK_ALLOCATION_SITE; |
| 1480 } | 1486 } |
| 1481 | 1487 |
| 1482 return DONT_TRACK_ALLOCATION_SITE; | 1488 return DONT_TRACK_ALLOCATION_SITE; |
| 1483 } | 1489 } |
| 1484 | 1490 |
| 1485 | 1491 |
| 1486 inline bool AllocationSite::CanTrack(InstanceType type) { | 1492 inline bool AllocationSite::CanTrack(InstanceType type) { |
| 1487 if (FLAG_allocation_site_pretenuring) { | 1493 if (FLAG_allocation_site_pretenuring) { |
| 1488 return type == JS_ARRAY_TYPE || | 1494 return type == JS_ARRAY_TYPE || |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 } | 1732 } |
| 1727 } | 1733 } |
| 1728 | 1734 |
| 1729 | 1735 |
| 1730 MaybeObject* JSObject::ResetElements() { | 1736 MaybeObject* JSObject::ResetElements() { |
| 1731 if (map()->is_observed()) { | 1737 if (map()->is_observed()) { |
| 1732 // Maintain invariant that observed elements are always in dictionary mode. | 1738 // Maintain invariant that observed elements are always in dictionary mode. |
| 1733 SeededNumberDictionary* dictionary; | 1739 SeededNumberDictionary* dictionary; |
| 1734 MaybeObject* maybe = SeededNumberDictionary::Allocate(GetHeap(), 0); | 1740 MaybeObject* maybe = SeededNumberDictionary::Allocate(GetHeap(), 0); |
| 1735 if (!maybe->To(&dictionary)) return maybe; | 1741 if (!maybe->To(&dictionary)) return maybe; |
| 1736 if (map() == GetHeap()->non_strict_arguments_elements_map()) { | 1742 if (map() == GetHeap()->sloppy_arguments_elements_map()) { |
| 1737 FixedArray::cast(elements())->set(1, dictionary); | 1743 FixedArray::cast(elements())->set(1, dictionary); |
| 1738 } else { | 1744 } else { |
| 1739 set_elements(dictionary); | 1745 set_elements(dictionary); |
| 1740 } | 1746 } |
| 1741 return this; | 1747 return this; |
| 1742 } | 1748 } |
| 1743 | 1749 |
| 1744 ElementsKind elements_kind = GetInitialFastElementsKind(); | 1750 ElementsKind elements_kind = GetInitialFastElementsKind(); |
| 1745 if (!FLAG_smi_only_arrays) { | 1751 if (!FLAG_smi_only_arrays) { |
| 1746 elements_kind = FastSmiToObjectElementsKind(elements_kind); | 1752 elements_kind = FastSmiToObjectElementsKind(elements_kind); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2069 JSValue* js_value = JSValue::cast(this); | 2075 JSValue* js_value = JSValue::cast(this); |
| 2070 if (!js_value->value()->IsString()) return false; | 2076 if (!js_value->value()->IsString()) return false; |
| 2071 | 2077 |
| 2072 String* str = String::cast(js_value->value()); | 2078 String* str = String::cast(js_value->value()); |
| 2073 if (index >= static_cast<uint32_t>(str->length())) return false; | 2079 if (index >= static_cast<uint32_t>(str->length())) return false; |
| 2074 | 2080 |
| 2075 return true; | 2081 return true; |
| 2076 } | 2082 } |
| 2077 | 2083 |
| 2078 | 2084 |
| 2079 | |
| 2080 void Object::VerifyApiCallResultType() { | 2085 void Object::VerifyApiCallResultType() { |
| 2081 #if ENABLE_EXTRA_CHECKS | 2086 #if ENABLE_EXTRA_CHECKS |
| 2082 if (!(IsSmi() || | 2087 if (!(IsSmi() || |
| 2083 IsString() || | 2088 IsString() || |
| 2084 IsSpecObject() || | 2089 IsSpecObject() || |
| 2085 IsHeapNumber() || | 2090 IsHeapNumber() || |
| 2086 IsUndefined() || | 2091 IsUndefined() || |
| 2087 IsTrue() || | 2092 IsTrue() || |
| 2088 IsFalse() || | 2093 IsFalse() || |
| 2089 IsNull())) { | 2094 IsNull())) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2186 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); | 2191 WRITE_DOUBLE_FIELD(this, offset, hole_nan_as_double()); |
| 2187 } | 2192 } |
| 2188 | 2193 |
| 2189 | 2194 |
| 2190 bool FixedDoubleArray::is_the_hole(int index) { | 2195 bool FixedDoubleArray::is_the_hole(int index) { |
| 2191 int offset = kHeaderSize + index * kDoubleSize; | 2196 int offset = kHeaderSize + index * kDoubleSize; |
| 2192 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); | 2197 return is_the_hole_nan(READ_DOUBLE_FIELD(this, offset)); |
| 2193 } | 2198 } |
| 2194 | 2199 |
| 2195 | 2200 |
| 2196 SMI_ACCESSORS(ConstantPoolArray, first_ptr_index, kFirstPointerIndexOffset) | 2201 SMI_ACCESSORS( |
| 2197 SMI_ACCESSORS(ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset) | 2202 ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset) |
| 2203 SMI_ACCESSORS( |
| 2204 ConstantPoolArray, first_heap_ptr_index, kFirstHeapPointerIndexOffset) |
| 2205 SMI_ACCESSORS( |
| 2206 ConstantPoolArray, first_int32_index, kFirstInt32IndexOffset) |
| 2198 | 2207 |
| 2199 | 2208 |
| 2200 int ConstantPoolArray::first_int64_index() { | 2209 int ConstantPoolArray::first_int64_index() { |
| 2201 return 0; | 2210 return 0; |
| 2202 } | 2211 } |
| 2203 | 2212 |
| 2204 | 2213 |
| 2205 int ConstantPoolArray::count_of_int64_entries() { | 2214 int ConstantPoolArray::count_of_int64_entries() { |
| 2206 return first_ptr_index(); | 2215 return first_code_ptr_index(); |
| 2207 } | 2216 } |
| 2208 | 2217 |
| 2209 | 2218 |
| 2210 int ConstantPoolArray::count_of_ptr_entries() { | 2219 int ConstantPoolArray::count_of_code_ptr_entries() { |
| 2211 return first_int32_index() - first_ptr_index(); | 2220 return first_heap_ptr_index() - first_code_ptr_index(); |
| 2212 } | 2221 } |
| 2213 | 2222 |
| 2214 | 2223 |
| 2224 int ConstantPoolArray::count_of_heap_ptr_entries() { |
| 2225 return first_int32_index() - first_heap_ptr_index(); |
| 2226 } |
| 2227 |
| 2228 |
| 2215 int ConstantPoolArray::count_of_int32_entries() { | 2229 int ConstantPoolArray::count_of_int32_entries() { |
| 2216 return length() - first_int32_index(); | 2230 return length() - first_int32_index(); |
| 2217 } | 2231 } |
| 2218 | 2232 |
| 2219 | 2233 |
| 2220 void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries, | 2234 void ConstantPoolArray::SetEntryCounts(int number_of_int64_entries, |
| 2221 int number_of_ptr_entries, | 2235 int number_of_code_ptr_entries, |
| 2236 int number_of_heap_ptr_entries, |
| 2222 int number_of_int32_entries) { | 2237 int number_of_int32_entries) { |
| 2223 set_first_ptr_index(number_of_int64_entries); | 2238 int current_index = number_of_int64_entries; |
| 2224 set_first_int32_index(number_of_int64_entries + number_of_ptr_entries); | 2239 set_first_code_ptr_index(current_index); |
| 2225 set_length(number_of_int64_entries + number_of_ptr_entries + | 2240 current_index += number_of_code_ptr_entries; |
| 2226 number_of_int32_entries); | 2241 set_first_heap_ptr_index(current_index); |
| 2242 current_index += number_of_heap_ptr_entries; |
| 2243 set_first_int32_index(current_index); |
| 2244 current_index += number_of_int32_entries; |
| 2245 set_length(current_index); |
| 2227 } | 2246 } |
| 2228 | 2247 |
| 2229 | 2248 |
| 2230 int64_t ConstantPoolArray::get_int64_entry(int index) { | 2249 int64_t ConstantPoolArray::get_int64_entry(int index) { |
| 2231 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2250 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2232 ASSERT(index >= 0 && index < first_ptr_index()); | 2251 ASSERT(index >= 0 && index < first_code_ptr_index()); |
| 2233 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); | 2252 return READ_INT64_FIELD(this, OffsetOfElementAt(index)); |
| 2234 } | 2253 } |
| 2235 | 2254 |
| 2236 double ConstantPoolArray::get_int64_entry_as_double(int index) { | 2255 double ConstantPoolArray::get_int64_entry_as_double(int index) { |
| 2237 STATIC_ASSERT(kDoubleSize == kInt64Size); | 2256 STATIC_ASSERT(kDoubleSize == kInt64Size); |
| 2238 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2257 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2239 ASSERT(index >= 0 && index < first_ptr_index()); | 2258 ASSERT(index >= 0 && index < first_code_ptr_index()); |
| 2240 return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index)); | 2259 return READ_DOUBLE_FIELD(this, OffsetOfElementAt(index)); |
| 2241 } | 2260 } |
| 2242 | 2261 |
| 2243 | 2262 |
| 2244 Object* ConstantPoolArray::get_ptr_entry(int index) { | 2263 Address ConstantPoolArray::get_code_ptr_entry(int index) { |
| 2245 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2264 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2246 ASSERT(index >= first_ptr_index() && index < first_int32_index()); | 2265 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); |
| 2266 return reinterpret_cast<Address>(READ_FIELD(this, OffsetOfElementAt(index))); |
| 2267 } |
| 2268 |
| 2269 |
| 2270 Object* ConstantPoolArray::get_heap_ptr_entry(int index) { |
| 2271 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2272 ASSERT(index >= first_heap_ptr_index() && index < first_int32_index()); |
| 2247 return READ_FIELD(this, OffsetOfElementAt(index)); | 2273 return READ_FIELD(this, OffsetOfElementAt(index)); |
| 2248 } | 2274 } |
| 2249 | 2275 |
| 2250 | 2276 |
| 2251 int32_t ConstantPoolArray::get_int32_entry(int index) { | 2277 int32_t ConstantPoolArray::get_int32_entry(int index) { |
| 2252 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2278 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2253 ASSERT(index >= first_int32_index() && index < length()); | 2279 ASSERT(index >= first_int32_index() && index < length()); |
| 2254 return READ_INT32_FIELD(this, OffsetOfElementAt(index)); | 2280 return READ_INT32_FIELD(this, OffsetOfElementAt(index)); |
| 2255 } | 2281 } |
| 2256 | 2282 |
| 2257 | 2283 |
| 2284 void ConstantPoolArray::set(int index, Address value) { |
| 2285 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2286 ASSERT(index >= first_code_ptr_index() && index < first_heap_ptr_index()); |
| 2287 WRITE_FIELD(this, OffsetOfElementAt(index), reinterpret_cast<Object*>(value)); |
| 2288 } |
| 2289 |
| 2290 |
| 2258 void ConstantPoolArray::set(int index, Object* value) { | 2291 void ConstantPoolArray::set(int index, Object* value) { |
| 2259 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2292 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2260 ASSERT(index >= first_ptr_index() && index < first_int32_index()); | 2293 ASSERT(index >= first_code_ptr_index() && index < first_int32_index()); |
| 2261 WRITE_FIELD(this, OffsetOfElementAt(index), value); | 2294 WRITE_FIELD(this, OffsetOfElementAt(index), value); |
| 2262 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value); | 2295 WRITE_BARRIER(GetHeap(), this, OffsetOfElementAt(index), value); |
| 2263 } | 2296 } |
| 2264 | 2297 |
| 2265 | 2298 |
| 2266 void ConstantPoolArray::set(int index, int64_t value) { | 2299 void ConstantPoolArray::set(int index, int64_t value) { |
| 2267 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2300 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2268 ASSERT(index >= first_int64_index() && index < first_ptr_index()); | 2301 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); |
| 2269 WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value); | 2302 WRITE_INT64_FIELD(this, OffsetOfElementAt(index), value); |
| 2270 } | 2303 } |
| 2271 | 2304 |
| 2272 | 2305 |
| 2273 void ConstantPoolArray::set(int index, double value) { | 2306 void ConstantPoolArray::set(int index, double value) { |
| 2274 STATIC_ASSERT(kDoubleSize == kInt64Size); | 2307 STATIC_ASSERT(kDoubleSize == kInt64Size); |
| 2275 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2308 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2276 ASSERT(index >= first_int64_index() && index < first_ptr_index()); | 2309 ASSERT(index >= first_int64_index() && index < first_code_ptr_index()); |
| 2277 WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value); | 2310 WRITE_DOUBLE_FIELD(this, OffsetOfElementAt(index), value); |
| 2278 } | 2311 } |
| 2279 | 2312 |
| 2280 | 2313 |
| 2281 void ConstantPoolArray::set(int index, int32_t value) { | 2314 void ConstantPoolArray::set(int index, int32_t value) { |
| 2282 ASSERT(map() == GetHeap()->constant_pool_array_map()); | 2315 ASSERT(map() == GetHeap()->constant_pool_array_map()); |
| 2283 ASSERT(index >= this->first_int32_index() && index < length()); | 2316 ASSERT(index >= this->first_int32_index() && index < length()); |
| 2284 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); | 2317 WRITE_INT32_FIELD(this, OffsetOfElementAt(index), value); |
| 2285 } | 2318 } |
| 2286 | 2319 |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3834 return SeqTwoByteString::SizeFor( | 3867 return SeqTwoByteString::SizeFor( |
| 3835 reinterpret_cast<SeqTwoByteString*>(this)->length()); | 3868 reinterpret_cast<SeqTwoByteString*>(this)->length()); |
| 3836 } | 3869 } |
| 3837 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { | 3870 if (instance_type == FIXED_DOUBLE_ARRAY_TYPE) { |
| 3838 return FixedDoubleArray::SizeFor( | 3871 return FixedDoubleArray::SizeFor( |
| 3839 reinterpret_cast<FixedDoubleArray*>(this)->length()); | 3872 reinterpret_cast<FixedDoubleArray*>(this)->length()); |
| 3840 } | 3873 } |
| 3841 if (instance_type == CONSTANT_POOL_ARRAY_TYPE) { | 3874 if (instance_type == CONSTANT_POOL_ARRAY_TYPE) { |
| 3842 return ConstantPoolArray::SizeFor( | 3875 return ConstantPoolArray::SizeFor( |
| 3843 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int64_entries(), | 3876 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int64_entries(), |
| 3844 reinterpret_cast<ConstantPoolArray*>(this)->count_of_ptr_entries(), | 3877 reinterpret_cast<ConstantPoolArray*>(this)->count_of_code_ptr_entries(), |
| 3878 reinterpret_cast<ConstantPoolArray*>(this)->count_of_heap_ptr_entries(), |
| 3845 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int32_entries()); | 3879 reinterpret_cast<ConstantPoolArray*>(this)->count_of_int32_entries()); |
| 3846 } | 3880 } |
| 3847 if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE && | 3881 if (instance_type >= FIRST_FIXED_TYPED_ARRAY_TYPE && |
| 3848 instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE) { | 3882 instance_type <= LAST_FIXED_TYPED_ARRAY_TYPE) { |
| 3849 return reinterpret_cast<FixedTypedArrayBase*>(this)->size(); | 3883 return reinterpret_cast<FixedTypedArrayBase*>(this)->size(); |
| 3850 } | 3884 } |
| 3851 ASSERT(instance_type == CODE_TYPE); | 3885 ASSERT(instance_type == CODE_TYPE); |
| 3852 return reinterpret_cast<Code*>(this)->CodeSize(); | 3886 return reinterpret_cast<Code*>(this)->CodeSize(); |
| 3853 } | 3887 } |
| 3854 | 3888 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3978 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; | 4012 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; |
| 3979 } | 4013 } |
| 3980 | 4014 |
| 3981 | 4015 |
| 3982 void Map::set_is_shared(bool value) { | 4016 void Map::set_is_shared(bool value) { |
| 3983 set_bit_field3(IsShared::update(bit_field3(), value)); | 4017 set_bit_field3(IsShared::update(bit_field3(), value)); |
| 3984 } | 4018 } |
| 3985 | 4019 |
| 3986 | 4020 |
| 3987 bool Map::is_shared() { | 4021 bool Map::is_shared() { |
| 3988 return IsShared::decode(bit_field3()); | 4022 return IsShared::decode(bit_field3()); } |
| 3989 } | |
| 3990 | 4023 |
| 3991 | 4024 |
| 3992 void Map::set_dictionary_map(bool value) { | 4025 void Map::set_dictionary_map(bool value) { |
| 3993 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); | 4026 uint32_t new_bit_field3 = DictionaryMap::update(bit_field3(), value); |
| 3994 new_bit_field3 = IsUnstable::update(new_bit_field3, value); | 4027 new_bit_field3 = IsUnstable::update(new_bit_field3, value); |
| 3995 set_bit_field3(new_bit_field3); | 4028 set_bit_field3(new_bit_field3); |
| 3996 } | 4029 } |
| 3997 | 4030 |
| 3998 | 4031 |
| 3999 bool Map::is_dictionary_map() { | 4032 bool Map::is_dictionary_map() { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4025 return HasInstanceCallHandler::decode(bit_field3()); | 4058 return HasInstanceCallHandler::decode(bit_field3()); |
| 4026 } | 4059 } |
| 4027 | 4060 |
| 4028 | 4061 |
| 4029 void Map::deprecate() { | 4062 void Map::deprecate() { |
| 4030 set_bit_field3(Deprecated::update(bit_field3(), true)); | 4063 set_bit_field3(Deprecated::update(bit_field3(), true)); |
| 4031 } | 4064 } |
| 4032 | 4065 |
| 4033 | 4066 |
| 4034 bool Map::is_deprecated() { | 4067 bool Map::is_deprecated() { |
| 4035 if (!FLAG_track_fields) return false; | |
| 4036 return Deprecated::decode(bit_field3()); | 4068 return Deprecated::decode(bit_field3()); |
| 4037 } | 4069 } |
| 4038 | 4070 |
| 4039 | 4071 |
| 4040 void Map::set_migration_target(bool value) { | 4072 void Map::set_migration_target(bool value) { |
| 4041 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); | 4073 set_bit_field3(IsMigrationTarget::update(bit_field3(), value)); |
| 4042 } | 4074 } |
| 4043 | 4075 |
| 4044 | 4076 |
| 4045 bool Map::is_migration_target() { | 4077 bool Map::is_migration_target() { |
| 4046 if (!FLAG_track_fields) return false; | |
| 4047 return IsMigrationTarget::decode(bit_field3()); | 4078 return IsMigrationTarget::decode(bit_field3()); |
| 4048 } | 4079 } |
| 4049 | 4080 |
| 4050 | 4081 |
| 4051 void Map::freeze() { | 4082 void Map::freeze() { |
| 4052 set_bit_field3(IsFrozen::update(bit_field3(), true)); | 4083 set_bit_field3(IsFrozen::update(bit_field3(), true)); |
| 4053 } | 4084 } |
| 4054 | 4085 |
| 4055 | 4086 |
| 4056 bool Map::is_frozen() { | 4087 bool Map::is_frozen() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4070 | 4101 |
| 4071 bool Map::has_code_cache() { | 4102 bool Map::has_code_cache() { |
| 4072 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); | 4103 return code_cache() != GetIsolate()->heap()->empty_fixed_array(); |
| 4073 } | 4104 } |
| 4074 | 4105 |
| 4075 | 4106 |
| 4076 bool Map::CanBeDeprecated() { | 4107 bool Map::CanBeDeprecated() { |
| 4077 int descriptor = LastAdded(); | 4108 int descriptor = LastAdded(); |
| 4078 for (int i = 0; i <= descriptor; i++) { | 4109 for (int i = 0; i <= descriptor; i++) { |
| 4079 PropertyDetails details = instance_descriptors()->GetDetails(i); | 4110 PropertyDetails details = instance_descriptors()->GetDetails(i); |
| 4080 if (FLAG_track_fields && details.representation().IsNone()) { | 4111 if (details.representation().IsNone()) return true; |
| 4081 return true; | 4112 if (details.representation().IsSmi()) return true; |
| 4082 } | 4113 if (details.representation().IsDouble()) return true; |
| 4083 if (FLAG_track_fields && details.representation().IsSmi()) { | 4114 if (details.representation().IsHeapObject()) return true; |
| 4084 return true; | 4115 if (details.type() == CONSTANT) return true; |
| 4085 } | |
| 4086 if (FLAG_track_double_fields && details.representation().IsDouble()) { | |
| 4087 return true; | |
| 4088 } | |
| 4089 if (FLAG_track_heap_object_fields && | |
| 4090 details.representation().IsHeapObject()) { | |
| 4091 return true; | |
| 4092 } | |
| 4093 if (FLAG_track_fields && details.type() == CONSTANT) { | |
| 4094 return true; | |
| 4095 } | |
| 4096 } | 4116 } |
| 4097 return false; | 4117 return false; |
| 4098 } | 4118 } |
| 4099 | 4119 |
| 4100 | 4120 |
| 4101 void Map::NotifyLeafMapLayoutChange() { | 4121 void Map::NotifyLeafMapLayoutChange() { |
| 4102 if (is_stable()) { | 4122 if (is_stable()) { |
| 4103 mark_unstable(); | 4123 mark_unstable(); |
| 4104 dependent_code()->DeoptimizeDependentCodeGroup( | 4124 dependent_code()->DeoptimizeDependentCodeGroup( |
| 4105 GetIsolate(), | 4125 GetIsolate(), |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4909 ACCESSORS(AllocationSite, dependent_code, DependentCode, | 4929 ACCESSORS(AllocationSite, dependent_code, DependentCode, |
| 4910 kDependentCodeOffset) | 4930 kDependentCodeOffset) |
| 4911 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) | 4931 ACCESSORS(AllocationSite, weak_next, Object, kWeakNextOffset) |
| 4912 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset) | 4932 ACCESSORS(AllocationMemento, allocation_site, Object, kAllocationSiteOffset) |
| 4913 | 4933 |
| 4914 ACCESSORS(Script, source, Object, kSourceOffset) | 4934 ACCESSORS(Script, source, Object, kSourceOffset) |
| 4915 ACCESSORS(Script, name, Object, kNameOffset) | 4935 ACCESSORS(Script, name, Object, kNameOffset) |
| 4916 ACCESSORS(Script, id, Smi, kIdOffset) | 4936 ACCESSORS(Script, id, Smi, kIdOffset) |
| 4917 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) | 4937 ACCESSORS_TO_SMI(Script, line_offset, kLineOffsetOffset) |
| 4918 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) | 4938 ACCESSORS_TO_SMI(Script, column_offset, kColumnOffsetOffset) |
| 4919 ACCESSORS(Script, data, Object, kDataOffset) | |
| 4920 ACCESSORS(Script, context_data, Object, kContextOffset) | 4939 ACCESSORS(Script, context_data, Object, kContextOffset) |
| 4921 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) | 4940 ACCESSORS(Script, wrapper, Foreign, kWrapperOffset) |
| 4922 ACCESSORS_TO_SMI(Script, type, kTypeOffset) | 4941 ACCESSORS_TO_SMI(Script, type, kTypeOffset) |
| 4923 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) | 4942 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) |
| 4924 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) | 4943 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) |
| 4925 ACCESSORS_TO_SMI(Script, eval_from_instructions_offset, | 4944 ACCESSORS_TO_SMI(Script, eval_from_instructions_offset, |
| 4926 kEvalFrominstructionsOffsetOffset) | 4945 kEvalFrominstructionsOffsetOffset) |
| 4927 ACCESSORS_TO_SMI(Script, flags, kFlagsOffset) | 4946 ACCESSORS_TO_SMI(Script, flags, kFlagsOffset) |
| 4928 BOOL_ACCESSORS(Script, flags, is_shared_cross_origin, kIsSharedCrossOriginBit) | 4947 BOOL_ACCESSORS(Script, flags, is_shared_cross_origin, kIsSharedCrossOriginBit) |
| 4929 | 4948 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4954 ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex) | 4973 ACCESSORS_TO_SMI(BreakPointInfo, code_position, kCodePositionIndex) |
| 4955 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) | 4974 ACCESSORS_TO_SMI(BreakPointInfo, source_position, kSourcePositionIndex) |
| 4956 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) | 4975 ACCESSORS_TO_SMI(BreakPointInfo, statement_position, kStatementPositionIndex) |
| 4957 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 4976 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
| 4958 #endif | 4977 #endif |
| 4959 | 4978 |
| 4960 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 4979 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
| 4961 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object, | 4980 ACCESSORS(SharedFunctionInfo, optimized_code_map, Object, |
| 4962 kOptimizedCodeMapOffset) | 4981 kOptimizedCodeMapOffset) |
| 4963 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 4982 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
| 4983 ACCESSORS(SharedFunctionInfo, feedback_vector, FixedArray, |
| 4984 kFeedbackVectorOffset) |
| 4964 ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset) | 4985 ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset) |
| 4965 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 4986 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
| 4966 kInstanceClassNameOffset) | 4987 kInstanceClassNameOffset) |
| 4967 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 4988 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
| 4968 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 4989 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
| 4969 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 4990 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
| 4970 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 4991 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) |
| 4971 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) | 4992 SMI_ACCESSORS(SharedFunctionInfo, ast_node_count, kAstNodeCountOffset) |
| 4972 | 4993 |
| 4973 | 4994 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5118 } | 5139 } |
| 5119 } | 5140 } |
| 5120 | 5141 |
| 5121 | 5142 |
| 5122 int SharedFunctionInfo::profiler_ticks() { | 5143 int SharedFunctionInfo::profiler_ticks() { |
| 5123 if (code()->kind() != Code::FUNCTION) return 0; | 5144 if (code()->kind() != Code::FUNCTION) return 0; |
| 5124 return code()->profiler_ticks(); | 5145 return code()->profiler_ticks(); |
| 5125 } | 5146 } |
| 5126 | 5147 |
| 5127 | 5148 |
| 5128 LanguageMode SharedFunctionInfo::language_mode() { | 5149 StrictMode SharedFunctionInfo::strict_mode() { |
| 5129 int hints = compiler_hints(); | 5150 return BooleanBit::get(compiler_hints(), kStrictModeFunction) |
| 5130 if (BooleanBit::get(hints, kExtendedModeFunction)) { | 5151 ? STRICT : SLOPPY; |
| 5131 ASSERT(BooleanBit::get(hints, kStrictModeFunction)); | |
| 5132 return EXTENDED_MODE; | |
| 5133 } | |
| 5134 return BooleanBit::get(hints, kStrictModeFunction) | |
| 5135 ? STRICT_MODE : CLASSIC_MODE; | |
| 5136 } | 5152 } |
| 5137 | 5153 |
| 5138 | 5154 |
| 5139 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) { | 5155 void SharedFunctionInfo::set_strict_mode(StrictMode strict_mode) { |
| 5140 // We only allow language mode transitions that go set the same language mode | 5156 // We only allow mode transitions from sloppy to strict. |
| 5141 // again or go up in the chain: | 5157 ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode); |
| 5142 // CLASSIC_MODE -> STRICT_MODE -> EXTENDED_MODE. | |
| 5143 ASSERT(this->language_mode() == CLASSIC_MODE || | |
| 5144 this->language_mode() == language_mode || | |
| 5145 language_mode == EXTENDED_MODE); | |
| 5146 int hints = compiler_hints(); | 5158 int hints = compiler_hints(); |
| 5147 hints = BooleanBit::set( | 5159 hints = BooleanBit::set(hints, kStrictModeFunction, strict_mode == STRICT); |
| 5148 hints, kStrictModeFunction, language_mode != CLASSIC_MODE); | |
| 5149 hints = BooleanBit::set( | |
| 5150 hints, kExtendedModeFunction, language_mode == EXTENDED_MODE); | |
| 5151 set_compiler_hints(hints); | 5160 set_compiler_hints(hints); |
| 5152 } | 5161 } |
| 5153 | 5162 |
| 5154 | 5163 |
| 5155 bool SharedFunctionInfo::is_classic_mode() { | |
| 5156 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); | |
| 5157 } | |
| 5158 | |
| 5159 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, | |
| 5160 kExtendedModeFunction) | |
| 5161 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 5164 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
| 5162 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, inline_builtin, | 5165 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, inline_builtin, |
| 5163 kInlineBuiltin) | 5166 kInlineBuiltin) |
| 5164 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5167 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
| 5165 name_should_print_as_anonymous, | 5168 name_should_print_as_anonymous, |
| 5166 kNameShouldPrintAsAnonymous) | 5169 kNameShouldPrintAsAnonymous) |
| 5167 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) | 5170 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) |
| 5168 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 5171 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
| 5169 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) | 5172 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) |
| 5170 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, | 5173 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5420 ASSERT(!GetHeap()->InNewSpace(value)); | 5423 ASSERT(!GetHeap()->InNewSpace(value)); |
| 5421 Address entry = value->entry(); | 5424 Address entry = value->entry(); |
| 5422 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); | 5425 WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry)); |
| 5423 } | 5426 } |
| 5424 | 5427 |
| 5425 | 5428 |
| 5426 void JSFunction::ReplaceCode(Code* code) { | 5429 void JSFunction::ReplaceCode(Code* code) { |
| 5427 bool was_optimized = IsOptimized(); | 5430 bool was_optimized = IsOptimized(); |
| 5428 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; | 5431 bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION; |
| 5429 | 5432 |
| 5433 if (was_optimized && is_optimized) { |
| 5434 shared()->EvictFromOptimizedCodeMap(this->code(), |
| 5435 "Replacing with another optimized code"); |
| 5436 } |
| 5437 |
| 5430 set_code(code); | 5438 set_code(code); |
| 5431 | 5439 |
| 5432 // Add/remove the function from the list of optimized functions for this | 5440 // Add/remove the function from the list of optimized functions for this |
| 5433 // context based on the state change. | 5441 // context based on the state change. |
| 5434 if (!was_optimized && is_optimized) { | 5442 if (!was_optimized && is_optimized) { |
| 5435 context()->native_context()->AddOptimizedFunction(this); | 5443 context()->native_context()->AddOptimizedFunction(this); |
| 5436 } | 5444 } |
| 5437 if (was_optimized && !is_optimized) { | 5445 if (was_optimized && !is_optimized) { |
| 5438 // TODO(titzer): linear in the number of optimized functions; fix! | 5446 // TODO(titzer): linear in the number of optimized functions; fix! |
| 5439 context()->native_context()->RemoveOptimizedFunction(this); | 5447 context()->native_context()->RemoveOptimizedFunction(this); |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5676 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 5684 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 5677 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 5685 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
| 5678 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 5686 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 5679 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) | 5687 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
| 5680 | 5688 |
| 5681 | 5689 |
| 5682 void Code::WipeOutHeader() { | 5690 void Code::WipeOutHeader() { |
| 5683 WRITE_FIELD(this, kRelocationInfoOffset, NULL); | 5691 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
| 5684 WRITE_FIELD(this, kHandlerTableOffset, NULL); | 5692 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
| 5685 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); | 5693 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
| 5694 WRITE_FIELD(this, kConstantPoolOffset, NULL); |
| 5686 // Do not wipe out e.g. a minor key. | 5695 // Do not wipe out e.g. a minor key. |
| 5687 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { | 5696 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
| 5688 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); | 5697 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); |
| 5689 } | 5698 } |
| 5690 } | 5699 } |
| 5691 | 5700 |
| 5692 | 5701 |
| 5693 Object* Code::type_feedback_info() { | 5702 Object* Code::type_feedback_info() { |
| 5694 ASSERT(kind() == FUNCTION); | 5703 ASSERT(kind() == FUNCTION); |
| 5695 return raw_type_feedback_info(); | 5704 return raw_type_feedback_info(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5897 ASSERT((IsFastSmiOrObjectElementsKind(kind) && | 5906 ASSERT((IsFastSmiOrObjectElementsKind(kind) && |
| 5898 (map == GetHeap()->fixed_array_map() || | 5907 (map == GetHeap()->fixed_array_map() || |
| 5899 map == GetHeap()->fixed_cow_array_map())) || | 5908 map == GetHeap()->fixed_cow_array_map())) || |
| 5900 (IsFastDoubleElementsKind(kind) && | 5909 (IsFastDoubleElementsKind(kind) && |
| 5901 (fixed_array->IsFixedDoubleArray() || | 5910 (fixed_array->IsFixedDoubleArray() || |
| 5902 fixed_array == GetHeap()->empty_fixed_array())) || | 5911 fixed_array == GetHeap()->empty_fixed_array())) || |
| 5903 (kind == DICTIONARY_ELEMENTS && | 5912 (kind == DICTIONARY_ELEMENTS && |
| 5904 fixed_array->IsFixedArray() && | 5913 fixed_array->IsFixedArray() && |
| 5905 fixed_array->IsDictionary()) || | 5914 fixed_array->IsDictionary()) || |
| 5906 (kind > DICTIONARY_ELEMENTS)); | 5915 (kind > DICTIONARY_ELEMENTS)); |
| 5907 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || | 5916 ASSERT((kind != SLOPPY_ARGUMENTS_ELEMENTS) || |
| 5908 (elements()->IsFixedArray() && elements()->length() >= 2)); | 5917 (elements()->IsFixedArray() && elements()->length() >= 2)); |
| 5909 } | 5918 } |
| 5910 #endif | 5919 #endif |
| 5911 return kind; | 5920 return kind; |
| 5912 } | 5921 } |
| 5913 | 5922 |
| 5914 | 5923 |
| 5915 ElementsAccessor* JSObject::GetElementsAccessor() { | 5924 ElementsAccessor* JSObject::GetElementsAccessor() { |
| 5916 return ElementsAccessor::ForKind(GetElementsKind()); | 5925 return ElementsAccessor::ForKind(GetElementsKind()); |
| 5917 } | 5926 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5945 bool JSObject::HasFastElements() { | 5954 bool JSObject::HasFastElements() { |
| 5946 return IsFastElementsKind(GetElementsKind()); | 5955 return IsFastElementsKind(GetElementsKind()); |
| 5947 } | 5956 } |
| 5948 | 5957 |
| 5949 | 5958 |
| 5950 bool JSObject::HasDictionaryElements() { | 5959 bool JSObject::HasDictionaryElements() { |
| 5951 return GetElementsKind() == DICTIONARY_ELEMENTS; | 5960 return GetElementsKind() == DICTIONARY_ELEMENTS; |
| 5952 } | 5961 } |
| 5953 | 5962 |
| 5954 | 5963 |
| 5955 bool JSObject::HasNonStrictArgumentsElements() { | 5964 bool JSObject::HasSloppyArgumentsElements() { |
| 5956 return GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 5965 return GetElementsKind() == SLOPPY_ARGUMENTS_ELEMENTS; |
| 5957 } | 5966 } |
| 5958 | 5967 |
| 5959 | 5968 |
| 5960 bool JSObject::HasExternalArrayElements() { | 5969 bool JSObject::HasExternalArrayElements() { |
| 5961 HeapObject* array = elements(); | 5970 HeapObject* array = elements(); |
| 5962 ASSERT(array != NULL); | 5971 ASSERT(array != NULL); |
| 5963 return array->IsExternalArray(); | 5972 return array->IsExternalArray(); |
| 5964 } | 5973 } |
| 5965 | 5974 |
| 5966 | 5975 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6161 return map()->constructor(); | 6170 return map()->constructor(); |
| 6162 } | 6171 } |
| 6163 | 6172 |
| 6164 | 6173 |
| 6165 bool JSReceiver::HasProperty(Handle<JSReceiver> object, | 6174 bool JSReceiver::HasProperty(Handle<JSReceiver> object, |
| 6166 Handle<Name> name) { | 6175 Handle<Name> name) { |
| 6167 if (object->IsJSProxy()) { | 6176 if (object->IsJSProxy()) { |
| 6168 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6177 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 6169 return JSProxy::HasPropertyWithHandler(proxy, name); | 6178 return JSProxy::HasPropertyWithHandler(proxy, name); |
| 6170 } | 6179 } |
| 6171 return object->GetPropertyAttribute(*name) != ABSENT; | 6180 return GetPropertyAttribute(object, name) != ABSENT; |
| 6172 } | 6181 } |
| 6173 | 6182 |
| 6174 | 6183 |
| 6175 bool JSReceiver::HasLocalProperty(Handle<JSReceiver> object, | 6184 bool JSReceiver::HasLocalProperty(Handle<JSReceiver> object, |
| 6176 Handle<Name> name) { | 6185 Handle<Name> name) { |
| 6177 if (object->IsJSProxy()) { | 6186 if (object->IsJSProxy()) { |
| 6178 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6187 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 6179 return JSProxy::HasPropertyWithHandler(proxy, name); | 6188 return JSProxy::HasPropertyWithHandler(proxy, name); |
| 6180 } | 6189 } |
| 6181 return object->GetLocalPropertyAttribute(*name) != ABSENT; | 6190 return GetLocalPropertyAttribute(object, name) != ABSENT; |
| 6182 } | 6191 } |
| 6183 | 6192 |
| 6184 | 6193 |
| 6185 PropertyAttributes JSReceiver::GetPropertyAttribute(Name* key) { | 6194 PropertyAttributes JSReceiver::GetPropertyAttribute(Handle<JSReceiver> object, |
| 6195 Handle<Name> key) { |
| 6186 uint32_t index; | 6196 uint32_t index; |
| 6187 if (IsJSObject() && key->AsArrayIndex(&index)) { | 6197 if (object->IsJSObject() && key->AsArrayIndex(&index)) { |
| 6188 return GetElementAttribute(index); | 6198 return GetElementAttribute(object, index); |
| 6189 } | 6199 } |
| 6190 return GetPropertyAttributeWithReceiver(this, key); | 6200 return GetPropertyAttributeWithReceiver(object, object, key); |
| 6191 } | 6201 } |
| 6192 | 6202 |
| 6193 | 6203 |
| 6194 PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) { | 6204 PropertyAttributes JSReceiver::GetElementAttribute(Handle<JSReceiver> object, |
| 6195 if (IsJSProxy()) { | 6205 uint32_t index) { |
| 6196 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); | 6206 if (object->IsJSProxy()) { |
| 6207 return JSProxy::GetElementAttributeWithHandler( |
| 6208 Handle<JSProxy>::cast(object), object, index); |
| 6197 } | 6209 } |
| 6198 return JSObject::cast(this)->GetElementAttributeWithReceiver( | 6210 return JSObject::GetElementAttributeWithReceiver( |
| 6199 this, index, true); | 6211 Handle<JSObject>::cast(object), object, index, true); |
| 6200 } | 6212 } |
| 6201 | 6213 |
| 6202 | 6214 |
| 6203 bool JSGlobalObject::IsDetached() { | 6215 bool JSGlobalObject::IsDetached() { |
| 6204 return JSGlobalProxy::cast(global_receiver())->IsDetachedFrom(this); | 6216 return JSGlobalProxy::cast(global_receiver())->IsDetachedFrom(this); |
| 6205 } | 6217 } |
| 6206 | 6218 |
| 6207 | 6219 |
| 6208 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) { | 6220 bool JSGlobalProxy::IsDetachedFrom(GlobalObject* global) { |
| 6209 return GetPrototype() != global; | 6221 return GetPrototype() != global; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6222 ? JSProxy::cast(this)->GetIdentityHash() | 6234 ? JSProxy::cast(this)->GetIdentityHash() |
| 6223 : JSObject::cast(this)->GetIdentityHash(); | 6235 : JSObject::cast(this)->GetIdentityHash(); |
| 6224 } | 6236 } |
| 6225 | 6237 |
| 6226 | 6238 |
| 6227 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 6239 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
| 6228 if (object->IsJSProxy()) { | 6240 if (object->IsJSProxy()) { |
| 6229 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6241 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 6230 return JSProxy::HasElementWithHandler(proxy, index); | 6242 return JSProxy::HasElementWithHandler(proxy, index); |
| 6231 } | 6243 } |
| 6232 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( | 6244 return JSObject::GetElementAttributeWithReceiver( |
| 6233 *object, index, true) != ABSENT; | 6245 Handle<JSObject>::cast(object), object, index, true) != ABSENT; |
| 6234 } | 6246 } |
| 6235 | 6247 |
| 6236 | 6248 |
| 6237 bool JSReceiver::HasLocalElement(Handle<JSReceiver> object, uint32_t index) { | 6249 bool JSReceiver::HasLocalElement(Handle<JSReceiver> object, uint32_t index) { |
| 6238 if (object->IsJSProxy()) { | 6250 if (object->IsJSProxy()) { |
| 6239 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 6251 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 6240 return JSProxy::HasElementWithHandler(proxy, index); | 6252 return JSProxy::HasElementWithHandler(proxy, index); |
| 6241 } | 6253 } |
| 6242 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( | 6254 return JSObject::GetElementAttributeWithReceiver( |
| 6243 *object, index, false) != ABSENT; | 6255 Handle<JSObject>::cast(object), object, index, false) != ABSENT; |
| 6244 } | 6256 } |
| 6245 | 6257 |
| 6246 | 6258 |
| 6247 PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) { | 6259 PropertyAttributes JSReceiver::GetLocalElementAttribute( |
| 6248 if (IsJSProxy()) { | 6260 Handle<JSReceiver> object, uint32_t index) { |
| 6249 return JSProxy::cast(this)->GetElementAttributeWithHandler(this, index); | 6261 if (object->IsJSProxy()) { |
| 6262 return JSProxy::GetElementAttributeWithHandler( |
| 6263 Handle<JSProxy>::cast(object), object, index); |
| 6250 } | 6264 } |
| 6251 return JSObject::cast(this)->GetElementAttributeWithReceiver( | 6265 return JSObject::GetElementAttributeWithReceiver( |
| 6252 this, index, false); | 6266 Handle<JSObject>::cast(object), object, index, false); |
| 6253 } | 6267 } |
| 6254 | 6268 |
| 6255 | 6269 |
| 6256 bool AccessorInfo::all_can_read() { | 6270 bool AccessorInfo::all_can_read() { |
| 6257 return BooleanBit::get(flag(), kAllCanReadBit); | 6271 return BooleanBit::get(flag(), kAllCanReadBit); |
| 6258 } | 6272 } |
| 6259 | 6273 |
| 6260 | 6274 |
| 6261 void AccessorInfo::set_all_can_read(bool value) { | 6275 void AccessorInfo::set_all_can_read(bool value) { |
| 6262 set_flag(BooleanBit::set(flag(), kAllCanReadBit, value)); | 6276 set_flag(BooleanBit::set(flag(), kAllCanReadBit, value)); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6535 } | 6549 } |
| 6536 | 6550 |
| 6537 | 6551 |
| 6538 MaybeObject* ConstantPoolArray::Copy() { | 6552 MaybeObject* ConstantPoolArray::Copy() { |
| 6539 if (length() == 0) return this; | 6553 if (length() == 0) return this; |
| 6540 return GetHeap()->CopyConstantPoolArray(this); | 6554 return GetHeap()->CopyConstantPoolArray(this); |
| 6541 } | 6555 } |
| 6542 | 6556 |
| 6543 | 6557 |
| 6544 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { | 6558 Handle<Object> TypeFeedbackInfo::UninitializedSentinel(Isolate* isolate) { |
| 6545 return isolate->factory()->the_hole_value(); | 6559 return isolate->factory()->uninitialized_symbol(); |
| 6546 } | 6560 } |
| 6547 | 6561 |
| 6548 | 6562 |
| 6549 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { | 6563 Handle<Object> TypeFeedbackInfo::MegamorphicSentinel(Isolate* isolate) { |
| 6550 return isolate->factory()->undefined_value(); | 6564 return isolate->factory()->megamorphic_symbol(); |
| 6551 } | 6565 } |
| 6552 | 6566 |
| 6553 | 6567 |
| 6554 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate, | 6568 Handle<Object> TypeFeedbackInfo::MonomorphicArraySentinel(Isolate* isolate, |
| 6555 ElementsKind elements_kind) { | 6569 ElementsKind elements_kind) { |
| 6556 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); | 6570 return Handle<Object>(Smi::FromInt(static_cast<int>(elements_kind)), isolate); |
| 6557 } | 6571 } |
| 6558 | 6572 |
| 6559 | 6573 |
| 6560 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { | 6574 Object* TypeFeedbackInfo::RawUninitializedSentinel(Heap* heap) { |
| 6561 return heap->the_hole_value(); | 6575 return heap->uninitialized_symbol(); |
| 6562 } | 6576 } |
| 6563 | 6577 |
| 6564 | 6578 |
| 6565 int TypeFeedbackInfo::ic_total_count() { | 6579 int TypeFeedbackInfo::ic_total_count() { |
| 6566 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); | 6580 int current = Smi::cast(READ_FIELD(this, kStorage1Offset))->value(); |
| 6567 return ICTotalCountField::decode(current); | 6581 return ICTotalCountField::decode(current); |
| 6568 } | 6582 } |
| 6569 | 6583 |
| 6570 | 6584 |
| 6571 void TypeFeedbackInfo::set_ic_total_count(int count) { | 6585 void TypeFeedbackInfo::set_ic_total_count(int count) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6633 } | 6647 } |
| 6634 | 6648 |
| 6635 | 6649 |
| 6636 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { | 6650 bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) { |
| 6637 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); | 6651 int value = Smi::cast(READ_FIELD(this, kStorage2Offset))->value(); |
| 6638 int mask = (1 << kTypeChangeChecksumBits) - 1; | 6652 int mask = (1 << kTypeChangeChecksumBits) - 1; |
| 6639 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); | 6653 return InlinedTypeChangeChecksum::decode(value) == (checksum & mask); |
| 6640 } | 6654 } |
| 6641 | 6655 |
| 6642 | 6656 |
| 6643 ACCESSORS(TypeFeedbackInfo, feedback_vector, FixedArray, | |
| 6644 kFeedbackVectorOffset) | |
| 6645 | |
| 6646 | |
| 6647 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) | 6657 SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot) |
| 6648 | 6658 |
| 6649 | 6659 |
| 6650 Relocatable::Relocatable(Isolate* isolate) { | 6660 Relocatable::Relocatable(Isolate* isolate) { |
| 6651 isolate_ = isolate; | 6661 isolate_ = isolate; |
| 6652 prev_ = isolate->relocatable_top(); | 6662 prev_ = isolate->relocatable_top(); |
| 6653 isolate->set_relocatable_top(this); | 6663 isolate->set_relocatable_top(this); |
| 6654 } | 6664 } |
| 6655 | 6665 |
| 6656 | 6666 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6748 #undef READ_UINT32_FIELD | 6758 #undef READ_UINT32_FIELD |
| 6749 #undef WRITE_UINT32_FIELD | 6759 #undef WRITE_UINT32_FIELD |
| 6750 #undef READ_SHORT_FIELD | 6760 #undef READ_SHORT_FIELD |
| 6751 #undef WRITE_SHORT_FIELD | 6761 #undef WRITE_SHORT_FIELD |
| 6752 #undef READ_BYTE_FIELD | 6762 #undef READ_BYTE_FIELD |
| 6753 #undef WRITE_BYTE_FIELD | 6763 #undef WRITE_BYTE_FIELD |
| 6754 | 6764 |
| 6755 } } // namespace v8::internal | 6765 } } // namespace v8::internal |
| 6756 | 6766 |
| 6757 #endif // V8_OBJECTS_INL_H_ | 6767 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |