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

Side by Side Diff: src/contexts.h

Issue 7671042: Temporal dead zone behaviour for let bindings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Bailout in hydrogen and X64 and ARM code. 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 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 26 matching lines...) Expand all
37 37
38 enum ContextLookupFlags { 38 enum ContextLookupFlags {
39 FOLLOW_CONTEXT_CHAIN = 1, 39 FOLLOW_CONTEXT_CHAIN = 1,
40 FOLLOW_PROTOTYPE_CHAIN = 2, 40 FOLLOW_PROTOTYPE_CHAIN = 2,
41 41
42 DONT_FOLLOW_CHAINS = 0, 42 DONT_FOLLOW_CHAINS = 0,
43 FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN 43 FOLLOW_CHAINS = FOLLOW_CONTEXT_CHAIN | FOLLOW_PROTOTYPE_CHAIN
44 }; 44 };
45 45
46 46
47 // ES5 10.2 defines lexical environments with mutable and immutable bindings.
48 // Immutable bindings have two states, initialized and uninitialized, and
49 // their state is changed by the InitializeImmutableBinding method.
50 //
51 // The harmony proposal for block scoped bindings also introduces the
52 // uninitialized state for mutable bindings. A 'let' declared variable
53 // is a mutable binding that is created uninitalized upon activation of its
54 // lexical environment and it is initialized when evaluating its declaration
55 // statement. Var declared variables are mutable bindings that are
56 // immediately initialized upon creation. The BindingFlags enum represents
57 // information if a binding has definitely been initialized. 'const' declared
58 // variables are created as uninitialized immutable bindings.
59
60 // In harmony mode accessing an uninitialized binding produces a reference
61 // error.
62 enum BindingFlags {
63 MUTABLE_IS_INITIALIZED,
64 MUTABLE_CHECK_INITIALIZED,
65 IMMUTABLE_IS_INITIALIZED,
66 IMMUTABLE_CHECK_INITIALIZED,
67 MISSING_BINDING
68 };
69
70
47 // Heap-allocated activation contexts. 71 // Heap-allocated activation contexts.
48 // 72 //
49 // Contexts are implemented as FixedArray objects; the Context 73 // Contexts are implemented as FixedArray objects; the Context
50 // class is a convenience interface casted on a FixedArray object. 74 // class is a convenience interface casted on a FixedArray object.
51 // 75 //
52 // Note: Context must have no virtual functions and Context objects 76 // Note: Context must have no virtual functions and Context objects
53 // must always be allocated via Heap::AllocateContext() or 77 // must always be allocated via Heap::AllocateContext() or
54 // Factory::NewContext. 78 // Factory::NewContext.
55 79
56 #define GLOBAL_CONTEXT_FIELDS(V) \ 80 #define GLOBAL_CONTEXT_FIELDS(V) \
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 // attributes != ABSENT. 368 // attributes != ABSENT.
345 // 369 //
346 // 3) index_ < 0 && result->IsJSObject(): 370 // 3) index_ < 0 && result->IsJSObject():
347 // the result is the JSObject extension context or the global object, 371 // the result is the JSObject extension context or the global object,
348 // and the name is the property name, and the property exists. 372 // and the name is the property name, and the property exists.
349 // attributes != ABSENT. 373 // attributes != ABSENT.
350 // 374 //
351 // 4) index_ < 0 && result.is_null(): 375 // 4) index_ < 0 && result.is_null():
352 // there was no context found with the corresponding property. 376 // there was no context found with the corresponding property.
353 // attributes == ABSENT. 377 // attributes == ABSENT.
354 Handle<Object> Lookup(Handle<String> name, ContextLookupFlags flags, 378 Handle<Object> Lookup(Handle<String> name,
355 int* index_, PropertyAttributes* attributes); 379 ContextLookupFlags flags,
380 int* index_,
381 PropertyAttributes* attributes,
382 BindingFlags* binding_flags);
356 383
357 // Determine if a local variable with the given name exists in a 384 // Determine if a local variable with the given name exists in a
358 // context. Do not consider context extension objects. This is 385 // context. Do not consider context extension objects. This is
359 // used for compiling code using eval. If the context surrounding 386 // used for compiling code using eval. If the context surrounding
360 // the eval call does not have a local variable with this name and 387 // the eval call does not have a local variable with this name and
361 // does not contain a with statement the property is global unless 388 // does not contain a with statement the property is global unless
362 // it is shadowed by a property in an extension object introduced by 389 // it is shadowed by a property in an extension object introduced by
363 // eval. 390 // eval.
364 bool GlobalIfNotShadowedByEval(Handle<String> name); 391 bool GlobalIfNotShadowedByEval(Handle<String> name);
365 392
(...skipping 25 matching lines...) Expand all
391 #ifdef DEBUG 418 #ifdef DEBUG
392 // Bootstrapping-aware type checks. 419 // Bootstrapping-aware type checks.
393 static bool IsBootstrappingOrContext(Object* object); 420 static bool IsBootstrappingOrContext(Object* object);
394 static bool IsBootstrappingOrGlobalObject(Object* object); 421 static bool IsBootstrappingOrGlobalObject(Object* object);
395 #endif 422 #endif
396 }; 423 };
397 424
398 } } // namespace v8::internal 425 } } // namespace v8::internal
399 426
400 #endif // V8_CONTEXTS_H_ 427 #endif // V8_CONTEXTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698