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

Side by Side Diff: src/allocation-site-scopes.cc

Issue 26539010: Revert "AllocationSites for all literals" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/allocation-site-scopes.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28 #include "allocation-site-scopes.h"
29
30 namespace v8 {
31 namespace internal {
32
33
34 Handle<AllocationSite> AllocationSiteCreationContext::EnterNewScope() {
35 Handle<AllocationSite> scope_site;
36 if (top().is_null()) {
37 // We are creating the top level AllocationSite as opposed to a nested
38 // AllocationSite.
39 InitializeTraversal(isolate()->factory()->NewAllocationSite());
40 scope_site = Handle<AllocationSite>(*top(), isolate());
41 if (FLAG_trace_creation_allocation_sites) {
42 PrintF("*** Creating top level AllocationSite %p\n",
43 static_cast<void*>(*scope_site));
44 }
45 } else {
46 ASSERT(!current().is_null());
47 scope_site = isolate()->factory()->NewAllocationSite();
48 if (FLAG_trace_creation_allocation_sites) {
49 PrintF("Creating nested site (top, current, new) (%p, %p, %p)\n",
50 static_cast<void*>(*top()),
51 static_cast<void*>(*current()),
52 static_cast<void*>(*scope_site));
53 }
54 current()->set_nested_site(*scope_site);
55 update_current_site(*scope_site);
56 }
57 ASSERT(!scope_site.is_null());
58 return scope_site;
59 }
60
61
62 void AllocationSiteCreationContext::ExitScope(
63 Handle<AllocationSite> scope_site,
64 Handle<JSObject> object) {
65 if (!object.is_null() && !object->IsFailure()) {
66 bool top_level = !scope_site.is_null() &&
67 top().is_identical_to(scope_site);
68
69 scope_site->set_transition_info(*object);
70 if (FLAG_trace_creation_allocation_sites) {
71 if (top_level) {
72 PrintF("*** Setting AllocationSite %p transition_info %p\n",
73 static_cast<void*>(*scope_site),
74 static_cast<void*>(*object));
75 } else {
76 PrintF("Setting AllocationSite (%p, %p) transition_info %p\n",
77 static_cast<void*>(*top()),
78 static_cast<void*>(*scope_site),
79 static_cast<void*>(*object));
80 }
81 }
82 }
83 }
84
85
86 Handle<AllocationSite> AllocationSiteUsageContext::EnterNewScope() {
87 if (top().is_null()) {
88 InitializeTraversal(top_site_);
89 } else {
90 // Advance current site
91 Object* nested_site = current()->nested_site();
92 // Something is wrong if we advance to the end of the list here.
93 ASSERT(nested_site->IsAllocationSite());
94 update_current_site(AllocationSite::cast(nested_site));
95 }
96 return Handle<AllocationSite>(*current(), isolate());
97 }
98
99
100 void AllocationSiteUsageContext::ExitScope(
101 Handle<AllocationSite> scope_site,
102 Handle<JSObject> object) {
103 // This assert ensures that we are pointing at the right sub-object in a
104 // recursive walk of a nested literal.
105 ASSERT(*object == scope_site->transition_info());
106 }
107
108 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/allocation-site-scopes.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698