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

Unified Diff: src/scopeinfo.cc

Issue 7374002: Refactor allocation policies. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scopeinfo.h ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index 3e18368f74bde67569d01223a66717b64ad10bd2..83a68a6ff7322795c57be4fb65b45f83e390f01c 100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -51,14 +51,14 @@ static int CompareLocal(Variable* const* v, Variable* const* w) {
template<class Allocator>
-ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
+ScopeInfo<Allocator>::ScopeInfo(Scope* scope, const Allocator& allocator)
: function_name_(FACTORY->empty_symbol()),
calls_eval_(scope->calls_eval()),
is_strict_mode_(scope->is_strict_mode()),
- parameters_(scope->num_parameters()),
- stack_slots_(scope->num_stack_slots()),
- context_slots_(scope->num_heap_slots()),
- context_modes_(scope->num_heap_slots()) {
+ parameters_(scope->num_parameters(), allocator),
+ stack_slots_(scope->num_stack_slots(), allocator),
+ context_slots_(scope->num_heap_slots(), allocator),
+ context_modes_(scope->num_heap_slots(), allocator) {
// Add parameters.
for (int i = 0; i < scope->num_parameters(); i++) {
ASSERT(parameters_.length() == i);
@@ -77,12 +77,12 @@ ScopeInfo<Allocator>::ScopeInfo(Scope* scope)
// Thus, we first collect the context-allocated locals, and then
// sort them by context slot index before adding them to the
// ScopeInfo list.
- List<Variable*, Allocator> locals(32); // 32 is a wild guess
+ List<Variable*, Allocator> locals(32, allocator); // 32 is a wild guess
ASSERT(locals.is_empty());
scope->CollectUsedVariables(&locals);
locals.Sort(&CompareLocal);
- List<Variable*, Allocator> heap_locals(locals.length());
+ List<Variable*, Allocator> heap_locals(locals.length(), allocator);
for (int i = 0; i < locals.length(); i++) {
Variable* var = locals[i];
if (var->is_used()) {
@@ -240,12 +240,13 @@ static Object** ReadList(Object** p,
template<class Allocator>
-ScopeInfo<Allocator>::ScopeInfo(SerializedScopeInfo* data)
+ScopeInfo<Allocator>::ScopeInfo(SerializedScopeInfo* data,
+ const Allocator& allocator)
: function_name_(FACTORY->empty_symbol()),
- parameters_(4),
- stack_slots_(8),
- context_slots_(8),
- context_modes_(8) {
+ parameters_(4, allocator),
+ stack_slots_(8, allocator),
+ context_slots_(8, allocator),
+ context_modes_(8, allocator) {
if (data->length() > 0) {
Object** p0 = data->data_start();
Object** p = p0;
@@ -356,7 +357,7 @@ int ScopeInfo<Allocator>::NumberOfLocals() const {
Handle<SerializedScopeInfo> SerializedScopeInfo::Create(Scope* scope) {
- ScopeInfo<ZoneListAllocationPolicy> sinfo(scope);
+ ScopeInfo<ZoneListAllocator> sinfo(scope, ZoneListAllocator(ZONE));
return sinfo.Serialize();
}
@@ -641,8 +642,8 @@ void ScopeInfo<Allocator>::Print() {
// Make sure the classes get instantiated by the template system.
-template class ScopeInfo<FreeStoreAllocationPolicy>;
-template class ScopeInfo<PreallocatedStorage>;
-template class ScopeInfo<ZoneListAllocationPolicy>;
+template class ScopeInfo<FreeStoreAllocator>;
+template class ScopeInfo<PreallocatedStorageAllocator>;
+template class ScopeInfo<ZoneListAllocator>;
} } // namespace v8::internal
« no previous file with comments | « src/scopeinfo.h ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698