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

Side by Side Diff: src/contexts.h

Issue 7134042: Link function contexts directly to the previous context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Avoid calling previous on the global context. Created 9 years, 6 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
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/contexts.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // 159 //
160 // We may be able to simplify the implementation: 160 // We may be able to simplify the implementation:
161 // 161 //
162 // - We may be able to get rid of 'fcontext': We can always use the fact that 162 // - We may be able to get rid of 'fcontext': We can always use the fact that
163 // previous == NULL for function contexts and so we can search for them. They 163 // previous == NULL for function contexts and so we can search for them. They
164 // are only needed when doing dynamic declarations, and the context chains 164 // are only needed when doing dynamic declarations, and the context chains
165 // tend to be very very short (depth of nesting of 'with' statements). At 165 // tend to be very very short (depth of nesting of 'with' statements). At
166 // the moment we also use it in generated code for context slot accesses - 166 // the moment we also use it in generated code for context slot accesses -
167 // and there we don't want a loop because of code bloat - but we may not 167 // and there we don't want a loop because of code bloat - but we may not
168 // need it there after all (see comment in codegen_*.cc). 168 // need it there after all (see comment in codegen_*.cc).
169 //
170 // - If we cannot get rid of fcontext, consider making 'previous' never NULL
171 // except for the global context. This could simplify Context::Lookup.
172 169
173 class Context: public FixedArray { 170 class Context: public FixedArray {
174 public: 171 public:
175 // Conversions. 172 // Conversions.
176 static Context* cast(Object* context) { 173 static Context* cast(Object* context) {
177 ASSERT(context->IsContext()); 174 ASSERT(context->IsContext());
178 return reinterpret_cast<Context*>(context); 175 return reinterpret_cast<Context*>(context);
179 } 176 }
180 177
181 // The default context slot layout; indices are FixedArray slot indices. 178 // The default context slot layout; indices are FixedArray slot indices.
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 #ifdef DEBUG 390 #ifdef DEBUG
394 // Bootstrapping-aware type checks. 391 // Bootstrapping-aware type checks.
395 static bool IsBootstrappingOrContext(Object* object); 392 static bool IsBootstrappingOrContext(Object* object);
396 static bool IsBootstrappingOrGlobalObject(Object* object); 393 static bool IsBootstrappingOrGlobalObject(Object* object);
397 #endif 394 #endif
398 }; 395 };
399 396
400 } } // namespace v8::internal 397 } } // namespace v8::internal
401 398
402 #endif // V8_CONTEXTS_H_ 399 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698