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

Side by Side Diff: src/contexts.h

Issue 1484723003: [runtime] Use "the hole" instead of smi 0 as sentinel for context extension. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 years 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
« no previous file with comments | « src/compiler/typer.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_CONTEXTS_H_ 5 #ifndef V8_CONTEXTS_H_
6 #define V8_CONTEXTS_H_ 6 #define V8_CONTEXTS_H_
7 7
8 #include "src/heap/heap.h" 8 #include "src/heap/heap.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 10
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // or may not become the current function's context), and 320 // or may not become the current function's context), and
321 // it provides access to the functions code and thus it's 321 // it provides access to the functions code and thus it's
322 // scope information, which in turn contains the names of 322 // scope information, which in turn contains the names of
323 // statically allocated context slots. The names are needed 323 // statically allocated context slots. The names are needed
324 // for dynamic lookups in the presence of 'with' or 'eval'. 324 // for dynamic lookups in the presence of 'with' or 'eval'.
325 // 325 //
326 // [ previous ] A pointer to the previous context. It is NULL for 326 // [ previous ] A pointer to the previous context. It is NULL for
327 // function contexts, and non-NULL for 'with' contexts. 327 // function contexts, and non-NULL for 'with' contexts.
328 // Used to implement the 'with' statement. 328 // Used to implement the 'with' statement.
329 // 329 //
330 // [ extension ] A pointer to an extension JSObject, or NULL. Used to 330 // [ extension ] A pointer to an extension JSObject, or "the hole". Used to
331 // implement 'with' statements and dynamic declarations 331 // implement 'with' statements and dynamic declarations
332 // (through 'eval'). The object in a 'with' statement is 332 // (through 'eval'). The object in a 'with' statement is
333 // stored in the extension slot of a 'with' context. 333 // stored in the extension slot of a 'with' context.
334 // Dynamically declared variables/functions are also added 334 // Dynamically declared variables/functions are also added
335 // to lazily allocated extension object. Context::Lookup 335 // to lazily allocated extension object. Context::Lookup
336 // searches the extension object for properties. 336 // searches the extension object for properties.
337 // For script and block contexts, contains the respective 337 // For script and block contexts, contains the respective
338 // ScopeInfo. For block contexts representing sloppy declaration 338 // ScopeInfo. For block contexts representing sloppy declaration
339 // block scopes, it may also be a struct being a 339 // block scopes, it may also be a struct being a
340 // SloppyBlockWithEvalContextExtension, pairing the ScopeInfo 340 // SloppyBlockWithEvalContextExtension, pairing the ScopeInfo
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 int GetErrorsThrown(); 398 int GetErrorsThrown();
399 399
400 // Direct slot access. 400 // Direct slot access.
401 inline JSFunction* closure(); 401 inline JSFunction* closure();
402 inline void set_closure(JSFunction* closure); 402 inline void set_closure(JSFunction* closure);
403 403
404 inline Context* previous(); 404 inline Context* previous();
405 inline void set_previous(Context* context); 405 inline void set_previous(Context* context);
406 406
407 inline bool has_extension(); 407 inline bool has_extension();
408 inline Object* extension(); 408 inline HeapObject* extension();
409 inline void set_extension(Object* object); 409 inline void set_extension(HeapObject* object);
410 JSObject* extension_object(); 410 JSObject* extension_object();
411 JSReceiver* extension_receiver(); 411 JSReceiver* extension_receiver();
412 ScopeInfo* scope_info(); 412 ScopeInfo* scope_info();
413 String* catch_name(); 413 String* catch_name();
414 414
415 inline JSModule* module(); 415 inline JSModule* module();
416 inline void set_module(JSModule* module); 416 inline void set_module(JSModule* module);
417 417
418 // Get the context where var declarations will be hoisted to, which 418 // Get the context where var declarations will be hoisted to, which
419 // may be the context itself. 419 // may be the context itself.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 #endif 552 #endif
553 553
554 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); 554 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize);
555 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); 555 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
556 }; 556 };
557 557
558 } // namespace internal 558 } // namespace internal
559 } // namespace v8 559 } // namespace v8
560 560
561 #endif // V8_CONTEXTS_H_ 561 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/compiler/typer.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698