Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: src/objects.cc

Issue 661583004: Revert "Limit the number of transitions allowed per hidden class." Due to crashes in ClearMapTransi… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 6566 matching lines...) Expand 10 before | Expand all | Expand 10 after
6577 6577
6578 Handle<Map> result = CopyDropDescriptors(map); 6578 Handle<Map> result = CopyDropDescriptors(map);
6579 Handle<Name> name = descriptor->GetKey(); 6579 Handle<Name> name = descriptor->GetKey();
6580 6580
6581 // Ensure there's space for the new descriptor in the shared descriptor array. 6581 // Ensure there's space for the new descriptor in the shared descriptor array.
6582 if (descriptors->NumberOfSlackDescriptors() == 0) { 6582 if (descriptors->NumberOfSlackDescriptors() == 0) {
6583 int old_size = descriptors->number_of_descriptors(); 6583 int old_size = descriptors->number_of_descriptors();
6584 if (old_size == 0) { 6584 if (old_size == 0) {
6585 descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1); 6585 descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1);
6586 } else { 6586 } else {
6587 EnsureDescriptorSlack( 6587 EnsureDescriptorSlack(map, old_size < 4 ? 1 : old_size / 2);
6588 map, SlackForArraySize(old_size, kMaxNumberOfDescriptors));
6589 descriptors = handle(map->instance_descriptors()); 6588 descriptors = handle(map->instance_descriptors());
6590 } 6589 }
6591 } 6590 }
6592 6591
6593 { 6592 {
6594 DisallowHeapAllocation no_gc; 6593 DisallowHeapAllocation no_gc;
6595 descriptors->Append(descriptor); 6594 descriptors->Append(descriptor);
6596 result->InitializeDescriptors(*descriptors); 6595 result->InitializeDescriptors(*descriptors);
6597 } 6596 }
6598 6597
6599 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); 6598 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1);
6600 ConnectTransition(map, result, name, SIMPLE_TRANSITION); 6599 ConnectTransition(map, result, name, SIMPLE_TRANSITION);
6601 6600
6602 return result; 6601 return result;
6603 } 6602 }
6604 6603
6605 6604
6606 void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child, 6605 void Map::ConnectTransition(Handle<Map> parent, Handle<Map> child,
6607 Handle<Name> name, SimpleTransitionFlag flag) { 6606 Handle<Name> name, SimpleTransitionFlag flag) {
6608 parent->set_owns_descriptors(false); 6607 parent->set_owns_descriptors(false);
6609 if (parent->is_prototype_map()) { 6608 if (parent->is_prototype_map()) {
6610 DCHECK(child->is_prototype_map()); 6609 DCHECK(child->is_prototype_map());
6611 } else { 6610 } else {
6612 Handle<TransitionArray> transitions = 6611 Handle<TransitionArray> transitions =
6613 TransitionArray::Insert(parent, name, child, flag); 6612 TransitionArray::CopyInsert(parent, name, child, flag);
6614 if (!parent->HasTransitionArray() || 6613 parent->set_transitions(*transitions);
6615 *transitions != parent->transitions()) {
6616 parent->set_transitions(*transitions);
6617 }
6618 child->SetBackPointer(*parent); 6614 child->SetBackPointer(*parent);
6619 } 6615 }
6620 } 6616 }
6621 6617
6622 6618
6623 Handle<Map> Map::CopyReplaceDescriptors(Handle<Map> map, 6619 Handle<Map> Map::CopyReplaceDescriptors(Handle<Map> map,
6624 Handle<DescriptorArray> descriptors, 6620 Handle<DescriptorArray> descriptors,
6625 TransitionFlag flag, 6621 TransitionFlag flag,
6626 MaybeHandle<Name> maybe_name, 6622 MaybeHandle<Name> maybe_name,
6627 SimpleTransitionFlag simple_flag) { 6623 SimpleTransitionFlag simple_flag) {
(...skipping 9872 matching lines...) Expand 10 before | Expand all | Expand 10 after
16500 Handle<DependentCode> codes = 16496 Handle<DependentCode> codes =
16501 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16497 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16502 DependentCode::kPropertyCellChangedGroup, 16498 DependentCode::kPropertyCellChangedGroup,
16503 info->object_wrapper()); 16499 info->object_wrapper());
16504 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16500 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16505 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16501 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16506 cell, info->zone()); 16502 cell, info->zone());
16507 } 16503 }
16508 16504
16509 } } // namespace v8::internal 16505 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698