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/allocation-site-scopes.h" | 5 #include "src/allocation-site-scopes.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 | 9 |
10 | 10 |
11 Handle<AllocationSite> AllocationSiteCreationContext::EnterNewScope() { | 11 Handle<AllocationSite> AllocationSiteCreationContext::EnterNewScope() { |
12 Handle<AllocationSite> scope_site; | 12 Handle<AllocationSite> scope_site; |
13 if (top().is_null()) { | 13 if (top().is_null()) { |
14 // We are creating the top level AllocationSite as opposed to a nested | 14 // We are creating the top level AllocationSite as opposed to a nested |
15 // AllocationSite. | 15 // AllocationSite. |
16 InitializeTraversal(isolate()->factory()->NewAllocationSite()); | 16 InitializeTraversal(isolate()->factory()->NewAllocationSite()); |
17 scope_site = Handle<AllocationSite>(*top(), isolate()); | 17 scope_site = Handle<AllocationSite>(*top(), isolate()); |
18 if (FLAG_trace_creation_allocation_sites) { | 18 if (FLAG_trace_creation_allocation_sites) { |
19 PrintF("*** Creating top level AllocationSite %p\n", | 19 PrintF("*** Creating top level AllocationSite %p\n", |
20 static_cast<void*>(*scope_site)); | 20 static_cast<void*>(*scope_site)); |
21 } | 21 } |
22 } else { | 22 } else { |
23 ASSERT(!current().is_null()); | 23 DCHECK(!current().is_null()); |
24 scope_site = isolate()->factory()->NewAllocationSite(); | 24 scope_site = isolate()->factory()->NewAllocationSite(); |
25 if (FLAG_trace_creation_allocation_sites) { | 25 if (FLAG_trace_creation_allocation_sites) { |
26 PrintF("Creating nested site (top, current, new) (%p, %p, %p)\n", | 26 PrintF("Creating nested site (top, current, new) (%p, %p, %p)\n", |
27 static_cast<void*>(*top()), | 27 static_cast<void*>(*top()), |
28 static_cast<void*>(*current()), | 28 static_cast<void*>(*current()), |
29 static_cast<void*>(*scope_site)); | 29 static_cast<void*>(*scope_site)); |
30 } | 30 } |
31 current()->set_nested_site(*scope_site); | 31 current()->set_nested_site(*scope_site); |
32 update_current_site(*scope_site); | 32 update_current_site(*scope_site); |
33 } | 33 } |
34 ASSERT(!scope_site.is_null()); | 34 DCHECK(!scope_site.is_null()); |
35 return scope_site; | 35 return scope_site; |
36 } | 36 } |
37 | 37 |
38 | 38 |
39 void AllocationSiteCreationContext::ExitScope( | 39 void AllocationSiteCreationContext::ExitScope( |
40 Handle<AllocationSite> scope_site, | 40 Handle<AllocationSite> scope_site, |
41 Handle<JSObject> object) { | 41 Handle<JSObject> object) { |
42 if (!object.is_null()) { | 42 if (!object.is_null()) { |
43 bool top_level = !scope_site.is_null() && | 43 bool top_level = !scope_site.is_null() && |
44 top().is_identical_to(scope_site); | 44 top().is_identical_to(scope_site); |
(...skipping 25 matching lines...) Expand all Loading... |
70 object->IsJSArray() ? "JSArray" : "JSObject", | 70 object->IsJSArray() ? "JSArray" : "JSObject", |
71 static_cast<void*>(*object)); | 71 static_cast<void*>(*object)); |
72 } | 72 } |
73 return true; | 73 return true; |
74 } | 74 } |
75 } | 75 } |
76 return false; | 76 return false; |
77 } | 77 } |
78 | 78 |
79 } } // namespace v8::internal | 79 } } // namespace v8::internal |
OLD | NEW |