| 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 5700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5711 } | 5711 } |
| 5712 } | 5712 } |
| 5713 | 5713 |
| 5714 if (object->map()->is_deprecated()) { | 5714 if (object->map()->is_deprecated()) { |
| 5715 JSObject::MigrateInstance(object); | 5715 JSObject::MigrateInstance(object); |
| 5716 } | 5716 } |
| 5717 | 5717 |
| 5718 Handle<JSObject> copy; | 5718 Handle<JSObject> copy; |
| 5719 if (copying) { | 5719 if (copying) { |
| 5720 Handle<AllocationSite> site_to_pass; | 5720 Handle<AllocationSite> site_to_pass; |
| 5721 if (site_context()->activated() && | 5721 if (site_context()->ShouldCreateMemento(object)) { |
| 5722 AllocationSite::CanTrack(object->map()->instance_type()) && | |
| 5723 AllocationSite::GetMode(object->GetElementsKind()) == | |
| 5724 TRACK_ALLOCATION_SITE) { | |
| 5725 site_to_pass = site_context()->current(); | 5722 site_to_pass = site_context()->current(); |
| 5726 } | 5723 } |
| 5727 CALL_AND_RETRY_OR_DIE(isolate, | 5724 CALL_AND_RETRY_OR_DIE(isolate, |
| 5728 isolate->heap()->CopyJSObject(*object, | 5725 isolate->heap()->CopyJSObject(*object, |
| 5729 site_to_pass.is_null() ? NULL : *site_to_pass), | 5726 site_to_pass.is_null() ? NULL : *site_to_pass), |
| 5730 { copy = Handle<JSObject>(JSObject::cast(__object__), | 5727 { copy = Handle<JSObject>(JSObject::cast(__object__), |
| 5731 isolate); | 5728 isolate); |
| 5732 break; | 5729 break; |
| 5733 }, | 5730 }, |
| 5734 return Handle<JSObject>()); | 5731 return Handle<JSObject>()); |
| (...skipping 3439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9174 | 9171 |
| 9175 | 9172 |
| 9176 if (new_length == 0) return heap->isolate()->factory()->empty_string(); | 9173 if (new_length == 0) return heap->isolate()->factory()->empty_string(); |
| 9177 return string; | 9174 return string; |
| 9178 } | 9175 } |
| 9179 | 9176 |
| 9180 | 9177 |
| 9181 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object, | 9178 AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object, |
| 9182 bool in_GC) { | 9179 bool in_GC) { |
| 9183 // Currently, AllocationMemento objects are only allocated immediately | 9180 // Currently, AllocationMemento objects are only allocated immediately |
| 9184 // after JSArrays in NewSpace, and detecting whether a JSArray has one | 9181 // after JSArrays and some JSObjects in NewSpace. Detecting whether a |
| 9185 // involves carefully checking the object immediately after the JSArray | 9182 // memento is present involves carefully checking the object immediately |
| 9186 // (if there is one) to see if it's an AllocationMemento. | 9183 // after the current object (if there is one) to see if it's an |
| 9184 // AllocationMemento. |
| 9187 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { | 9185 if (FLAG_track_allocation_sites && object->GetHeap()->InNewSpace(object)) { |
| 9188 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + | 9186 Address ptr_end = (reinterpret_cast<Address>(object) - kHeapObjectTag) + |
| 9189 object->Size(); | 9187 object->Size(); |
| 9190 Address top; | 9188 Address top; |
| 9191 if (in_GC) { | 9189 if (in_GC) { |
| 9192 top = object->GetHeap()->new_space()->FromSpacePageHigh(); | 9190 top = object->GetHeap()->new_space()->FromSpacePageHigh(); |
| 9193 } else { | 9191 } else { |
| 9194 top = object->GetHeap()->NewSpaceTop(); | 9192 top = object->GetHeap()->NewSpaceTop(); |
| 9195 } | 9193 } |
| 9196 if ((ptr_end + AllocationMemento::kSize) <= top) { | 9194 if ((ptr_end + AllocationMemento::kSize) <= top) { |
| 9197 // There is room in newspace for allocation info. Do we have some? | 9195 // There is room in newspace for allocation info. Do we have some? |
| 9198 Map** possible_allocation_memento_map = | 9196 Map** possible_allocation_memento_map = |
| 9199 reinterpret_cast<Map**>(ptr_end); | 9197 reinterpret_cast<Map**>(ptr_end); |
| 9200 if (*possible_allocation_memento_map == | 9198 if (*possible_allocation_memento_map == |
| 9201 object->GetHeap()->allocation_memento_map()) { | 9199 object->GetHeap()->allocation_memento_map()) { |
| 9202 AllocationMemento* memento = AllocationMemento::cast( | 9200 AllocationMemento* memento = AllocationMemento::cast( |
| 9203 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); | 9201 reinterpret_cast<Object*>(ptr_end + kHeapObjectTag)); |
| 9204 return memento; | 9202 if (memento->IsValid()) { |
| 9203 return memento; |
| 9204 } |
| 9205 } | 9205 } |
| 9206 } | 9206 } |
| 9207 } | 9207 } |
| 9208 return NULL; | 9208 return NULL; |
| 9209 } | 9209 } |
| 9210 | 9210 |
| 9211 | 9211 |
| 9212 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { | 9212 uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) { |
| 9213 // For array indexes mix the length into the hash as an array index could | 9213 // For array indexes mix the length into the hash as an array index could |
| 9214 // be zero. | 9214 // be zero. |
| (...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12782 } | 12782 } |
| 12783 | 12783 |
| 12784 | 12784 |
| 12785 void JSObject::TransitionElementsKind(Handle<JSObject> object, | 12785 void JSObject::TransitionElementsKind(Handle<JSObject> object, |
| 12786 ElementsKind to_kind) { | 12786 ElementsKind to_kind) { |
| 12787 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | 12787 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 12788 object->TransitionElementsKind(to_kind)); | 12788 object->TransitionElementsKind(to_kind)); |
| 12789 } | 12789 } |
| 12790 | 12790 |
| 12791 | 12791 |
| 12792 const double AllocationSite::kPretenureRatio = 0.60; |
| 12793 |
| 12794 |
| 12792 bool AllocationSite::IsNestedSite() { | 12795 bool AllocationSite::IsNestedSite() { |
| 12793 ASSERT(FLAG_trace_track_allocation_sites); | 12796 ASSERT(FLAG_trace_track_allocation_sites); |
| 12794 Object* current = GetHeap()->allocation_sites_list(); | 12797 Object* current = GetHeap()->allocation_sites_list(); |
| 12795 while (current != NULL && current->IsAllocationSite()) { | 12798 while (current != NULL && current->IsAllocationSite()) { |
| 12796 AllocationSite* current_site = AllocationSite::cast(current); | 12799 AllocationSite* current_site = AllocationSite::cast(current); |
| 12797 if (current_site->nested_site() == this) { | 12800 if (current_site->nested_site() == this) { |
| 12798 return true; | 12801 return true; |
| 12799 } | 12802 } |
| 12800 current = current_site->weak_next(); | 12803 current = current_site->weak_next(); |
| 12801 } | 12804 } |
| (...skipping 3850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16652 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16655 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16653 static const char* error_messages_[] = { | 16656 static const char* error_messages_[] = { |
| 16654 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16657 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16655 }; | 16658 }; |
| 16656 #undef ERROR_MESSAGES_TEXTS | 16659 #undef ERROR_MESSAGES_TEXTS |
| 16657 return error_messages_[reason]; | 16660 return error_messages_[reason]; |
| 16658 } | 16661 } |
| 16659 | 16662 |
| 16660 | 16663 |
| 16661 } } // namespace v8::internal | 16664 } } // namespace v8::internal |
| OLD | NEW |