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

Unified Diff: src/contexts.h

Issue 7886002: Revert "Clean up Context::Lookup and its uses." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/contexts.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.h
diff --git a/src/contexts.h b/src/contexts.h
index 0facc9a6c7edcd562d6dc1ccfba52d0115cdca34..505f86c8ca5bb70bebfa050e6270457d05ba3a6d 100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -330,6 +330,12 @@ class Context: public FixedArray {
// Mark the global context with out of memory.
inline void mark_out_of_memory();
+ // The exception holder is the object used as a with object in
+ // the implementation of a catch block.
+ bool is_exception_holder(Object* object) {
+ return IsCatchContext() && extension() == object;
+ }
+
// A global context hold a list of all functions which have been optimized.
void AddOptimizedFunction(JSFunction* function);
void RemoveOptimizedFunction(JSFunction* function);
@@ -349,25 +355,29 @@ class Context: public FixedArray {
#undef GLOBAL_CONTEXT_FIELD_ACCESSORS
// Lookup the the slot called name, starting with the current context.
- // There are three possibilities:
+ // There are 4 possible outcomes:
+ //
+ // 1) index_ >= 0 && result->IsContext():
+ // most common case, the result is a Context, and index is the
+ // context slot index, and the slot exists.
+ // attributes == READ_ONLY for the function name variable, NONE otherwise.
//
- // 1) result->IsContext():
- // The binding was found in a context. *index is always the
- // non-negative slot index. *attributes is NONE for var and let
- // declarations, READ_ONLY for const declarations (never ABSENT).
+ // 2) index_ >= 0 && result->IsJSObject():
+ // the result is the JSObject arguments object, the index is the parameter
+ // index, i.e., key into the arguments object, and the property exists.
+ // attributes != ABSENT.
//
- // 2) result->IsJSObject():
- // The binding was found as a named property in a context extension
- // object (i.e., was introduced via eval), as a property on the subject
- // of with, or as a property of the global object. *index is -1 and
- // *attributes is not ABSENT.
+ // 3) index_ < 0 && result->IsJSObject():
+ // the result is the JSObject extension context or the global object,
+ // and the name is the property name, and the property exists.
+ // attributes != ABSENT.
//
- // 3) result.is_null():
- // There was no binding found, *index is always -1 and *attributes is
- // always ABSENT.
+ // 4) index_ < 0 && result.is_null():
+ // there was no context found with the corresponding property.
+ // attributes == ABSENT.
Handle<Object> Lookup(Handle<String> name,
ContextLookupFlags flags,
- int* index,
+ int* index_,
PropertyAttributes* attributes,
BindingFlags* binding_flags);
« no previous file with comments | « no previous file | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698