26 if (object->IsJSGlobalObject()) {
27 return JSGlobalObject::cast(
object)->builtins();
29 DCHECK(object->IsJSBuiltinsObject());
30 return JSBuiltinsObject::cast(
object);
79 Isolate* isolate = it->isolate();
91 if (!maybe_unscopables.ToHandle(&unscopables)) {
94 if (!unscopables->IsSpecObject())
return attrs;
119 if (FLAG_trace_contexts) {
120 PrintF(
"Context::Lookup(");
126 if (FLAG_trace_contexts) {
127 PrintF(
" - looking in context %p",
reinterpret_cast<void*
>(*context));
128 if (context->IsNativeContext())
PrintF(
" (native context)");
133 if (context->IsNativeContext() ||
134 context->IsWithContext() ||
135 (context->IsFunctionContext() && context->has_extension())) {
137 JSReceiver::cast(context->extension()), isolate);
143 object->IsJSContextExtensionObject()) {
145 }
else if (context->IsWithContext()) {
154 *attributes =
maybe.value;
157 if (FLAG_trace_contexts) {
158 PrintF(
"=> found property in context object %p\n",
159 reinterpret_cast<void*
>(*
object));
166 if (context->IsFunctionContext() || context->IsBlockContext()) {
170 if (context->IsFunctionContext()) {
172 context->closure()->shared()->scope_info(), isolate);
175 ScopeInfo::cast(context->extension()), isolate);
183 scope_info,
name, &
mode, &init_flag, &maybe_assigned_flag);
185 if (slot_index >= 0) {
186 if (FLAG_trace_contexts) {
187 PrintF(
"=> found local in context slot %d (mode = %d)\n",
235 if (follow_context_chain && context->IsFunctionContext()) {
237 int function_index = scope_info->FunctionContextSlotIndex(*
name, &
mode);
238 if (function_index >= 0) {
239 if (FLAG_trace_contexts) {
240 PrintF(
"=> found intermediate function in context slot %d\n",
243 *index = function_index;
252 }
else if (context->IsCatchContext()) {
255 if (FLAG_trace_contexts) {
256 PrintF(
"=> found in catch context\n");
266 if (context->IsNativeContext()) {
267 follow_context_chain =
false;
271 }
while (follow_context_chain);
273 if (FLAG_trace_contexts) {
274 PrintF(
"=> no property/slot found\n");
282 #ifdef ENABLE_SLOW_DCHECKS
285 while (!element->IsUndefined()) {
286 CHECK(element !=
function);
287 element = JSFunction::cast(element)->next_function_link();
294 while (!context->IsUndefined()) {
295 if (context ==
this) {
306 if (!function->next_function_link()->IsUndefined()) {
311 DCHECK(function->next_function_link()->IsUndefined());
322 while (!element->IsUndefined()) {
323 JSFunction* element_function = JSFunction::cast(element);
324 DCHECK(element_function->next_function_link()->IsUndefined() ||
325 element_function->next_function_link()->IsJSFunction());
326 if (element_function ==
function) {
330 prev->set_next_function_link(element_function->next_function_link());
332 element_function->set_next_function_link(
GetHeap()->undefined_value());
335 prev = element_function;
336 element = element_function->next_function_link();
356 DCHECK(code->
kind() == Code::OPTIMIZED_FUNCTION);
357 DCHECK(code->next_code_link()->IsUndefined());
389 Handle<Object> result(error_message_for_code_gen_from_strings(), isolate);
390 if (!result->IsUndefined())
return result;
391 return isolate->
factory()->NewStringFromStaticChars(
392 "Code generation from strings disallowed for this context");
397 bool Context::IsBootstrappingOrValidParentContext(
402 if (!object->IsContext())
return false;
409 bool Context::IsBootstrappingOrGlobalObject(
Isolate* isolate,
Object*
object) {
413 isolate->bootstrapper()->IsActive() ||
414 object->IsGlobalObject();
Isolate represents an isolated instance of the V8 engine.
A JavaScript object (ECMA-262, 4.3.3)
void EvictCandidate(SharedFunctionInfo *shared_info)
Object * OptimizedCodeListHead()
JSObject * global_proxy()
void set_global_proxy(JSObject *global)
Object * OptimizedFunctionsListHead()
static Context * cast(Object *context)
void AddOptimizedCode(Code *code)
@ OPTIMIZED_FUNCTIONS_LIST
void SetOptimizedCodeListHead(Object *head)
Handle< Object > ErrorMessageForCodeGenerationFromStrings()
Handle< Object > Lookup(Handle< String > name, ContextLookupFlags flags, int *index, PropertyAttributes *attributes, BindingFlags *binding_flags)
Context * native_context()
void SetOptimizedFunctionsListHead(Object *head)
JSBuiltinsObject * builtins()
Context * global_context()
void AddOptimizedFunction(JSFunction *function)
void RemoveOptimizedFunction(JSFunction *function)
Object * DeoptimizedCodeListHead()
GlobalObject * global_object()
Context * declaration_context()
void SetDeoptimizedCodeListHead(Object *head)
void set(int index, Object *value)
static Handle< T > null()
Isolate * GetIsolate() const
Object * native_contexts_list() const
MarkCompactCollector * mark_compact_collector()
Handle< Context > native_context()
Bootstrapper * bootstrapper()
bool has_pending_exception()
static MUST_USE_RESULT Maybe< PropertyAttributes > GetPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
static MUST_USE_RESULT Maybe< PropertyAttributes > GetOwnPropertyAttributes(Handle< JSReceiver > object, Handle< Name > name)
static MUST_USE_RESULT Maybe< bool > HasProperty(Handle< JSReceiver > object, Handle< Name > name)
CodeFlusher * code_flusher()
friend class LookupIterator
static MUST_USE_RESULT MaybeHandle< Object > GetProperty(LookupIterator *it)
static int ContextSlotIndex(Handle< ScopeInfo > scope_info, Handle< String > name, VariableMode *mode, InitializationFlag *init_flag, MaybeAssignedFlag *maybe_assigned_flag)
bool Equals(String *other)
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 mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
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)
@ IMMUTABLE_CHECK_INITIALIZED
@ IMMUTABLE_CHECK_INITIALIZED_HARMONY
@ MUTABLE_CHECK_INITIALIZED
@ IMMUTABLE_IS_INITIALIZED_HARMONY
@ IMMUTABLE_IS_INITIALIZED
Handle< T > handle(T *t, Isolate *isolate)
const bool FLAG_enable_slow_asserts
void PrintF(const char *format,...)
static Maybe< PropertyAttributes > UnscopableLookup(LookupIterator *it)
Lookups a property in an object environment, taking the unscopables into account.
Debugger support for the V8 JavaScript engine.
A simple Maybe type, representing an object which may or may not have a value.