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

Side by Side Diff: src/variables.cc

Issue 10872084: Allocate block-scoped global bindings to global context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 is_used_(false), 74 is_used_(false),
75 initialization_flag_(initialization_flag), 75 initialization_flag_(initialization_flag),
76 interface_(interface) { 76 interface_(interface) {
77 // Names must be canonicalized for fast equality checks. 77 // Names must be canonicalized for fast equality checks.
78 ASSERT(name->IsSymbol()); 78 ASSERT(name->IsSymbol());
79 // Var declared variables never need initialization. 79 // Var declared variables never need initialization.
80 ASSERT(!(mode == VAR && initialization_flag == kNeedsInitialization)); 80 ASSERT(!(mode == VAR && initialization_flag == kNeedsInitialization));
81 } 81 }
82 82
83 83
84 bool Variable::is_global() const { 84 bool Variable::IsGlobalObjectProperty() const {
85 // Temporaries are never global, they must always be allocated in the 85 // Temporaries are never global, they must always be allocated in the
86 // activation frame. 86 // activation frame.
87 return mode_ != TEMPORARY && scope_ != NULL && scope_->is_global_scope(); 87 return mode_ != TEMPORARY && mode_ != LET && mode_ != CONST_HARMONY
88 && scope_ != NULL && scope_->is_global_scope();
88 } 89 }
89 90
90 91
91 int Variable::CompareIndex(Variable* const* v, Variable* const* w) { 92 int Variable::CompareIndex(Variable* const* v, Variable* const* w) {
92 int x = (*v)->index(); 93 int x = (*v)->index();
93 int y = (*w)->index(); 94 int y = (*w)->index();
94 // Consider sorting them according to type as well? 95 // Consider sorting them according to type as well?
95 return x - y; 96 return x - y;
96 } 97 }
97 98
98 } } // namespace v8::internal 99 } } // namespace v8::internal
OLDNEW
« src/parser.cc ('K') | « src/variables.h ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698