| 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 5697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5708 | 5708 |
| 5709 // The returned handle will be used for the object in all | 5709 // The returned handle will be used for the object in all |
| 5710 // subsequent usages. This allows VisitObject to make a copy | 5710 // subsequent usages. This allows VisitObject to make a copy |
| 5711 // of the object if desired. | 5711 // of the object if desired. |
| 5712 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) V8_OVERRIDE { | 5712 virtual Handle<JSObject> VisitObject(Handle<JSObject> object) V8_OVERRIDE { |
| 5713 // Only create a memento if | 5713 // Only create a memento if |
| 5714 // 1) we have a JSArray, and | 5714 // 1) we have a JSArray, and |
| 5715 // 2) the elements kind is palatable | 5715 // 2) the elements kind is palatable |
| 5716 // 3) allow_mementos is true | 5716 // 3) allow_mementos is true |
| 5717 Handle<JSObject> copy; | 5717 Handle<JSObject> copy; |
| 5718 if (site_context()->activated() && | 5718 if (site_context()->ShouldCreateMemento(object)) { |
| 5719 AllocationSite::CanTrack(object->map()->instance_type()) && | |
| 5720 AllocationSite::GetMode(object->GetElementsKind()) == | |
| 5721 TRACK_ALLOCATION_SITE) { | |
| 5722 copy = JSObject::Copy(object, site_context()->current()); | 5719 copy = JSObject::Copy(object, site_context()->current()); |
| 5723 } else { | 5720 } else { |
| 5724 copy = JSObject::Copy(object); | 5721 copy = JSObject::Copy(object); |
| 5725 } | 5722 } |
| 5726 | 5723 |
| 5727 return copy; | 5724 return copy; |
| 5728 } | 5725 } |
| 5729 | 5726 |
| 5730 virtual Handle<JSObject> VisitElementOrProperty( | 5727 virtual Handle<JSObject> VisitElementOrProperty( |
| 5731 Handle<JSObject> object, | 5728 Handle<JSObject> object, |
| (...skipping 3495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9227 top = object->GetHeap()->NewSpaceTop(); | 9224 top = object->GetHeap()->NewSpaceTop(); |
| 9228 } | 9225 } |
| 9229 if ((ptr_end + AllocationMemento::kSize) <= top) { | 9226 if ((ptr_end + AllocationMemento::kSize) <= top) { |
| 9230 // There is room in newspace for allocation info. Do we have some? | 9227 // There is room in newspace for allocation info. Do we have some? |
| 9231 Map** possible_allocation_memento_map = | 9228 Map** possible_allocation_memento_map = |
| 9232 reinterpret_cast<Map**>(ptr_end); | 9229 reinterpret_cast<Map**>(ptr_end); |
| 9233 if (*possible_allocation_memento_map == | 9230 if (*possible_allocation_memento_map == |
| 9234 object->GetHeap()->allocation_memento_map()) { | 9231 object->GetHeap()->allocation_memento_map()) { |
| 9235 AllocationMemento* memento = AllocationMemento::cast( | 9232 AllocationMemento* memento = AllocationMemento::cast( |
| 9236 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9233 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
| 9237 return memento; | 9234 if (memento->IsValid()) { |
| 9235 return memento; |
| 9236 } |
| 9238 } | 9237 } |
| 9239 } | 9238 } |
| 9240 } | 9239 } |
| 9241 return NULL; | 9240 return NULL; |
| 9242 } | 9241 } |
| 9243 | 9242 |
| 9244 | 9243 |
| 9245 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9244 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
| 9246 // For array indexes mix the length into the hash as an array index could | 9245 // For array indexes mix the length into the hash as an array index could |
| 9247 // be zero. | 9246 // be zero. |
| (...skipping 3555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12803 } | 12802 } |
| 12804 | 12803 |
| 12805 | 12804 |
| 12806 void JSObject::TransitionElementsKind(Handle<JSObject> object, | 12805 void JSObject::TransitionElementsKind(Handle<JSObject> object, |
| 12807 ElementsKind to_kind) { | 12806 ElementsKind to_kind) { |
| 12808 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12807 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12809 object->TransitionElementsKind(to_kind)); | 12808 object->TransitionElementsKind(to_kind)); |
| 12810 } | 12809 } |
| 12811 | 12810 |
| 12812 | 12811 |
| 12812 const double AllocationSite::kPretenureRatio = 0.60; |
| 12813 |
| 12814 |
| 12813 bool AllocationSite::IsNestedSite() { | 12815 bool AllocationSite::IsNestedSite() { |
| 12814 ASSERT(FLAG_trace_track_allocation_sites); | 12816 ASSERT(FLAG_trace_track_allocation_sites); |
| 12815 Object* current = GetHeap()->allocation_sites_list(); | 12817 Object* current = GetHeap()->allocation_sites_list(); |
| 12816 while (current != NULL && current->IsAllocationSite()) { | 12818 while (current != NULL && current->IsAllocationSite()) { |
| 12817 AllocationSite* current_site = AllocationSite::cast(current); | 12819 AllocationSite* current_site = AllocationSite::cast(current); |
| 12818 if (current_site->nested_site() == this) { | 12820 if (current_site->nested_site() == this) { |
| 12819 return true; | 12821 return true; |
| 12820 } | 12822 } |
| 12821 current = current_site->weak_next(); | 12823 current = current_site->weak_next(); |
| 12822 } | 12824 } |
| (...skipping 3850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16673 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16675 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16674 static const char* error_messages_[] = { | 16676 static const char* error_messages_[] = { |
| 16675 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16677 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16676 }; | 16678 }; |
| 16677 #undef ERROR_MESSAGES_TEXTS | 16679 #undef ERROR_MESSAGES_TEXTS |
| 16678 return error_messages_[reason]; | 16680 return error_messages_[reason]; |
| 16679 } | 16681 } |
| 16680 | 16682 |
| 16681 | 16683 |
| 16682 } } // namespace v8::internal | 16684 } } // namespace v8::internal |
| OLD | NEW |