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 8994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9005 return string; | 9005 return string; |
9006 } | 9006 } |
9007 | 9007 |
9008 | 9008 |
9009 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { | 9009 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { |
9010 // Currently, AllocationMemento objects are only allocated immediately | 9010 // Currently, AllocationMemento objects are only allocated immediately |
9011 // after JSArrays in NewSpace, and detecting whether a JSArray has one | 9011 // after JSArrays in NewSpace, and detecting whether a JSArray has one |
9012 // involves carefully checking the object immediately after the JSArray | 9012 // involves carefully checking the object immediately after the JSArray |
9013 // (if there is one) to see if it's an AllocationMemento. | 9013 // (if there is one) to see if it's an AllocationMemento. |
9014 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { | 9014 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { |
9015 // TODO(mvstanton): CHECK to diagnose chromium bug 284577, remove after. | 9015 ASSERT(object->GetHeap()->InToSpace(object)); |
9016 CHECK(object->GetHeap()->InToSpace(object)); | |
9017 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 9016 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
9018 object->Size(); | 9017 object->Size(); |
9019 if ((ptr_end + AllocationMemento::kSize) <= | 9018 if ((ptr_end + AllocationMemento::kSize) <= |
9020 object->GetHeap()->NewSpaceTop()) { | 9019 object->GetHeap()->NewSpaceTop()) { |
9021 // There is room in newspace for allocation info. Do we have some? | 9020 // There is room in newspace for allocation info. Do we have some? |
9022 Map** possible_allocation_memento_map = | 9021 Map** possible_allocation_memento_map = |
9023 reinterpret_cast<Map**>(ptr_end); | 9022 reinterpret_cast<Map**>(ptr_end); |
9024 if (*possible_allocation_memento_map == | 9023 if (*possible_allocation_memento_map == |
9025 object->GetHeap()->allocation_memento_map()) { | 9024 object->GetHeap()->allocation_memento_map()) { |
9026 Address ptr_object = reinterpret_cast<Address>(object); | |
9027 // TODO(mvstanton): CHECK to diagnose chromium bug 284577, remove after. | |
9028 // If this check fails it points to the very unlikely case that we've | |
9029 // misinterpreted a page header as an allocation memento. Follow up | |
9030 // with a real fix. | |
9031 CHECK(Page::FromAddress(ptr_object) == Page::FromAddress(ptr_end)); | |
9032 AllocationMemento* memento = AllocationMemento::cast( | 9025 AllocationMemento* memento = AllocationMemento::cast( |
9033 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9026 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
9034 return memento; | 9027 |
| 9028 // TODO(mvstanton): because of chromium bug 284577, put extra care |
| 9029 // into validating that the memento points to a valid AllocationSite. |
| 9030 // This check is expensive so remove it asap. Also, this check |
| 9031 // HIDES bug 284577, so it must be disabled to debug/diagnose. |
| 9032 Object* site = memento->allocation_site(); |
| 9033 Heap* heap = object->GetHeap(); |
| 9034 if (heap->InOldPointerSpace(site) && |
| 9035 site->IsHeapObject() && |
| 9036 HeapObject::cast(site)->map() == heap->allocation_site_map()) { |
| 9037 return memento; |
| 9038 } |
9035 } | 9039 } |
9036 } | 9040 } |
9037 } | 9041 } |
9038 return NULL; | 9042 return NULL; |
9039 } | 9043 } |
9040 | 9044 |
9041 | 9045 |
9042 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9046 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
9043 // For array indexes mix the length into the hash as an array index could | 9047 // For array indexes mix the length into the hash as an array index could |
9044 // be zero. | 9048 // be zero. |
(...skipping 7100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16145 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16149 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16146 static const char* error_messages_[] = { | 16150 static const char* error_messages_[] = { |
16147 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16151 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16148 }; | 16152 }; |
16149 #undef ERROR_MESSAGES_TEXTS | 16153 #undef ERROR_MESSAGES_TEXTS |
16150 return error_messages_[reason]; | 16154 return error_messages_[reason]; |
16151 } | 16155 } |
16152 | 16156 |
16153 | 16157 |
16154 } } // namespace v8::internal | 16158 } } // namespace v8::internal |
OLD | NEW |