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 8967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8978 return string; | 8978 return string; |
8979 } | 8979 } |
8980 | 8980 |
8981 | 8981 |
8982 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { | 8982 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { |
8983 // Currently, AllocationMemento objects are only allocated immediately | 8983 // Currently, AllocationMemento objects are only allocated immediately |
8984 // after JSArrays in NewSpace, and detecting whether a JSArray has one | 8984 // after JSArrays in NewSpace, and detecting whether a JSArray has one |
8985 // involves carefully checking the object immediately after the JSArray | 8985 // involves carefully checking the object immediately after the JSArray |
8986 // (if there is one) to see if it's an AllocationMemento. | 8986 // (if there is one) to see if it's an AllocationMemento. |
8987 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { | 8987 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { |
| 8988 // TODO(mvstanton): CHECK to diagnose chromium bug 284577, remove after. |
| 8989 CHECK(object->GetHeap()->InToSpace(object)); |
8988 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 8990 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
8989 object->Size(); | 8991 object->Size(); |
8990 if ((ptr_end + AllocationMemento::kSize) <= | 8992 if ((ptr_end + AllocationMemento::kSize) <= |
8991 object->GetHeap()->NewSpaceTop()) { | 8993 object->GetHeap()->NewSpaceTop()) { |
8992 // There is room in newspace for allocation info. Do we have some? | 8994 // There is room in newspace for allocation info. Do we have some? |
8993 Map** possible_allocation_memento_map = | 8995 Map** possible_allocation_memento_map = |
8994 reinterpret_cast<Map**>(ptr_end); | 8996 reinterpret_cast<Map**>(ptr_end); |
8995 if (*possible_allocation_memento_map == | 8997 if (*possible_allocation_memento_map == |
8996 object->GetHeap()->allocation_memento_map()) { | 8998 object->GetHeap()->allocation_memento_map()) { |
| 8999 Address ptr_object = reinterpret_cast<Address>(object); |
| 9000 // TODO(mvstanton): CHECK to diagnose chromium bug 284577, remove after. |
| 9001 // If this check fails it points to the very unlikely case that we've |
| 9002 // misinterpreted a page header as an allocation memento. Follow up |
| 9003 // with a real fix. |
| 9004 CHECK(Page::FromAddress(ptr_object) == Page::FromAddress(ptr_end)); |
8997 AllocationMemento* memento = AllocationMemento::cast( | 9005 AllocationMemento* memento = AllocationMemento::cast( |
8998 reinterpret_cast<Object*>(ptr_end + 1)); | 9006 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
8999 return memento; | 9007 return memento; |
9000 } | 9008 } |
9001 } | 9009 } |
9002 } | 9010 } |
9003 return NULL; | 9011 return NULL; |
9004 } | 9012 } |
9005 | 9013 |
9006 | 9014 |
9007 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9015 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
9008 // For array indexes mix the length into the hash as an array index could | 9016 // For array indexes mix the length into the hash as an array index could |
(...skipping 7044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16053 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16061 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16054 static const char* error_messages_[] = { | 16062 static const char* error_messages_[] = { |
16055 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16063 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16056 }; | 16064 }; |
16057 #undef ERROR_MESSAGES_TEXTS | 16065 #undef ERROR_MESSAGES_TEXTS |
16058 return error_messages_[reason]; | 16066 return error_messages_[reason]; |
16059 } | 16067 } |
16060 | 16068 |
16061 | 16069 |
16062 } } // namespace v8::internal | 16070 } } // namespace v8::internal |
OLD | NEW |