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