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 #ifndef V8_ALLOCATION_SITE_SCOPES_H_ | 5 #ifndef V8_ALLOCATION_SITE_SCOPES_H_ |
6 #define V8_ALLOCATION_SITE_SCOPES_H_ | 6 #define V8_ALLOCATION_SITE_SCOPES_H_ |
7 | 7 |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 top_site_(site), | 68 top_site_(site), |
69 activated_(activated) { } | 69 activated_(activated) { } |
70 | 70 |
71 inline Handle<AllocationSite> EnterNewScope() { | 71 inline Handle<AllocationSite> EnterNewScope() { |
72 if (top().is_null()) { | 72 if (top().is_null()) { |
73 InitializeTraversal(top_site_); | 73 InitializeTraversal(top_site_); |
74 } else { | 74 } else { |
75 // Advance current site | 75 // Advance current site |
76 Object* nested_site = current()->nested_site(); | 76 Object* nested_site = current()->nested_site(); |
77 // Something is wrong if we advance to the end of the list here. | 77 // Something is wrong if we advance to the end of the list here. |
78 DCHECK(nested_site->IsAllocationSite()); | |
titzer
2015/04/20 09:43:15
This check was redundant since it's implied in the
| |
79 update_current_site(AllocationSite::cast(nested_site)); | 78 update_current_site(AllocationSite::cast(nested_site)); |
80 } | 79 } |
81 return Handle<AllocationSite>(*current(), isolate()); | 80 return Handle<AllocationSite>(*current(), isolate()); |
82 } | 81 } |
83 | 82 |
84 inline void ExitScope(Handle<AllocationSite> scope_site, | 83 inline void ExitScope(Handle<AllocationSite> scope_site, |
85 Handle<JSObject> object) { | 84 Handle<JSObject> object) { |
86 // This assert ensures that we are pointing at the right sub-object in a | 85 // This assert ensures that we are pointing at the right sub-object in a |
87 // recursive walk of a nested literal. | 86 // recursive walk of a nested literal. |
88 DCHECK(object.is_null() || *object == scope_site->transition_info()); | 87 DCHECK(object.is_null() || *object == scope_site->transition_info()); |
89 } | 88 } |
90 | 89 |
91 bool ShouldCreateMemento(Handle<JSObject> object); | 90 bool ShouldCreateMemento(Handle<JSObject> object); |
92 | 91 |
93 private: | 92 private: |
94 Handle<AllocationSite> top_site_; | 93 Handle<AllocationSite> top_site_; |
95 bool activated_; | 94 bool activated_; |
96 }; | 95 }; |
97 | 96 |
98 | 97 |
99 } } // namespace v8::internal | 98 } } // namespace v8::internal |
100 | 99 |
101 #endif // V8_ALLOCATION_SITE_SCOPES_H_ | 100 #endif // V8_ALLOCATION_SITE_SCOPES_H_ |
OLD | NEW |