OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 4566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4577 // Copy the next enumeration index from instance descriptor. | 4577 // Copy the next enumeration index from instance descriptor. |
4578 dictionary->SetNextEnumerationIndex(real_size + 1); | 4578 dictionary->SetNextEnumerationIndex(real_size + 1); |
4579 | 4579 |
4580 // From here on we cannot fail and we shouldn't GC anymore. | 4580 // From here on we cannot fail and we shouldn't GC anymore. |
4581 DisallowHeapAllocation no_allocation; | 4581 DisallowHeapAllocation no_allocation; |
4582 | 4582 |
4583 // Resize the object in the heap if necessary. | 4583 // Resize the object in the heap if necessary. |
4584 int new_instance_size = new_map->instance_size(); | 4584 int new_instance_size = new_map->instance_size(); |
4585 int instance_size_delta = map->instance_size() - new_instance_size; | 4585 int instance_size_delta = map->instance_size() - new_instance_size; |
4586 ASSERT(instance_size_delta >= 0); | 4586 ASSERT(instance_size_delta >= 0); |
4587 Heap* heap = isolate->heap(); | 4587 |
4588 heap->CreateFillerObjectAt(object->address() + new_instance_size, | 4588 if (instance_size_delta > 0) { |
4589 instance_size_delta); | 4589 Heap* heap = isolate->heap(); |
4590 heap->AdjustLiveBytes(object->address(), | 4590 heap->CreateFillerObjectAt(object->address() + new_instance_size, |
4591 -instance_size_delta, | 4591 instance_size_delta); |
4592 Heap::FROM_MUTATOR); | 4592 heap->AdjustLiveBytes(object->address(), -instance_size_delta, |
| 4593 Heap::FROM_MUTATOR); |
| 4594 } |
4593 | 4595 |
4594 // We are storing the new map using release store after creating a filler for | 4596 // We are storing the new map using release store after creating a filler for |
4595 // the left-over space to avoid races with the sweeper thread. | 4597 // the left-over space to avoid races with the sweeper thread. |
4596 object->synchronized_set_map(*new_map); | 4598 object->synchronized_set_map(*new_map); |
4597 | 4599 |
4598 object->set_properties(*dictionary); | 4600 object->set_properties(*dictionary); |
4599 | 4601 |
4600 isolate->counters()->props_to_dictionary()->Increment(); | 4602 isolate->counters()->props_to_dictionary()->Increment(); |
4601 | 4603 |
4602 #ifdef DEBUG | 4604 #ifdef DEBUG |
(...skipping 12361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16964 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16966 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16965 static const char* error_messages_[] = { | 16967 static const char* error_messages_[] = { |
16966 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16968 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16967 }; | 16969 }; |
16968 #undef ERROR_MESSAGES_TEXTS | 16970 #undef ERROR_MESSAGES_TEXTS |
16969 return error_messages_[reason]; | 16971 return error_messages_[reason]; |
16970 } | 16972 } |
16971 | 16973 |
16972 | 16974 |
16973 } } // namespace v8::internal | 16975 } } // namespace v8::internal |
OLD | NEW |