| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 #include "scopeinfo.h" | 32 #include "scopeinfo.h" |
| 33 #include "scopes.h" | 33 #include "scopes.h" |
| 34 | 34 |
| 35 #include "allocation-inl.h" | 35 #include "allocation-inl.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 | 40 |
| 41 Handle<ScopeInfo> ScopeInfo::Create(Scope* scope) { | 41 Handle<ScopeInfo> ScopeInfo::Create(Scope* scope, Zone* zone) { |
| 42 // Collect stack and context locals. | 42 // Collect stack and context locals. |
| 43 ZoneList<Variable*> stack_locals(scope->StackLocalCount()); | 43 ZoneList<Variable*> stack_locals(scope->StackLocalCount(), zone); |
| 44 ZoneList<Variable*> context_locals(scope->ContextLocalCount()); | 44 ZoneList<Variable*> context_locals(scope->ContextLocalCount(), zone); |
| 45 scope->CollectStackAndContextLocals(&stack_locals, &context_locals); | 45 scope->CollectStackAndContextLocals(&stack_locals, &context_locals); |
| 46 const int stack_local_count = stack_locals.length(); | 46 const int stack_local_count = stack_locals.length(); |
| 47 const int context_local_count = context_locals.length(); | 47 const int context_local_count = context_locals.length(); |
| 48 // Make sure we allocate the correct amount. | 48 // Make sure we allocate the correct amount. |
| 49 ASSERT(scope->StackLocalCount() == stack_local_count); | 49 ASSERT(scope->StackLocalCount() == stack_local_count); |
| 50 ASSERT(scope->ContextLocalCount() == context_local_count); | 50 ASSERT(scope->ContextLocalCount() == context_local_count); |
| 51 | 51 |
| 52 // Determine use and location of the function variable if it is present. | 52 // Determine use and location of the function variable if it is present. |
| 53 FunctionVariableInfo function_name_info; | 53 FunctionVariableInfo function_name_info; |
| 54 VariableMode function_variable_mode; | 54 VariableMode function_variable_mode; |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 Context::MIN_CONTEXT_SLOTS, | 501 Context::MIN_CONTEXT_SLOTS, |
| 502 ContextLocalNameEntriesIndex(), | 502 ContextLocalNameEntriesIndex(), |
| 503 ContextLocalNameEntriesIndex() + ContextLocalCount(), | 503 ContextLocalNameEntriesIndex() + ContextLocalCount(), |
| 504 this); | 504 this); |
| 505 | 505 |
| 506 PrintF("}\n"); | 506 PrintF("}\n"); |
| 507 } | 507 } |
| 508 #endif // DEBUG | 508 #endif // DEBUG |
| 509 | 509 |
| 510 } } // namespace v8::internal | 510 } } // namespace v8::internal |
| OLD | NEW |