OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |