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

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

Issue 77293003: Addressed perf regression in Browsermark2.0 array blur test (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Platform ports Created 7 years 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 | « no previous file | src/allocation-site-scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 27 matching lines...) Expand all
38 38
39 39
40 // AllocationSiteContext is the base class for walking and copying a nested 40 // AllocationSiteContext is the base class for walking and copying a nested
41 // boilerplate with AllocationSite and AllocationMemento support. 41 // boilerplate with AllocationSite and AllocationMemento support.
42 class AllocationSiteContext { 42 class AllocationSiteContext {
43 public: 43 public:
44 AllocationSiteContext(Isolate* isolate, bool activated) { 44 AllocationSiteContext(Isolate* isolate, bool activated) {
45 isolate_ = isolate; 45 isolate_ = isolate;
46 activated_ = activated; 46 activated_ = activated;
47 }; 47 };
48 virtual ~AllocationSiteContext() {}
49 48
50 Handle<AllocationSite> top() { return top_; } 49 Handle<AllocationSite> top() { return top_; }
51 Handle<AllocationSite> current() { return current_; } 50 Handle<AllocationSite> current() { return current_; }
52 51
53 // If activated, then recursively create mementos 52 // If activated, then recursively create mementos
54 bool activated() const { return activated_; } 53 bool activated() const { return activated_; }
55 54
56 // Returns the AllocationSite that matches this scope. 55 Isolate* isolate() { return isolate_; }
57 virtual Handle<AllocationSite> EnterNewScope() = 0;
58
59 // scope_site should be the handle returned by the matching EnterNewScope()
60 virtual void ExitScope(Handle<AllocationSite> scope_site,
61 Handle<JSObject> object) = 0;
62 56
63 protected: 57 protected:
64 void update_current_site(AllocationSite* site) { 58 void update_current_site(AllocationSite* site) {
65 *(current_.location()) = site; 59 *(current_.location()) = site;
66 } 60 }
67 61
68 Isolate* isolate() { return isolate_; }
69 void InitializeTraversal(Handle<AllocationSite> site) { 62 void InitializeTraversal(Handle<AllocationSite> site) {
70 top_ = site; 63 top_ = site;
71 current_ = Handle<AllocationSite>(*top_, isolate()); 64 current_ = Handle<AllocationSite>(*top_, isolate());
72 } 65 }
73 66
74 private: 67 private:
75 Isolate* isolate_; 68 Isolate* isolate_;
76 Handle<AllocationSite> top_; 69 Handle<AllocationSite> top_;
77 Handle<AllocationSite> current_; 70 Handle<AllocationSite> current_;
78 bool activated_; 71 bool activated_;
79 }; 72 };
80 73
81 74
82 // AllocationSiteCreationContext aids in the creation of AllocationSites to 75 // AllocationSiteCreationContext aids in the creation of AllocationSites to
83 // accompany object literals. 76 // accompany object literals.
84 class AllocationSiteCreationContext : public AllocationSiteContext { 77 class AllocationSiteCreationContext : public AllocationSiteContext {
85 public: 78 public:
86 explicit AllocationSiteCreationContext(Isolate* isolate) 79 explicit AllocationSiteCreationContext(Isolate* isolate)
87 : AllocationSiteContext(isolate, true) { } 80 : AllocationSiteContext(isolate, true) { }
88 81
89 virtual Handle<AllocationSite> EnterNewScope() V8_OVERRIDE; 82 Handle<AllocationSite> EnterNewScope();
90 virtual void ExitScope(Handle<AllocationSite> site, 83 void ExitScope(Handle<AllocationSite> site, Handle<JSObject> object);
91 Handle<JSObject> object) V8_OVERRIDE;
92 }; 84 };
93 85
94 86
95 // AllocationSiteUsageContext aids in the creation of AllocationMementos placed 87 // AllocationSiteUsageContext aids in the creation of AllocationMementos placed
96 // behind some/all components of a copied object literal. 88 // behind some/all components of a copied object literal.
97 class AllocationSiteUsageContext : public AllocationSiteContext { 89 class AllocationSiteUsageContext : public AllocationSiteContext {
98 public: 90 public:
99 AllocationSiteUsageContext(Isolate* isolate, Handle<AllocationSite> site, 91 AllocationSiteUsageContext(Isolate* isolate, Handle<AllocationSite> site,
100 bool activated) 92 bool activated)
101 : AllocationSiteContext(isolate, activated), 93 : AllocationSiteContext(isolate, activated),
102 top_site_(site) { } 94 top_site_(site) { }
103 95
104 virtual Handle<AllocationSite> EnterNewScope() V8_OVERRIDE; 96 inline Handle<AllocationSite> EnterNewScope() {
105 virtual void ExitScope(Handle<AllocationSite> site, 97 if (top().is_null()) {
106 Handle<JSObject> object) V8_OVERRIDE; 98 InitializeTraversal(top_site_);
99 } else {
100 // Advance current site
101 Object* nested_site = current()->nested_site();
102 // Something is wrong if we advance to the end of the list here.
103 ASSERT(nested_site->IsAllocationSite());
104 update_current_site(AllocationSite::cast(nested_site));
105 }
106 return Handle<AllocationSite>(*current(), isolate());
107 }
108
109 inline void ExitScope(Handle<AllocationSite> scope_site,
110 Handle<JSObject> object) {
111 // This assert ensures that we are pointing at the right sub-object in a
112 // recursive walk of a nested literal.
113 ASSERT(object.is_null() || *object == scope_site->transition_info());
114 }
107 115
108 private: 116 private:
109 Handle<AllocationSite> top_site_; 117 Handle<AllocationSite> top_site_;
110 }; 118 };
111 119
112 120
113 } } // namespace v8::internal 121 } } // namespace v8::internal
114 122
115 #endif // V8_ALLOCATION_SITE_SCOPES_H_ 123 #endif // V8_ALLOCATION_SITE_SCOPES_H_
OLDNEW
« no previous file with comments | « no previous file | src/allocation-site-scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698