OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 9943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9954 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 9954 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
9955 rinfo->IsPatchedReturnSequence()) || | 9955 rinfo->IsPatchedReturnSequence()) || |
9956 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 9956 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
9957 rinfo->IsPatchedDebugBreakSlotSequence())); | 9957 rinfo->IsPatchedDebugBreakSlotSequence())); |
9958 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | 9958 Object* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); |
9959 Object* old_target = target; | 9959 Object* old_target = target; |
9960 VisitPointer(&target); | 9960 VisitPointer(&target); |
9961 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. | 9961 CHECK_EQ(target, old_target); // VisitPointer doesn't change Code* *target. |
9962 } | 9962 } |
9963 | 9963 |
| 9964 |
9964 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { | 9965 void ObjectVisitor::VisitEmbeddedPointer(RelocInfo* rinfo) { |
9965 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); | 9966 ASSERT(rinfo->rmode() == RelocInfo::EMBEDDED_OBJECT); |
9966 VisitPointer(rinfo->target_object_address()); | 9967 VisitPointer(rinfo->target_object_address()); |
9967 } | 9968 } |
9968 | 9969 |
| 9970 |
9969 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { | 9971 void ObjectVisitor::VisitExternalReference(RelocInfo* rinfo) { |
9970 Address* p = rinfo->target_reference_address(); | 9972 Address* p = rinfo->target_reference_address(); |
9971 VisitExternalReferences(p, p + 1); | 9973 VisitExternalReferences(p, p + 1); |
9972 } | 9974 } |
9973 | 9975 |
| 9976 |
9974 byte Code::compare_nil_state() { | 9977 byte Code::compare_nil_state() { |
9975 ASSERT(is_compare_nil_ic_stub()); | 9978 ASSERT(is_compare_nil_ic_stub()); |
9976 return CompareNilICStub::ExtractTypesFromExtraICState( | 9979 return CompareNilICStub::ExtractTypesFromExtraICState( |
9977 extended_extra_ic_state()); | 9980 extended_extra_ic_state()); |
9978 } | 9981 } |
9979 | 9982 |
| 9983 |
9980 byte Code::compare_nil_value() { | 9984 byte Code::compare_nil_value() { |
9981 ASSERT(is_compare_nil_ic_stub()); | 9985 ASSERT(is_compare_nil_ic_stub()); |
9982 return CompareNilICStub::ExtractNilValueFromExtraICState( | 9986 return CompareNilICStub::ExtractNilValueFromExtraICState( |
9983 extended_extra_ic_state()); | 9987 extended_extra_ic_state()); |
9984 } | 9988 } |
9985 | 9989 |
9986 | 9990 |
9987 void Code::InvalidateRelocation() { | 9991 void Code::InvalidateRelocation() { |
9988 set_relocation_info(GetHeap()->empty_byte_array()); | 9992 set_relocation_info(GetHeap()->empty_byte_array()); |
9989 } | 9993 } |
(...skipping 3302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13292 } | 13296 } |
13293 | 13297 |
13294 static uint32_t RegExpHash(String* string, Smi* flags) { | 13298 static uint32_t RegExpHash(String* string, Smi* flags) { |
13295 return string->Hash() + flags->value(); | 13299 return string->Hash() + flags->value(); |
13296 } | 13300 } |
13297 | 13301 |
13298 String* string_; | 13302 String* string_; |
13299 Smi* flags_; | 13303 Smi* flags_; |
13300 }; | 13304 }; |
13301 | 13305 |
| 13306 |
13302 // Utf8StringKey carries a vector of chars as key. | 13307 // Utf8StringKey carries a vector of chars as key. |
13303 class Utf8StringKey : public HashTableKey { | 13308 class Utf8StringKey : public HashTableKey { |
13304 public: | 13309 public: |
13305 explicit Utf8StringKey(Vector<const char> string, uint32_t seed) | 13310 explicit Utf8StringKey(Vector<const char> string, uint32_t seed) |
13306 : string_(string), hash_field_(0), seed_(seed) { } | 13311 : string_(string), hash_field_(0), seed_(seed) { } |
13307 | 13312 |
13308 bool IsMatch(Object* string) { | 13313 bool IsMatch(Object* string) { |
13309 return String::cast(string)->IsUtf8EqualTo(string_); | 13314 return String::cast(string)->IsUtf8EqualTo(string_); |
13310 } | 13315 } |
13311 | 13316 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13658 uint32_t count = 1; | 13663 uint32_t count = 1; |
13659 // EnsureCapacity will guarantee the hash table is never full. | 13664 // EnsureCapacity will guarantee the hash table is never full. |
13660 while (true) { | 13665 while (true) { |
13661 Object* element = KeyAt(entry); | 13666 Object* element = KeyAt(entry); |
13662 if (element->IsUndefined() || element->IsTheHole()) break; | 13667 if (element->IsUndefined() || element->IsTheHole()) break; |
13663 entry = NextProbe(entry, count++, capacity); | 13668 entry = NextProbe(entry, count++, capacity); |
13664 } | 13669 } |
13665 return entry; | 13670 return entry; |
13666 } | 13671 } |
13667 | 13672 |
| 13673 |
13668 // Force instantiation of template instances class. | 13674 // Force instantiation of template instances class. |
13669 // Please note this list is compiler dependent. | 13675 // Please note this list is compiler dependent. |
13670 | 13676 |
13671 template class HashTable<StringTableShape, HashTableKey*>; | 13677 template class HashTable<StringTableShape, HashTableKey*>; |
13672 | 13678 |
13673 template class HashTable<CompilationCacheShape, HashTableKey*>; | 13679 template class HashTable<CompilationCacheShape, HashTableKey*>; |
13674 | 13680 |
13675 template class HashTable<MapCacheShape, HashTableKey*>; | 13681 template class HashTable<MapCacheShape, HashTableKey*>; |
13676 | 13682 |
13677 template class HashTable<ObjectHashTableShape<1>, Object*>; | 13683 template class HashTable<ObjectHashTableShape<1>, Object*>; |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14020 } | 14026 } |
14021 | 14027 |
14022 if (result <= static_cast<uint32_t>(Smi::kMaxValue)) { | 14028 if (result <= static_cast<uint32_t>(Smi::kMaxValue)) { |
14023 return Smi::FromInt(static_cast<int>(result)); | 14029 return Smi::FromInt(static_cast<int>(result)); |
14024 } | 14030 } |
14025 ASSERT_NE(NULL, result_double); | 14031 ASSERT_NE(NULL, result_double); |
14026 result_double->set_value(static_cast<double>(result)); | 14032 result_double->set_value(static_cast<double>(result)); |
14027 return result_double; | 14033 return result_double; |
14028 } | 14034 } |
14029 | 14035 |
| 14036 |
14030 ExternalArrayType JSTypedArray::type() { | 14037 ExternalArrayType JSTypedArray::type() { |
14031 switch (elements()->map()->instance_type()) { | 14038 switch (elements()->map()->instance_type()) { |
14032 case EXTERNAL_BYTE_ARRAY_TYPE: | 14039 case EXTERNAL_BYTE_ARRAY_TYPE: |
14033 return kExternalByteArray; | 14040 return kExternalByteArray; |
14034 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 14041 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
14035 return kExternalUnsignedByteArray; | 14042 return kExternalUnsignedByteArray; |
14036 case EXTERNAL_SHORT_ARRAY_TYPE: | 14043 case EXTERNAL_SHORT_ARRAY_TYPE: |
14037 return kExternalShortArray; | 14044 return kExternalShortArray; |
14038 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 14045 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
14039 return kExternalUnsignedShortArray; | 14046 return kExternalUnsignedShortArray; |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14399 return LookupKey(&key, s); | 14406 return LookupKey(&key, s); |
14400 } | 14407 } |
14401 | 14408 |
14402 | 14409 |
14403 MaybeObject* StringTable::LookupTwoByteString(Vector<const uc16> str, | 14410 MaybeObject* StringTable::LookupTwoByteString(Vector<const uc16> str, |
14404 Object** s) { | 14411 Object** s) { |
14405 TwoByteStringKey key(str, GetHeap()->HashSeed()); | 14412 TwoByteStringKey key(str, GetHeap()->HashSeed()); |
14406 return LookupKey(&key, s); | 14413 return LookupKey(&key, s); |
14407 } | 14414 } |
14408 | 14415 |
| 14416 |
14409 MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) { | 14417 MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) { |
14410 int entry = FindEntry(key); | 14418 int entry = FindEntry(key); |
14411 | 14419 |
14412 // String already in table. | 14420 // String already in table. |
14413 if (entry != kNotFound) { | 14421 if (entry != kNotFound) { |
14414 *s = KeyAt(entry); | 14422 *s = KeyAt(entry); |
14415 return this; | 14423 return this; |
14416 } | 14424 } |
14417 | 14425 |
14418 // Adding new string. Grow table if needed. | 14426 // Adding new string. Grow table if needed. |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15819 | 15827 |
15820 void PropertyCell::AddDependentCode(Handle<Code> code) { | 15828 void PropertyCell::AddDependentCode(Handle<Code> code) { |
15821 Handle<DependentCode> codes = DependentCode::Insert( | 15829 Handle<DependentCode> codes = DependentCode::Insert( |
15822 Handle<DependentCode>(dependent_code()), | 15830 Handle<DependentCode>(dependent_code()), |
15823 DependentCode::kPropertyCellChangedGroup, code); | 15831 DependentCode::kPropertyCellChangedGroup, code); |
15824 if (*codes != dependent_code()) set_dependent_code(*codes); | 15832 if (*codes != dependent_code()) set_dependent_code(*codes); |
15825 } | 15833 } |
15826 | 15834 |
15827 | 15835 |
15828 } } // namespace v8::internal | 15836 } } // namespace v8::internal |
OLD | NEW |