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

Side by Side Diff: src/transitions.cc

Issue 996133002: correctly invalidate global cells (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cleanup Created 5 years, 9 months 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
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/objects.h" 7 #include "src/objects.h"
8 #include "src/transitions-inl.h" 8 #include "src/transitions-inl.h"
9 #include "src/utils.h" 9 #include "src/utils.h"
10 10
(...skipping 19 matching lines...) Expand all
30 ReplaceTransitions(map, *result); 30 ReplaceTransitions(map, *result);
31 } 31 }
32 32
33 bool is_special_transition = flag == SPECIAL_TRANSITION; 33 bool is_special_transition = flag == SPECIAL_TRANSITION;
34 // If the map has a simple transition, check if it should be overwritten. 34 // If the map has a simple transition, check if it should be overwritten.
35 if (IsSimpleTransition(map->raw_transitions())) { 35 if (IsSimpleTransition(map->raw_transitions())) {
36 Map* old_target = GetSimpleTransition(map->raw_transitions()); 36 Map* old_target = GetSimpleTransition(map->raw_transitions());
37 Name* key = GetSimpleTransitionKey(old_target); 37 Name* key = GetSimpleTransitionKey(old_target);
38 PropertyDetails old_details = GetSimpleTargetDetails(old_target); 38 PropertyDetails old_details = GetSimpleTargetDetails(old_target);
39 PropertyDetails new_details = is_special_transition 39 PropertyDetails new_details = is_special_transition
40 ? PropertyDetails(NONE, DATA, 0) 40 ? PropertyDetails::Empty()
41 : GetTargetDetails(*name, *target); 41 : GetTargetDetails(*name, *target);
42 if (flag == SIMPLE_PROPERTY_TRANSITION && key->Equals(*name) && 42 if (flag == SIMPLE_PROPERTY_TRANSITION && key->Equals(*name) &&
43 old_details.kind() == new_details.kind() && 43 old_details.kind() == new_details.kind() &&
44 old_details.attributes() == new_details.attributes()) { 44 old_details.attributes() == new_details.attributes()) {
45 Handle<WeakCell> cell = Map::WeakCellForMap(target); 45 Handle<WeakCell> cell = Map::WeakCellForMap(target);
46 ReplaceTransitions(map, *cell); 46 ReplaceTransitions(map, *cell);
47 return; 47 return;
48 } 48 }
49 // Otherwise allocate a full TransitionArray with slack for a new entry. 49 // Otherwise allocate a full TransitionArray with slack for a new entry.
50 Handle<TransitionArray> result = Allocate(isolate, 1, 1); 50 Handle<TransitionArray> result = Allocate(isolate, 1, 1);
51 // Re-read existing data; the allocation might have caused it to be cleared. 51 // Re-read existing data; the allocation might have caused it to be cleared.
52 if (IsSimpleTransition(map->raw_transitions())) { 52 if (IsSimpleTransition(map->raw_transitions())) {
53 old_target = GetSimpleTransition(map->raw_transitions()); 53 old_target = GetSimpleTransition(map->raw_transitions());
54 result->NoIncrementalWriteBarrierSet( 54 result->NoIncrementalWriteBarrierSet(
55 0, GetSimpleTransitionKey(old_target), old_target); 55 0, GetSimpleTransitionKey(old_target), old_target);
56 } else { 56 } else {
57 result->SetNumberOfTransitions(0); 57 result->SetNumberOfTransitions(0);
58 } 58 }
59 ReplaceTransitions(map, *result); 59 ReplaceTransitions(map, *result);
60 } 60 }
61 61
62 // At this point, we know that the map has a full TransitionArray. 62 // At this point, we know that the map has a full TransitionArray.
63 DCHECK(IsFullTransitionArray(map->raw_transitions())); 63 DCHECK(IsFullTransitionArray(map->raw_transitions()));
64 64
65 int number_of_transitions = 0; 65 int number_of_transitions = 0;
66 int new_nof = 0; 66 int new_nof = 0;
67 int insertion_index = kNotFound; 67 int insertion_index = kNotFound;
68 DCHECK_EQ(is_special_transition, IsSpecialTransition(*name)); 68 DCHECK_EQ(is_special_transition, IsSpecialTransition(*name));
69 PropertyDetails details = is_special_transition 69 PropertyDetails details = is_special_transition
70 ? PropertyDetails(NONE, DATA, 0) 70 ? PropertyDetails::Empty()
71 : GetTargetDetails(*name, *target); 71 : GetTargetDetails(*name, *target);
72 72
73 { 73 {
74 DisallowHeapAllocation no_gc; 74 DisallowHeapAllocation no_gc;
75 TransitionArray* array = TransitionArray::cast(map->raw_transitions()); 75 TransitionArray* array = TransitionArray::cast(map->raw_transitions());
76 number_of_transitions = array->number_of_transitions(); 76 number_of_transitions = array->number_of_transitions();
77 new_nof = number_of_transitions; 77 new_nof = number_of_transitions;
78 78
79 int index = 79 int index =
80 is_special_transition 80 is_special_transition
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 int TransitionArray::Search(PropertyKind kind, Name* name, 505 int TransitionArray::Search(PropertyKind kind, Name* name,
506 PropertyAttributes attributes, 506 PropertyAttributes attributes,
507 int* out_insertion_index) { 507 int* out_insertion_index) {
508 int transition = SearchName(name, out_insertion_index); 508 int transition = SearchName(name, out_insertion_index);
509 if (transition == kNotFound) { 509 if (transition == kNotFound) {
510 return kNotFound; 510 return kNotFound;
511 } 511 }
512 return SearchDetails(transition, kind, attributes, out_insertion_index); 512 return SearchDetails(transition, kind, attributes, out_insertion_index);
513 } 513 }
514 } } // namespace v8::internal 514 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698