| 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 9173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9184 } | 9184 } |
| 9185 | 9185 |
| 9186 | 9186 |
| 9187 AllocationMemento* AllocationMemento::FindForHeapObject(HeapObject* object, | 9187 AllocationMemento* AllocationMemento::FindForHeapObject(HeapObject* object, |
| 9188 bool in_GC) { | 9188 bool in_GC) { |
| 9189 // AllocationMemento objects are only allocated immediately after objects in | 9189 // AllocationMemento objects are only allocated immediately after objects in |
| 9190 // NewSpace. Detecting whether a memento is present involves carefully | 9190 // NewSpace. Detecting whether a memento is present involves carefully |
| 9191 // checking the object immediately after the current object (if there is one) | 9191 // checking the object immediately after the current object (if there is one) |
| 9192 // to see if it's an AllocationMemento. | 9192 // to see if it's an AllocationMemento. |
| 9193 ASSERT(object->GetHeap()->InNewSpace(object)); | 9193 ASSERT(object->GetHeap()->InNewSpace(object)); |
| 9194 if (FLAG_track_allocation_sites) { | 9194 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
| 9195 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 9195 object->Size(); |
| 9196 object->Size(); | 9196 Address top; |
| 9197 Address top; | 9197 if (in_GC) { |
| 9198 if (in_GC) { | 9198 top = object->GetHeap()->new_space()->FromSpacePageHigh(); |
| 9199 top = object->GetHeap()->new_space()->FromSpacePageHigh(); | 9199 } else { |
| 9200 } else { | 9200 top = object->GetHeap()->NewSpaceTop(); |
| 9201 top = object->GetHeap()->NewSpaceTop(); | 9201 } |
| 9202 } | 9202 if ((ptr_end + AllocationMemento::kSize) <= top) { |
| 9203 if ((ptr_end + AllocationMemento::kSize) <= top) { | 9203 // There is room in newspace for allocation info. Do we have some? |
| 9204 // There is room in newspace for allocation info. Do we have some? | 9204 Map** possible_allocation_memento_map = |
| 9205 Map** possible_allocation_memento_map = | 9205 reinterpret_cast<Map**>(ptr_end); |
| 9206 reinterpret_cast<Map**>(ptr_end); | 9206 if (*possible_allocation_memento_map == |
| 9207 if (*possible_allocation_memento_map == | 9207 object->GetHeap()->allocation_memento_map()) { |
| 9208 object->GetHeap()->allocation_memento_map()) { | 9208 AllocationMemento* memento = AllocationMemento::cast( |
| 9209 AllocationMemento* memento = AllocationMemento::cast( | 9209 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
| 9210 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9210 if (memento->IsValid()) { |
| 9211 if (memento->IsValid()) { | 9211 return memento; |
| 9212 return memento; | |
| 9213 } | |
| 9214 } | 9212 } |
| 9215 } | 9213 } |
| 9216 } | 9214 } |
| 9217 return NULL; | 9215 return NULL; |
| 9218 } | 9216 } |
| 9219 | 9217 |
| 9220 | 9218 |
| 9221 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9219 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
| 9222 // For array indexes mix the length into the hash as an array index could | 9220 // For array indexes mix the length into the hash as an array index could |
| 9223 // be zero. | 9221 // be zero. |
| (...skipping 3630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12854 | 12852 |
| 12855 | 12853 |
| 12856 void JSObject::UpdateAllocationSite(Handle<JSObject> object, | 12854 void JSObject::UpdateAllocationSite(Handle<JSObject> object, |
| 12857 ElementsKind to_kind) { | 12855 ElementsKind to_kind) { |
| 12858 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12856 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12859 object->UpdateAllocationSite(to_kind)); | 12857 object->UpdateAllocationSite(to_kind)); |
| 12860 } | 12858 } |
| 12861 | 12859 |
| 12862 | 12860 |
| 12863 MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { | 12861 MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { |
| 12864 if (!FLAG_track_allocation_sites || !IsJSArray()) { | 12862 if (!IsJSArray()) { |
| 12865 return this; | 12863 return this; |
| 12866 } | 12864 } |
| 12867 | 12865 |
| 12868 if (!GetHeap()->InNewSpace(this)) return this; | 12866 if (!GetHeap()->InNewSpace(this)) return this; |
| 12869 | 12867 |
| 12870 AllocationMemento* memento = AllocationMemento::FindForHeapObject(this); | 12868 AllocationMemento* memento = AllocationMemento::FindForHeapObject(this); |
| 12871 if (memento == NULL || !memento->IsValid()) { | 12869 if (memento == NULL || !memento->IsValid()) { |
| 12872 return this; | 12870 return this; |
| 12873 } | 12871 } |
| 12874 | 12872 |
| (...skipping 3757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16632 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16630 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16633 static const char* error_messages_[] = { | 16631 static const char* error_messages_[] = { |
| 16634 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16632 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16635 }; | 16633 }; |
| 16636 #undef ERROR_MESSAGES_TEXTS | 16634 #undef ERROR_MESSAGES_TEXTS |
| 16637 return error_messages_[reason]; | 16635 return error_messages_[reason]; |
| 16638 } | 16636 } |
| 16639 | 16637 |
| 16640 | 16638 |
| 16641 } } // namespace v8::internal | 16639 } } // namespace v8::internal |
| OLD | NEW |