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 5696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5707 | 5707 |
5708 // The returned handle will be used for the object in all | 5708 // The returned handle will be used for the object in all |
5709 // subsequent usages. This allows VisitObject to make a copy | 5709 // subsequent usages. This allows VisitObject to make a copy |
5710 // of the object if desired. | 5710 // of the object if desired. |
5711 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) V8_OVERRIDE { | 5711 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) V8_OVERRIDE { |
5712 // Only create a memento if | 5712 // Only create a memento if |
5713 // 1) we have a JSArray, and | 5713 // 1) we have a JSArray, and |
5714 // 2) the elements kind is palatable | 5714 // 2) the elements kind is palatable |
5715 // 3) allow_mementos is true | 5715 // 3) allow_mementos is true |
5716 Handle<JSObject> copy; | 5716 Handle<JSObject> copy; |
5717 if (site_context()->activated() && | 5717 if (site_context()->ShouldCreateMemento(object)) { |
5718 AllocationSite::CanTrack(object->map()->instance_type()) && | |
5719 AllocationSite::GetMode(object->GetElementsKind()) == | |
5720 TRACK_ALLOCATION_SITE) { | |
5721 copy = JSObject::Copy(object, site_context()->current()); | 5718 copy = JSObject::Copy(object, site_context()->current()); |
5722 } else { | 5719 } else { |
5723 copy = JSObject::Copy(object); | 5720 copy = JSObject::Copy(object); |
5724 } | 5721 } |
5725 | 5722 |
5726 return copy; | 5723 return copy; |
5727 } | 5724 } |
5728 | 5725 |
5729 virtual Handle<JSObject> VisitElementOrProperty( | 5726 virtual Handle<JSObject> VisitElementOrProperty( |
5730 Handle<JSObject> object, | 5727 Handle<JSObject> object, |
(...skipping 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9226 top = object->GetHeap()->NewSpaceTop(); | 9223 top = object->GetHeap()->NewSpaceTop(); |
9227 } | 9224 } |
9228 if ((ptr_end + AllocationMemento::kSize) <= top) { | 9225 if ((ptr_end + AllocationMemento::kSize) <= top) { |
9229 // There is room in newspace for allocation info. Do we have some? | 9226 // There is room in newspace for allocation info. Do we have some? |
9230 Map** possible_allocation_memento_map = | 9227 Map** possible_allocation_memento_map = |
9231 reinterpret_cast<Map**>(ptr_end); | 9228 reinterpret_cast<Map**>(ptr_end); |
9232 if (*possible_allocation_memento_map == | 9229 if (*possible_allocation_memento_map == |
9233 object->GetHeap()->allocation_memento_map()) { | 9230 object->GetHeap()->allocation_memento_map()) { |
9234 AllocationMemento* memento = AllocationMemento::cast( | 9231 AllocationMemento* memento = AllocationMemento::cast( |
9235 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9232 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
9236 return memento; | 9233 if (memento->IsValid()) { |
| 9234 return memento; |
| 9235 } |
9237 } | 9236 } |
9238 } | 9237 } |
9239 } | 9238 } |
9240 return NULL; | 9239 return NULL; |
9241 } | 9240 } |
9242 | 9241 |
9243 | 9242 |
9244 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9243 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
9245 // For array indexes mix the length into the hash as an array index could | 9244 // For array indexes mix the length into the hash as an array index could |
9246 // be zero. | 9245 // be zero. |
(...skipping 7421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16668 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16667 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16669 static const char* error_messages_[] = { | 16668 static const char* error_messages_[] = { |
16670 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16669 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16671 }; | 16670 }; |
16672 #undef ERROR_MESSAGES_TEXTS | 16671 #undef ERROR_MESSAGES_TEXTS |
16673 return error_messages_[reason]; | 16672 return error_messages_[reason]; |
16674 } | 16673 } |
16675 | 16674 |
16676 | 16675 |
16677 } } // namespace v8::internal | 16676 } } // namespace v8::internal |
OLD | NEW |