V8 Project
contexts.h
Go to the documentation of this file.
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_CONTEXTS_H_
6 #define V8_CONTEXTS_H_
7 
8 #include "src/heap/heap.h"
9 #include "src/objects.h"
10 
11 namespace v8 {
12 namespace internal {
13 
14 
18 
21 };
22 
23 
24 // ES5 10.2 defines lexical environments with mutable and immutable bindings.
25 // Immutable bindings have two states, initialized and uninitialized, and
26 // their state is changed by the InitializeImmutableBinding method. The
27 // BindingFlags enum represents information if a binding has definitely been
28 // initialized. A mutable binding does not need to be checked and thus has
29 // the BindingFlag MUTABLE_IS_INITIALIZED.
30 //
31 // There are two possibilities for immutable bindings
32 // * 'const' declared variables. They are initialized when evaluating the
33 // corresponding declaration statement. They need to be checked for being
34 // initialized and thus get the flag IMMUTABLE_CHECK_INITIALIZED.
35 // * The function name of a named function literal. The binding is immediately
36 // initialized when entering the function and thus does not need to be
37 // checked. it gets the BindingFlag IMMUTABLE_IS_INITIALIZED.
38 // Accessing an uninitialized binding produces the undefined value.
39 //
40 // The harmony proposal for block scoped bindings also introduces the
41 // uninitialized state for mutable bindings.
42 // * A 'let' declared variable. They are initialized when evaluating the
43 // corresponding declaration statement. They need to be checked for being
44 // initialized and thus get the flag MUTABLE_CHECK_INITIALIZED.
45 // * A 'var' declared variable. It is initialized immediately upon creation
46 // and thus doesn't need to be checked. It gets the flag
47 // MUTABLE_IS_INITIALIZED.
48 // * Catch bound variables, function parameters and variables introduced by
49 // function declarations are initialized immediately and do not need to be
50 // checked. Thus they get the flag MUTABLE_IS_INITIALIZED.
51 // Immutable bindings in harmony mode get the _HARMONY flag variants. Accessing
52 // an uninitialized binding produces a reference error.
53 //
54 // In V8 uninitialized bindings are set to the hole value upon creation and set
55 // to a different value upon initialization.
64 };
65 
66 
67 // Heap-allocated activation contexts.
68 //
69 // Contexts are implemented as FixedArray objects; the Context
70 // class is a convenience interface casted on a FixedArray object.
71 //
72 // Note: Context must have no virtual functions and Context objects
73 // must always be allocated via Heap::AllocateContext() or
74 // Factory::NewContext.
75 
76 #define NATIVE_CONTEXT_FIELDS(V) \
77  V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \
78  V(SECURITY_TOKEN_INDEX, Object, security_token) \
79  V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \
80  V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \
81  V(STRING_FUNCTION_INDEX, JSFunction, string_function) \
82  V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \
83  V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \
84  V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \
85  V(INTERNAL_ARRAY_FUNCTION_INDEX, JSFunction, internal_array_function) \
86  V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \
87  V(JS_ARRAY_MAPS_INDEX, Object, js_array_maps) \
88  V(DATE_FUNCTION_INDEX, JSFunction, date_function) \
89  V(JSON_OBJECT_INDEX, JSObject, json_object) \
90  V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \
91  V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \
92  V(INITIAL_ARRAY_PROTOTYPE_INDEX, JSObject, initial_array_prototype) \
93  V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \
94  V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \
95  V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \
96  V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \
97  V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \
98  V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \
99  V(TO_UINT32_FUN_INDEX, JSFunction, to_uint32_fun) \
100  V(TO_INT32_FUN_INDEX, JSFunction, to_int32_fun) \
101  V(GLOBAL_EVAL_FUN_INDEX, JSFunction, global_eval_fun) \
102  V(INSTANTIATE_FUN_INDEX, JSFunction, instantiate_fun) \
103  V(CONFIGURE_INSTANCE_FUN_INDEX, JSFunction, configure_instance_fun) \
104  V(MATH_ABS_FUN_INDEX, JSFunction, math_abs_fun) \
105  V(MATH_ACOS_FUN_INDEX, JSFunction, math_acos_fun) \
106  V(MATH_ASIN_FUN_INDEX, JSFunction, math_asin_fun) \
107  V(MATH_ATAN_FUN_INDEX, JSFunction, math_atan_fun) \
108  V(MATH_ATAN2_FUN_INDEX, JSFunction, math_atan2_fun) \
109  V(MATH_CEIL_FUN_INDEX, JSFunction, math_ceil_fun) \
110  V(MATH_COS_FUN_INDEX, JSFunction, math_cos_fun) \
111  V(MATH_EXP_FUN_INDEX, JSFunction, math_exp_fun) \
112  V(MATH_FLOOR_FUN_INDEX, JSFunction, math_floor_fun) \
113  V(MATH_IMUL_FUN_INDEX, JSFunction, math_imul_fun) \
114  V(MATH_LOG_FUN_INDEX, JSFunction, math_log_fun) \
115  V(MATH_MAX_FUN_INDEX, JSFunction, math_max_fun) \
116  V(MATH_MIN_FUN_INDEX, JSFunction, math_min_fun) \
117  V(MATH_POW_FUN_INDEX, JSFunction, math_pow_fun) \
118  V(MATH_RANDOM_FUN_INDEX, JSFunction, math_random_fun) \
119  V(MATH_ROUND_FUN_INDEX, JSFunction, math_round_fun) \
120  V(MATH_SIN_FUN_INDEX, JSFunction, math_sin_fun) \
121  V(MATH_SQRT_FUN_INDEX, JSFunction, math_sqrt_fun) \
122  V(MATH_TAN_FUN_INDEX, JSFunction, math_tan_fun) \
123  V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun) \
124  V(UINT8_ARRAY_FUN_INDEX, JSFunction, uint8_array_fun) \
125  V(INT8_ARRAY_FUN_INDEX, JSFunction, int8_array_fun) \
126  V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \
127  V(INT16_ARRAY_FUN_INDEX, JSFunction, int16_array_fun) \
128  V(UINT32_ARRAY_FUN_INDEX, JSFunction, uint32_array_fun) \
129  V(INT32_ARRAY_FUN_INDEX, JSFunction, int32_array_fun) \
130  V(FLOAT32_ARRAY_FUN_INDEX, JSFunction, float32_array_fun) \
131  V(FLOAT64_ARRAY_FUN_INDEX, JSFunction, float64_array_fun) \
132  V(UINT8_CLAMPED_ARRAY_FUN_INDEX, JSFunction, uint8_clamped_array_fun) \
133  V(INT8_ARRAY_EXTERNAL_MAP_INDEX, Map, int8_array_external_map) \
134  V(UINT8_ARRAY_EXTERNAL_MAP_INDEX, Map, uint8_array_external_map) \
135  V(INT16_ARRAY_EXTERNAL_MAP_INDEX, Map, int16_array_external_map) \
136  V(UINT16_ARRAY_EXTERNAL_MAP_INDEX, Map, uint16_array_external_map) \
137  V(INT32_ARRAY_EXTERNAL_MAP_INDEX, Map, int32_array_external_map) \
138  V(UINT32_ARRAY_EXTERNAL_MAP_INDEX, Map, uint32_array_external_map) \
139  V(FLOAT32_ARRAY_EXTERNAL_MAP_INDEX, Map, float32_array_external_map) \
140  V(FLOAT64_ARRAY_EXTERNAL_MAP_INDEX, Map, float64_array_external_map) \
141  V(UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX, Map, \
142  uint8_clamped_array_external_map) \
143  V(DATA_VIEW_FUN_INDEX, JSFunction, data_view_fun) \
144  V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
145  V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
146  sloppy_function_with_readonly_prototype_map) \
147  V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \
148  V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
149  sloppy_function_without_prototype_map) \
150  V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
151  strict_function_without_prototype_map) \
152  V(BOUND_FUNCTION_MAP_INDEX, Map, bound_function_map) \
153  V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \
154  V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \
155  V(ALIASED_ARGUMENTS_MAP_INDEX, Map, aliased_arguments_map) \
156  V(STRICT_ARGUMENTS_MAP_INDEX, Map, strict_arguments_map) \
157  V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \
158  V(MAKE_MESSAGE_FUN_INDEX, JSFunction, make_message_fun) \
159  V(GET_STACK_TRACE_LINE_INDEX, JSFunction, get_stack_trace_line_fun) \
160  V(CONFIGURE_GLOBAL_INDEX, JSFunction, configure_global_fun) \
161  V(FUNCTION_CACHE_INDEX, JSObject, function_cache) \
162  V(JSFUNCTION_RESULT_CACHES_INDEX, FixedArray, jsfunction_result_caches) \
163  V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \
164  V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \
165  V(CALL_AS_FUNCTION_DELEGATE_INDEX, JSFunction, call_as_function_delegate) \
166  V(CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, JSFunction, \
167  call_as_constructor_delegate) \
168  V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \
169  V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \
170  V(CONTEXT_EXTENSION_FUNCTION_INDEX, JSFunction, context_extension_function) \
171  V(MAP_CACHE_INDEX, Object, map_cache) \
172  V(EMBEDDER_DATA_INDEX, FixedArray, embedder_data) \
173  V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \
174  V(ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX, Object, \
175  error_message_for_code_gen_from_strings) \
176  V(IS_PROMISE_INDEX, JSFunction, is_promise) \
177  V(PROMISE_CREATE_INDEX, JSFunction, promise_create) \
178  V(PROMISE_RESOLVE_INDEX, JSFunction, promise_resolve) \
179  V(PROMISE_REJECT_INDEX, JSFunction, promise_reject) \
180  V(PROMISE_CHAIN_INDEX, JSFunction, promise_chain) \
181  V(PROMISE_CATCH_INDEX, JSFunction, promise_catch) \
182  V(PROMISE_THEN_INDEX, JSFunction, promise_then) \
183  V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \
184  to_complete_property_descriptor) \
185  V(DERIVED_HAS_TRAP_INDEX, JSFunction, derived_has_trap) \
186  V(DERIVED_GET_TRAP_INDEX, JSFunction, derived_get_trap) \
187  V(DERIVED_SET_TRAP_INDEX, JSFunction, derived_set_trap) \
188  V(PROXY_ENUMERATE_INDEX, JSFunction, proxy_enumerate) \
189  V(OBSERVERS_NOTIFY_CHANGE_INDEX, JSFunction, observers_notify_change) \
190  V(OBSERVERS_ENQUEUE_SPLICE_INDEX, JSFunction, observers_enqueue_splice) \
191  V(OBSERVERS_BEGIN_SPLICE_INDEX, JSFunction, observers_begin_perform_splice) \
192  V(OBSERVERS_END_SPLICE_INDEX, JSFunction, observers_end_perform_splice) \
193  V(NATIVE_OBJECT_OBSERVE_INDEX, JSFunction, native_object_observe) \
194  V(NATIVE_OBJECT_GET_NOTIFIER_INDEX, JSFunction, native_object_get_notifier) \
195  V(NATIVE_OBJECT_NOTIFIER_PERFORM_CHANGE, JSFunction, \
196  native_object_notifier_perform_change) \
197  V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \
198  V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \
199  V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, generator_object_prototype_map) \
200  V(ITERATOR_RESULT_MAP_INDEX, Map, iterator_result_map) \
201  V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \
202  V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \
203  V(ITERATOR_SYMBOL_INDEX, Symbol, iterator_symbol) \
204  V(UNSCOPABLES_SYMBOL_INDEX, Symbol, unscopables_symbol) \
205  V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator)
206 
207 // JSFunctions are pairs (context, function code), sometimes also called
208 // closures. A Context object is used to represent function contexts and
209 // dynamically pushed 'with' contexts (or 'scopes' in ECMA-262 speak).
210 //
211 // At runtime, the contexts build a stack in parallel to the execution
212 // stack, with the top-most context being the current context. All contexts
213 // have the following slots:
214 //
215 // [ closure ] This is the current function. It is the same for all
216 // contexts inside a function. It provides access to the
217 // incoming context (i.e., the outer context, which may
218 // or may not become the current function's context), and
219 // it provides access to the functions code and thus it's
220 // scope information, which in turn contains the names of
221 // statically allocated context slots. The names are needed
222 // for dynamic lookups in the presence of 'with' or 'eval'.
223 //
224 // [ previous ] A pointer to the previous context. It is NULL for
225 // function contexts, and non-NULL for 'with' contexts.
226 // Used to implement the 'with' statement.
227 //
228 // [ extension ] A pointer to an extension JSObject, or NULL. Used to
229 // implement 'with' statements and dynamic declarations
230 // (through 'eval'). The object in a 'with' statement is
231 // stored in the extension slot of a 'with' context.
232 // Dynamically declared variables/functions are also added
233 // to lazily allocated extension object. Context::Lookup
234 // searches the extension object for properties.
235 // For global and block contexts, contains the respective
236 // ScopeInfo.
237 // For module contexts, points back to the respective JSModule.
238 //
239 // [ global_object ] A pointer to the global object. Provided for quick
240 // access to the global object from inside the code (since
241 // we always have a context pointer).
242 //
243 // In addition, function contexts may have statically allocated context slots
244 // to store local variables/functions that are accessed from inner functions
245 // (via static context addresses) or through 'eval' (dynamic context lookups).
246 // The native context contains additional slots for fast access to native
247 // properties.
248 //
249 // Finally, with Harmony scoping, the JSFunction representing a top level
250 // script will have the GlobalContext rather than a FunctionContext.
251 
252 class Context: public FixedArray {
253  public:
254  // Conversions.
255  static Context* cast(Object* context) {
256  DCHECK(context->IsContext());
257  return reinterpret_cast<Context*>(context);
258  }
259 
260  // The default context slot layout; indices are FixedArray slot indices.
261  enum {
262  // These slots are in all contexts.
265  // The extension slot is used for either the global object (in global
266  // contexts), eval extension object (function contexts), subject of with
267  // (with contexts), or the variable name (catch contexts), the serialized
268  // scope info (block contexts), or the module instance (module contexts).
272 
273  // This slot holds the thrown value in catch contexts.
275 
276  // These slots are only in native contexts.
401 
402  // Properties from here are treated as weak references by the full GC.
403  // Scavenge treats them as strong references.
407  MAP_CACHE_INDEX, // Weak.
409 
410  // Total number of slots.
413  };
414 
415  // Direct slot access.
416  JSFunction* closure() { return JSFunction::cast(get(CLOSURE_INDEX)); }
418 
420  Object* result = unchecked_previous();
421  DCHECK(IsBootstrappingOrValidParentContext(result, this));
422  return reinterpret_cast<Context*>(result);
423  }
424  void set_previous(Context* context) { set(PREVIOUS_INDEX, context); }
425 
426  bool has_extension() { return extension() != NULL; }
428  void set_extension(Object* object) { set(EXTENSION_INDEX, object); }
429 
430  JSModule* module() { return JSModule::cast(get(EXTENSION_INDEX)); }
432 
433  // Get the context where var declarations will be hoisted to, which
434  // may be the context itself.
436 
438  Object* result = get(GLOBAL_OBJECT_INDEX);
439  DCHECK(IsBootstrappingOrGlobalObject(this->GetIsolate(), result));
440  return reinterpret_cast<GlobalObject*>(result);
441  }
443  set(GLOBAL_OBJECT_INDEX, object);
444  }
445 
446  // Returns a JSGlobalProxy object or null.
448  void set_global_proxy(JSObject* global);
449 
450  // The builtins object.
452 
453  // Get the innermost global context by traversing the context chain.
455 
456  // Compute the native context by traversing the context chain.
458 
459  // Predicates for context types. IsNativeContext is also defined on Object
460  // because we frequently have to know if arbitrary objects are natives
461  // contexts.
463  Map* map = this->map();
464  return map == map->GetHeap()->native_context_map();
465  }
467  Map* map = this->map();
468  return map == map->GetHeap()->function_context_map();
469  }
470  bool IsCatchContext() {
471  Map* map = this->map();
472  return map == map->GetHeap()->catch_context_map();
473  }
474  bool IsWithContext() {
475  Map* map = this->map();
476  return map == map->GetHeap()->with_context_map();
477  }
478  bool IsBlockContext() {
479  Map* map = this->map();
480  return map == map->GetHeap()->block_context_map();
481  }
483  Map* map = this->map();
484  return map == map->GetHeap()->module_context_map();
485  }
487  Map* map = this->map();
488  return map == map->GetHeap()->global_context_map();
489  }
490 
492  return this->global_object()->native_context()->security_token() ==
493  that->global_object()->native_context()->security_token();
494  }
495 
496  // A native context holds a list of all functions with optimized code.
497  void AddOptimizedFunction(JSFunction* function);
498  void RemoveOptimizedFunction(JSFunction* function);
501 
502  // The native context also stores a list of all optimized code and a
503  // list of all deoptimized code, which are needed by the deoptimizer.
504  void AddOptimizedCode(Code* code);
505  void SetOptimizedCodeListHead(Object* head);
509 
511 
512 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \
513  void set_##name(type* value) { \
514  DCHECK(IsNativeContext()); \
515  set(index, value); \
516  } \
517  bool is_##name(type* value) { \
518  DCHECK(IsNativeContext()); \
519  return type::cast(get(index)) == value; \
520  } \
521  type* name() { \
522  DCHECK(IsNativeContext()); \
523  return type::cast(get(index)); \
524  }
526 #undef NATIVE_CONTEXT_FIELD_ACCESSORS
527 
528  // Lookup the slot called name, starting with the current context.
529  // There are three possibilities:
530  //
531  // 1) result->IsContext():
532  // The binding was found in a context. *index is always the
533  // non-negative slot index. *attributes is NONE for var and let
534  // declarations, READ_ONLY for const declarations (never ABSENT).
535  //
536  // 2) result->IsJSObject():
537  // The binding was found as a named property in a context extension
538  // object (i.e., was introduced via eval), as a property on the subject
539  // of with, or as a property of the global object. *index is -1 and
540  // *attributes is not ABSENT.
541  //
542  // 3) result.is_null():
543  // There was no binding found, *index is always -1 and *attributes is
544  // always ABSENT.
545  Handle<Object> Lookup(Handle<String> name,
547  int* index,
548  PropertyAttributes* attributes,
549  BindingFlags* binding_flags);
550 
551  // Code generation support.
552  static int SlotOffset(int index) {
553  return kHeaderSize + index * kPointerSize - kHeapObjectTag;
554  }
555 
556  static int FunctionMapIndex(StrictMode strict_mode, FunctionKind kind) {
557  if (IsGeneratorFunction(kind)) {
558  return strict_mode == SLOPPY ? SLOPPY_GENERATOR_FUNCTION_MAP_INDEX
560  }
561 
562  if (IsArrowFunction(kind) || IsConciseMethod(kind)) {
563  return strict_mode == SLOPPY
566  }
567 
568  return strict_mode == SLOPPY ? SLOPPY_FUNCTION_MAP_INDEX
570  }
571 
573 
574  // GC support.
575  typedef FixedBodyDescriptor<
577 
578  typedef FixedBodyDescriptor<
579  kHeaderSize,
582 
583  private:
584  // Unchecked access to the slots.
586 
587 #ifdef DEBUG
588  // Bootstrapping-aware type checks.
589  static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid);
590  static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object);
591 #endif
592 
595 };
596 
597 } } // namespace v8::internal
598 
599 #endif // V8_CONTEXTS_H_
Object * OptimizedCodeListHead()
Definition: contexts.cc:369
JSObject * global_proxy()
Definition: contexts.cc:64
void set_global_proxy(JSObject *global)
Definition: contexts.cc:69
static int FunctionMapIndex(StrictMode strict_mode, FunctionKind kind)
Definition: contexts.h:556
Object * OptimizedFunctionsListHead()
Definition: contexts.cc:348
static Context * cast(Object *context)
Definition: contexts.h:255
void AddOptimizedCode(Code *code)
Definition: contexts.cc:354
@ CONTEXT_EXTENSION_FUNCTION_INDEX
Definition: contexts.h:366
@ UINT8_CLAMPED_ARRAY_EXTERNAL_MAP_INDEX
Definition: contexts.h:352
@ SLOPPY_GENERATOR_FUNCTION_MAP_INDEX
Definition: contexts.h:392
@ ERROR_MESSAGE_FOR_CODE_GEN_FROM_STRINGS_INDEX
Definition: contexts.h:370
@ STRING_FUNCTION_PROTOTYPE_MAP_INDEX
Definition: contexts.h:294
@ STRICT_GENERATOR_FUNCTION_MAP_INDEX
Definition: contexts.h:393
@ GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX
Definition: contexts.h:394
@ SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX
Definition: contexts.h:284
@ STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX
Definition: contexts.h:287
@ TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX
Definition: contexts.h:380
@ ALLOW_CODE_GEN_FROM_STRINGS_INDEX
Definition: contexts.h:369
@ NATIVE_OBJECT_NOTIFIER_PERFORM_CHANGE
Definition: contexts.h:391
@ CALL_AS_CONSTRUCTOR_DELEGATE_INDEX
Definition: contexts.h:363
@ NATIVE_OBJECT_GET_NOTIFIER_INDEX
Definition: contexts.h:390
@ SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX
Definition: contexts.h:286
@ FLOAT32_ARRAY_EXTERNAL_MAP_INDEX
Definition: contexts.h:350
@ FLOAT64_ARRAY_EXTERNAL_MAP_INDEX
Definition: contexts.h:351
STATIC_ASSERT(EMBEDDER_DATA_INDEX==Internals::kContextEmbedderDataIndex)
Object * extension()
Definition: contexts.h:427
void set_global_object(GlobalObject *object)
Definition: contexts.h:442
void set_previous(Context *context)
Definition: contexts.h:424
static const int kSize
Definition: contexts.h:572
Object * unchecked_previous()
Definition: contexts.h:585
void set_extension(Object *object)
Definition: contexts.h:428
FixedBodyDescriptor< kHeaderSize, kSize, kSize > ScavengeBodyDescriptor
Definition: contexts.h:576
Context * previous()
Definition: contexts.h:419
void SetOptimizedCodeListHead(Object *head)
Definition: contexts.cc:363
Handle< Object > ErrorMessageForCodeGenerationFromStrings()
Definition: contexts.cc:387
Handle< Object > Lookup(Handle< String > name, ContextLookupFlags flags, int *index, PropertyAttributes *attributes, BindingFlags *binding_flags)
Definition: contexts.cc:106
Context * native_context()
Definition: contexts.cc:44
void SetOptimizedFunctionsListHead(Object *head)
Definition: contexts.cc:342
JSBuiltinsObject * builtins()
Definition: contexts.cc:24
void set_module(JSModule *module)
Definition: contexts.h:431
Context * global_context()
Definition: contexts.cc:35
void AddOptimizedFunction(JSFunction *function)
Definition: contexts.cc:280
static int SlotOffset(int index)
Definition: contexts.h:552
bool HasSameSecurityTokenAs(Context *that)
Definition: contexts.h:491
void RemoveOptimizedFunction(JSFunction *function)
Definition: contexts.cc:318
STATIC_ASSERT(kHeaderSize==Internals::kContextHeaderSize)
Object * DeoptimizedCodeListHead()
Definition: contexts.cc:381
GlobalObject * global_object()
Definition: contexts.h:437
JSModule * module()
Definition: contexts.h:430
bool IsFunctionContext()
Definition: contexts.h:466
FixedBodyDescriptor< kHeaderSize, kHeaderSize+FIRST_WEAK_SLOT *kPointerSize, kSize > MarkCompactBodyDescriptor
Definition: contexts.h:581
void set_closure(JSFunction *closure)
Definition: contexts.h:417
Context * declaration_context()
Definition: contexts.cc:14
void SetDeoptimizedCodeListHead(Object *head)
Definition: contexts.cc:375
JSFunction * closure()
Definition: contexts.h:416
static const int kHeaderSize
Definition: objects.h:2393
Object * get(int index)
Definition: objects-inl.h:2165
void set(int index, Object *value)
Definition: objects-inl.h:2190
Heap * GetHeap() const
Definition: objects-inl.h:1379
Isolate * GetIsolate() const
Definition: objects-inl.h:1387
static const int kContextHeaderSize
Definition: v8.h:5828
static const int kContextEmbedderDataIndex
Definition: v8.h:5829
#define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name)
Definition: contexts.h:512
#define NATIVE_CONTEXT_FIELDS(V)
Definition: contexts.h:76
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
Definition: logging.h:205
const int kPointerSize
Definition: globals.h:129
bool IsArrowFunction(FunctionKind kind)
Definition: globals.h:793
@ IMMUTABLE_CHECK_INITIALIZED
Definition: contexts.h:60
@ MUTABLE_IS_INITIALIZED
Definition: contexts.h:57
@ MISSING_BINDING
Definition: contexts.h:63
@ IMMUTABLE_CHECK_INITIALIZED_HARMONY
Definition: contexts.h:62
@ MUTABLE_CHECK_INITIALIZED
Definition: contexts.h:58
@ IMMUTABLE_IS_INITIALIZED_HARMONY
Definition: contexts.h:61
@ IMMUTABLE_IS_INITIALIZED
Definition: contexts.h:59
bool IsGeneratorFunction(FunctionKind kind)
Definition: globals.h:799
bool IsConciseMethod(FunctionKind kind)
Definition: globals.h:805
const int kHeapObjectTag
Definition: v8.h:5737
ContextLookupFlags
Definition: contexts.h:15
@ FOLLOW_CONTEXT_CHAIN
Definition: contexts.h:16
@ DONT_FOLLOW_CHAINS
Definition: contexts.h:19
@ FOLLOW_CHAINS
Definition: contexts.h:20
@ FOLLOW_PROTOTYPE_CHAIN
Definition: contexts.h:17
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
PropertyAttributes