| 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 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 9194 if (FLAG_track_allocation_sites) { |
| 9195 object->Size(); | 9195 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
| 9196 Address top; | 9196 object->Size(); |
| 9197 if (in_GC) { | 9197 Address top; |
| 9198 top = object->GetHeap()->new_space()->FromSpacePageHigh(); | 9198 if (in_GC) { |
| 9199 } else { | 9199 top = object->GetHeap()->new_space()->FromSpacePageHigh(); |
| 9200 top = object->GetHeap()->NewSpaceTop(); | 9200 } else { |
| 9201 } | 9201 top = object->GetHeap()->NewSpaceTop(); |
| 9202 if ((ptr_end + AllocationMemento::kSize) <= top) { | 9202 } |
| 9203 // There is room in newspace for allocation info. Do we have some? | 9203 if ((ptr_end + AllocationMemento::kSize) <= top) { |
| 9204 Map** possible_allocation_memento_map = | 9204 // There is room in newspace for allocation info. Do we have some? |
| 9205 reinterpret_cast<Map**>(ptr_end); | 9205 Map** possible_allocation_memento_map = |
| 9206 if (*possible_allocation_memento_map == | 9206 reinterpret_cast<Map**>(ptr_end); |
| 9207 object->GetHeap()->allocation_memento_map()) { | 9207 if (*possible_allocation_memento_map == |
| 9208 AllocationMemento* memento = AllocationMemento::cast( | 9208 object->GetHeap()->allocation_memento_map()) { |
| 9209 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9209 AllocationMemento* memento = AllocationMemento::cast( |
| 9210 if (memento->IsValid()) { | 9210 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
| 9211 return memento; | 9211 if (memento->IsValid()) { |
| 9212 return memento; |
| 9213 } |
| 9212 } | 9214 } |
| 9213 } | 9215 } |
| 9214 } | 9216 } |
| 9215 return NULL; | 9217 return NULL; |
| 9216 } | 9218 } |
| 9217 | 9219 |
| 9218 | 9220 |
| 9219 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9221 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
| 9220 // For array indexes mix the length into the hash as an array index could | 9222 // For array indexes mix the length into the hash as an array index could |
| 9221 // be zero. | 9223 // be zero. |
| (...skipping 3664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12886 | 12888 |
| 12887 | 12889 |
| 12888 void JSObject::UpdateAllocationSite(Handle<JSObject> object, | 12890 void JSObject::UpdateAllocationSite(Handle<JSObject> object, |
| 12889 ElementsKind to_kind) { | 12891 ElementsKind to_kind) { |
| 12890 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12892 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12891 object->UpdateAllocationSite(to_kind)); | 12893 object->UpdateAllocationSite(to_kind)); |
| 12892 } | 12894 } |
| 12893 | 12895 |
| 12894 | 12896 |
| 12895 MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { | 12897 MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { |
| 12896 if (!IsJSArray()) { | 12898 if (!FLAG_track_allocation_sites || !IsJSArray()) { |
| 12897 return this; | 12899 return this; |
| 12898 } | 12900 } |
| 12899 | 12901 |
| 12900 if (!GetHeap()->InNewSpace(this)) return this; | 12902 if (!GetHeap()->InNewSpace(this)) return this; |
| 12901 | 12903 |
| 12902 AllocationMemento* memento = AllocationMemento::FindForHeapObject(this); | 12904 AllocationMemento* memento = AllocationMemento::FindForHeapObject(this); |
| 12903 if (memento == NULL || !memento->IsValid()) { | 12905 if (memento == NULL || !memento->IsValid()) { |
| 12904 return this; | 12906 return this; |
| 12905 } | 12907 } |
| 12906 | 12908 |
| (...skipping 3757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16664 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16666 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16665 static const char* error_messages_[] = { | 16667 static const char* error_messages_[] = { |
| 16666 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16668 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16667 }; | 16669 }; |
| 16668 #undef ERROR_MESSAGES_TEXTS | 16670 #undef ERROR_MESSAGES_TEXTS |
| 16669 return error_messages_[reason]; | 16671 return error_messages_[reason]; |
| 16670 } | 16672 } |
| 16671 | 16673 |
| 16672 | 16674 |
| 16673 } } // namespace v8::internal | 16675 } } // namespace v8::internal |
| OLD | NEW |