MIPS: Split AST Declaration class, in preparation for new module declaration forms.

Port r10662 (c8054f6).

Original commit message:

Turns Declaration into an abstract class, and introduces VariableDeclaration as a concrete subclass.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9395015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10709 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
rossberg@chromium.org 2012-02-14 16:07:47 +00:00
parent 8ac0c1cdf2
commit f2715fe710

View File

@ -295,11 +295,11 @@ void FullCodeGenerator::Generate(CompilationInfo* info) {
// For named function expressions, declare the function name as a // For named function expressions, declare the function name as a
// constant. // constant.
if (scope()->is_function_scope() && scope()->function() != NULL) { if (scope()->is_function_scope() && scope()->function() != NULL) {
int ignored = 0;
VariableProxy* proxy = scope()->function(); VariableProxy* proxy = scope()->function();
ASSERT(proxy->var()->mode() == CONST || ASSERT(proxy->var()->mode() == CONST ||
proxy->var()->mode() == CONST_HARMONY); proxy->var()->mode() == CONST_HARMONY);
EmitDeclaration(proxy, proxy->var()->mode(), NULL, &ignored); ASSERT(proxy->var()->location() != Variable::UNALLOCATED);
EmitDeclaration(proxy, proxy->var()->mode(), NULL);
} }
VisitDeclarations(scope()->declarations()); VisitDeclarations(scope()->declarations());
} }
@ -738,8 +738,7 @@ void FullCodeGenerator::PrepareForBailoutBeforeSplit(Expression* expr,
void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy, void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy,
VariableMode mode, VariableMode mode,
FunctionLiteral* function, FunctionLiteral* function) {
int* global_count) {
// If it was not possible to allocate the variable at compile time, we // If it was not possible to allocate the variable at compile time, we
// need to "declare" it at runtime to make sure it actually exists in the // need to "declare" it at runtime to make sure it actually exists in the
// local context. // local context.
@ -748,7 +747,7 @@ void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy,
(mode == CONST || mode == CONST_HARMONY || mode == LET); (mode == CONST || mode == CONST_HARMONY || mode == LET);
switch (variable->location()) { switch (variable->location()) {
case Variable::UNALLOCATED: case Variable::UNALLOCATED:
++(*global_count); ++global_count_;
break; break;
case Variable::PARAMETER: case Variable::PARAMETER:
@ -836,9 +835,6 @@ void FullCodeGenerator::EmitDeclaration(VariableProxy* proxy,
} }
void FullCodeGenerator::VisitDeclaration(Declaration* decl) { }
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals. // Call the runtime to declare the globals.
// The context is the first argument. // The context is the first argument.