Revision: 11373
Author:   [email protected]
Date:     Wed Apr 18 08:46:08 2012
Log:      MIPS: Refactor code generation for global declarations.

Port r11332 (0e6df8b6)

Original commit message:
Refactor code generation for global declarations.

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10041029
http://code.google.com/p/v8/source/detail?r=11373

Modified:
 /branches/bleeding_edge/src/mips/full-codegen-mips.cc

=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Apr 18 08:43:29 2012 +++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Apr 18 08:46:08 2012
@@ -817,7 +817,10 @@
   bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET;
   switch (variable->location()) {
     case Variable::UNALLOCATED:
-      ++global_count_;
+      globals_.Add(variable->name());
+      globals_.Add(variable->binding_needs_init()
+                       ? isolate()->factory()->the_hole_value()
+                       : isolate()->factory()->undefined_value());
       break;

     case Variable::PARAMETER:
@@ -873,9 +876,15 @@
   VariableProxy* proxy = declaration->proxy();
   Variable* variable = proxy->var();
   switch (variable->location()) {
-    case Variable::UNALLOCATED:
-      ++global_count_;
+    case Variable::UNALLOCATED: {
+      globals_.Add(variable->name());
+      Handle<SharedFunctionInfo> function =
+          Compiler::BuildFunctionInfo(declaration->fun(), script());
+      // Check for stack-overflow exception.
+      if (function.is_null()) return SetStackOverflow();
+      globals_.Add(function);
       break;
+    }

     case Variable::PARAMETER:
     case Variable::LOCAL: {
@@ -923,7 +932,7 @@
   Variable* variable = proxy->var();
   switch (variable->location()) {
     case Variable::UNALLOCATED:
-      ++global_count_;
+      // TODO(rossberg): initialize module instance object
       break;

     case Variable::CONTEXT: {
@@ -946,7 +955,7 @@
   Variable* variable = proxy->var();
   switch (variable->location()) {
     case Variable::UNALLOCATED:
-      ++global_count_;
+      // TODO(rossberg)
       break;

     case Variable::CONTEXT: {

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to