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(); |