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

Unified Diff: src/contexts.h

Issue 7003058: A collection of context-related refactoring changes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: src/contexts.h
diff --git a/src/contexts.h b/src/contexts.h
index a89e26228150502475e29d96e017929ea61bfd4c..64bfc4cd4f938d0c572f9ead9ad6e9263ba78570 100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -289,8 +289,17 @@ class Context: public FixedArray {
// Compute the global context by traversing the context chain.
Context* global_context();
- // Tells if this is a function context (as opposed to a 'with' context).
- bool is_function_context() { return unchecked_previous() == NULL; }
Kevin Millikin (Chromium) 2011/06/08 16:35:52 I plan on next using previous() for context iterat
+ // Predicates for context types. IsGlobalContext is defined on Object
+ // because we frequently have to know if arbitrary objects are global
+ // contexts.
+ bool IsFunctionContext() {
+ Map* map = this->map();
+ return map == map->GetHeap()->function_context_map();
+ }
+ bool IsCatchContext() {
+ Map* map = this->map();
+ return map == map->GetHeap()->catch_context_map();
+ }
// Tells whether the global context is marked with out of memory.
inline bool has_out_of_memory();

Powered by Google App Engine
This is Rietveld 408576698