vsevik

Untitled

Jan 30th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.84 KB | None | 0 0
  1. diff --git a/src/scopes.cc b/src/scopes.cc
  2. index c961257..f33d81a 100644
  3. --- a/src/scopes.cc
  4. +++ b/src/scopes.cc
  5. @@ -1292,6 +1292,25 @@ void Scope::AllocateNonParameterLocals() {
  6.  
  7.    vars.Sort(VarAndOrder::Compare);
  8.    int var_count = vars.length();
  9. +
  10. +  {
  11. +    bool has_context_allocation = false;
  12. +    for (int i = 0; i < var_count; i++) {
  13. +      if (MustAllocateInContext(vars[i].var())) {
  14. +        has_context_allocation = true;
  15. +        break;
  16. +      }
  17. +    }
  18. +    if (has_context_allocation) {
  19. +      for (int i = 0; i < var_count; i++) {
  20. +        Variable* v = vars[i].var();
  21. +        if (v->mode() != TEMPORARY && !v->is_this() && !v->is_arguments()) {
  22. +          v->ForceContextAllocation();
  23. +        }
  24. +      }
  25. +    }
  26. +  }
  27. +
  28.    for (int i = 0; i < var_count; i++) {
  29.      AllocateNonParameterLocal(vars[i].var());
  30.    }
Advertisement
Add Comment
Please, Sign In to add comment