blob: 30c474d5fff58fd8130f5bc00d58c89f78f1438c [file] [log] [blame]
Ben Murdoch257744e2011-11-30 15:57:28 +00001// Copyright 2011 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Steve Blocka7e24c12009-10-30 11:49:00 +00004
Ben Murdochb8a8cc12014-11-26 15:28:44 +00005#include "src/v8.h"
Steve Blocka7e24c12009-10-30 11:49:00 +00006
Ben Murdochb8a8cc12014-11-26 15:28:44 +00007#include "src/bootstrapper.h"
8#include "src/debug.h"
9#include "src/scopeinfo.h"
Steve Blocka7e24c12009-10-30 11:49:00 +000010
11namespace v8 {
12namespace internal {
13
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000014Context* Context::declaration_context() {
15 Context* current = this;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000016 while (!current->IsFunctionContext() && !current->IsNativeContext()) {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000017 current = current->previous();
Ben Murdochb8a8cc12014-11-26 15:28:44 +000018 DCHECK(current->closure() == closure());
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000019 }
20 return current;
21}
22
23
Steve Blocka7e24c12009-10-30 11:49:00 +000024JSBuiltinsObject* Context::builtins() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000025 GlobalObject* object = global_object();
Steve Blocka7e24c12009-10-30 11:49:00 +000026 if (object->IsJSGlobalObject()) {
27 return JSGlobalObject::cast(object)->builtins();
28 } else {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000029 DCHECK(object->IsJSBuiltinsObject());
Steve Blocka7e24c12009-10-30 11:49:00 +000030 return JSBuiltinsObject::cast(object);
31 }
32}
33
34
35Context* Context::global_context() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000036 Context* current = this;
37 while (!current->IsGlobalContext()) {
38 current = current->previous();
39 }
40 return current;
41}
42
43
44Context* Context::native_context() {
Steve Blocka7e24c12009-10-30 11:49:00 +000045 // Fast case: the global object for this context has been set. In
46 // that case, the global object has a direct pointer to the global
47 // context.
Ben Murdochb8a8cc12014-11-26 15:28:44 +000048 if (global_object()->IsGlobalObject()) {
49 return global_object()->native_context();
Steve Blocka7e24c12009-10-30 11:49:00 +000050 }
Leon Clarkee46be812010-01-19 14:06:41 +000051
Steve Blocka7e24c12009-10-30 11:49:00 +000052 // During bootstrapping, the global object might not be set and we
Ben Murdochb8a8cc12014-11-26 15:28:44 +000053 // have to search the context chain to find the native context.
54 DCHECK(this->GetIsolate()->bootstrapper()->IsActive());
Steve Blocka7e24c12009-10-30 11:49:00 +000055 Context* current = this;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000056 while (!current->IsNativeContext()) {
Leon Clarkee46be812010-01-19 14:06:41 +000057 JSFunction* closure = JSFunction::cast(current->closure());
58 current = Context::cast(closure->context());
Steve Blocka7e24c12009-10-30 11:49:00 +000059 }
60 return current;
61}
62
63
64JSObject* Context::global_proxy() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000065 return native_context()->global_proxy_object();
Steve Blocka7e24c12009-10-30 11:49:00 +000066}
67
Ben Murdochb8a8cc12014-11-26 15:28:44 +000068
Steve Blocka7e24c12009-10-30 11:49:00 +000069void Context::set_global_proxy(JSObject* object) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000070 native_context()->set_global_proxy_object(object);
71}
72
73
74/**
75 * Lookups a property in an object environment, taking the unscopables into
76 * account. This is used For HasBinding spec algorithms for ObjectEnvironment.
77 */
78static Maybe<PropertyAttributes> UnscopableLookup(LookupIterator* it) {
79 Isolate* isolate = it->isolate();
80
81 Maybe<PropertyAttributes> attrs = JSReceiver::GetPropertyAttributes(it);
82 DCHECK(attrs.has_value || isolate->has_pending_exception());
83 if (!attrs.has_value || attrs.value == ABSENT) return attrs;
84
85 Handle<Symbol> unscopables_symbol(
86 isolate->native_context()->unscopables_symbol(), isolate);
87 Handle<Object> receiver = it->GetReceiver();
88 Handle<Object> unscopables;
89 MaybeHandle<Object> maybe_unscopables =
90 Object::GetProperty(receiver, unscopables_symbol);
91 if (!maybe_unscopables.ToHandle(&unscopables)) {
92 return Maybe<PropertyAttributes>();
93 }
94 if (!unscopables->IsSpecObject()) return attrs;
95 Maybe<bool> blacklist = JSReceiver::HasProperty(
96 Handle<JSReceiver>::cast(unscopables), it->name());
97 if (!blacklist.has_value) {
98 DCHECK(isolate->has_pending_exception());
99 return Maybe<PropertyAttributes>();
100 }
101 if (blacklist.value) return maybe(ABSENT);
102 return attrs;
Steve Blocka7e24c12009-10-30 11:49:00 +0000103}
104
105
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000106Handle<Object> Context::Lookup(Handle<String> name,
107 ContextLookupFlags flags,
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100108 int* index,
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000109 PropertyAttributes* attributes,
110 BindingFlags* binding_flags) {
Steve Block44f0eee2011-05-26 01:26:41 +0100111 Isolate* isolate = GetIsolate();
112 Handle<Context> context(this, isolate);
Steve Blocka7e24c12009-10-30 11:49:00 +0000113
114 bool follow_context_chain = (flags & FOLLOW_CONTEXT_CHAIN) != 0;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100115 *index = -1;
Steve Blocka7e24c12009-10-30 11:49:00 +0000116 *attributes = ABSENT;
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000117 *binding_flags = MISSING_BINDING;
Steve Blocka7e24c12009-10-30 11:49:00 +0000118
119 if (FLAG_trace_contexts) {
120 PrintF("Context::Lookup(");
121 name->ShortPrint();
122 PrintF(")\n");
123 }
124
125 do {
126 if (FLAG_trace_contexts) {
Ben Murdochf87a2032010-10-22 12:50:53 +0100127 PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000128 if (context->IsNativeContext()) PrintF(" (native context)");
Steve Blocka7e24c12009-10-30 11:49:00 +0000129 PrintF("\n");
130 }
131
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100132 // 1. Check global objects, subjects of with, and extension objects.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000133 if (context->IsNativeContext() ||
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100134 context->IsWithContext() ||
135 (context->IsFunctionContext() && context->has_extension())) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000136 Handle<JSReceiver> object(
137 JSReceiver::cast(context->extension()), isolate);
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100138 // Context extension objects needs to behave as if they have no
139 // prototype. So even if we want to follow prototype chains, we need
140 // to only do a local lookup for context extension objects.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000141 Maybe<PropertyAttributes> maybe;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100142 if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 ||
143 object->IsJSContextExtensionObject()) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000144 maybe = JSReceiver::GetOwnPropertyAttributes(object, name);
145 } else if (context->IsWithContext()) {
146 LookupIterator it(object, name);
147 maybe = UnscopableLookup(&it);
Ben Murdoch85b71792012-04-11 18:30:58 +0100148 } else {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000149 maybe = JSReceiver::GetPropertyAttributes(object, name);
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100150 }
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000151
152 if (!maybe.has_value) return Handle<Object>();
153 DCHECK(!isolate->has_pending_exception());
154 *attributes = maybe.value;
155
156 if (maybe.value != ABSENT) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100157 if (FLAG_trace_contexts) {
158 PrintF("=> found property in context object %p\n",
159 reinterpret_cast<void*>(*object));
Ben Murdoch85b71792012-04-11 18:30:58 +0100160 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100161 return object;
Steve Blocka7e24c12009-10-30 11:49:00 +0000162 }
163 }
164
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100165 // 2. Check the context proper if it has slots.
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000166 if (context->IsFunctionContext() || context->IsBlockContext()) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100167 // Use serialized scope information of functions and blocks to search
168 // for the context index.
169 Handle<ScopeInfo> scope_info;
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000170 if (context->IsFunctionContext()) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100171 scope_info = Handle<ScopeInfo>(
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000172 context->closure()->shared()->scope_info(), isolate);
173 } else {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100174 scope_info = Handle<ScopeInfo>(
175 ScopeInfo::cast(context->extension()), isolate);
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000176 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100177 VariableMode mode;
178 InitializationFlag init_flag;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000179 // TODO(sigurds) Figure out whether maybe_assigned_flag should
180 // be used to compute binding_flags.
181 MaybeAssignedFlag maybe_assigned_flag;
182 int slot_index = ScopeInfo::ContextSlotIndex(
183 scope_info, name, &mode, &init_flag, &maybe_assigned_flag);
184 DCHECK(slot_index < 0 || slot_index >= MIN_CONTEXT_SLOTS);
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100185 if (slot_index >= 0) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000186 if (FLAG_trace_contexts) {
187 PrintF("=> found local in context slot %d (mode = %d)\n",
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100188 slot_index, mode);
Steve Blocka7e24c12009-10-30 11:49:00 +0000189 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100190 *index = slot_index;
Steve Blocka7e24c12009-10-30 11:49:00 +0000191 // Note: Fixed context slots are statically allocated by the compiler.
192 // Statically allocated variables always have a statically known mode,
193 // which is the mode with which they were declared when added to the
194 // scope. Thus, the DYNAMIC mode (which corresponds to dynamically
195 // declared variables that were introduced through declaration nodes)
196 // must not appear here.
197 switch (mode) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100198 case INTERNAL: // Fall through.
199 case VAR:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000200 *attributes = NONE;
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000201 *binding_flags = MUTABLE_IS_INITIALIZED;
202 break;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100203 case LET:
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000204 *attributes = NONE;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100205 *binding_flags = (init_flag == kNeedsInitialization)
206 ? MUTABLE_CHECK_INITIALIZED : MUTABLE_IS_INITIALIZED;
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000207 break;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000208 case CONST_LEGACY:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000209 *attributes = READ_ONLY;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100210 *binding_flags = (init_flag == kNeedsInitialization)
211 ? IMMUTABLE_CHECK_INITIALIZED : IMMUTABLE_IS_INITIALIZED;
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000212 break;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000213 case CONST:
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100214 *attributes = READ_ONLY;
215 *binding_flags = (init_flag == kNeedsInitialization)
216 ? IMMUTABLE_CHECK_INITIALIZED_HARMONY :
217 IMMUTABLE_IS_INITIALIZED_HARMONY;
218 break;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000219 case MODULE:
220 *attributes = READ_ONLY;
221 *binding_flags = IMMUTABLE_IS_INITIALIZED_HARMONY;
222 break;
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100223 case DYNAMIC:
224 case DYNAMIC_GLOBAL:
225 case DYNAMIC_LOCAL:
226 case TEMPORARY:
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000227 UNREACHABLE();
228 break;
Steve Blocka7e24c12009-10-30 11:49:00 +0000229 }
230 return context;
231 }
232
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000233 // Check the slot corresponding to the intermediate context holding
234 // only the function name variable.
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100235 if (follow_context_chain && context->IsFunctionContext()) {
236 VariableMode mode;
237 int function_index = scope_info->FunctionContextSlotIndex(*name, &mode);
238 if (function_index >= 0) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000239 if (FLAG_trace_contexts) {
240 PrintF("=> found intermediate function in context slot %d\n",
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100241 function_index);
Steve Blocka7e24c12009-10-30 11:49:00 +0000242 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100243 *index = function_index;
Steve Blocka7e24c12009-10-30 11:49:00 +0000244 *attributes = READ_ONLY;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000245 DCHECK(mode == CONST_LEGACY || mode == CONST);
246 *binding_flags = (mode == CONST_LEGACY)
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100247 ? IMMUTABLE_IS_INITIALIZED : IMMUTABLE_IS_INITIALIZED_HARMONY;
Steve Blocka7e24c12009-10-30 11:49:00 +0000248 return context;
249 }
250 }
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100251
252 } else if (context->IsCatchContext()) {
253 // Catch contexts have the variable name in the extension slot.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000254 if (String::Equals(name, handle(String::cast(context->extension())))) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100255 if (FLAG_trace_contexts) {
256 PrintF("=> found in catch context\n");
257 }
258 *index = Context::THROWN_OBJECT_INDEX;
259 *attributes = NONE;
260 *binding_flags = MUTABLE_IS_INITIALIZED;
261 return context;
262 }
Steve Blocka7e24c12009-10-30 11:49:00 +0000263 }
264
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100265 // 3. Prepare to continue with the previous (next outermost) context.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000266 if (context->IsNativeContext()) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000267 follow_context_chain = false;
Steve Blocka7e24c12009-10-30 11:49:00 +0000268 } else {
Steve Block44f0eee2011-05-26 01:26:41 +0100269 context = Handle<Context>(context->previous(), isolate);
Steve Blocka7e24c12009-10-30 11:49:00 +0000270 }
271 } while (follow_context_chain);
272
Steve Blocka7e24c12009-10-30 11:49:00 +0000273 if (FLAG_trace_contexts) {
274 PrintF("=> no property/slot found\n");
275 }
276 return Handle<Object>::null();
277}
278
279
Ben Murdochb0fe1622011-05-05 13:52:32 +0100280void Context::AddOptimizedFunction(JSFunction* function) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000281 DCHECK(IsNativeContext());
282#ifdef ENABLE_SLOW_DCHECKS
283 if (FLAG_enable_slow_asserts) {
284 Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
285 while (!element->IsUndefined()) {
286 CHECK(element != function);
287 element = JSFunction::cast(element)->next_function_link();
288 }
Ben Murdochb0fe1622011-05-05 13:52:32 +0100289 }
290
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000291 // Check that the context belongs to the weak native contexts list.
Ben Murdochb0fe1622011-05-05 13:52:32 +0100292 bool found = false;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000293 Object* context = GetHeap()->native_contexts_list();
Ben Murdochb0fe1622011-05-05 13:52:32 +0100294 while (!context->IsUndefined()) {
295 if (context == this) {
296 found = true;
297 break;
298 }
299 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK);
300 }
301 CHECK(found);
302#endif
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000303
304 // If the function link field is already used then the function was
305 // enqueued as a code flushing candidate and we remove it now.
306 if (!function->next_function_link()->IsUndefined()) {
307 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher();
308 flusher->EvictCandidate(function);
309 }
310
311 DCHECK(function->next_function_link()->IsUndefined());
312
Ben Murdochb0fe1622011-05-05 13:52:32 +0100313 function->set_next_function_link(get(OPTIMIZED_FUNCTIONS_LIST));
314 set(OPTIMIZED_FUNCTIONS_LIST, function);
315}
316
317
318void Context::RemoveOptimizedFunction(JSFunction* function) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000319 DCHECK(IsNativeContext());
Ben Murdochb0fe1622011-05-05 13:52:32 +0100320 Object* element = get(OPTIMIZED_FUNCTIONS_LIST);
321 JSFunction* prev = NULL;
322 while (!element->IsUndefined()) {
323 JSFunction* element_function = JSFunction::cast(element);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000324 DCHECK(element_function->next_function_link()->IsUndefined() ||
Ben Murdochb0fe1622011-05-05 13:52:32 +0100325 element_function->next_function_link()->IsJSFunction());
326 if (element_function == function) {
327 if (prev == NULL) {
328 set(OPTIMIZED_FUNCTIONS_LIST, element_function->next_function_link());
329 } else {
330 prev->set_next_function_link(element_function->next_function_link());
331 }
Steve Block44f0eee2011-05-26 01:26:41 +0100332 element_function->set_next_function_link(GetHeap()->undefined_value());
Ben Murdochb0fe1622011-05-05 13:52:32 +0100333 return;
334 }
335 prev = element_function;
336 element = element_function->next_function_link();
337 }
338 UNREACHABLE();
339}
340
341
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000342void Context::SetOptimizedFunctionsListHead(Object* head) {
343 DCHECK(IsNativeContext());
344 set(OPTIMIZED_FUNCTIONS_LIST, head);
345}
346
347
Ben Murdochb0fe1622011-05-05 13:52:32 +0100348Object* Context::OptimizedFunctionsListHead() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000349 DCHECK(IsNativeContext());
Ben Murdochb0fe1622011-05-05 13:52:32 +0100350 return get(OPTIMIZED_FUNCTIONS_LIST);
351}
352
353
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000354void Context::AddOptimizedCode(Code* code) {
355 DCHECK(IsNativeContext());
356 DCHECK(code->kind() == Code::OPTIMIZED_FUNCTION);
357 DCHECK(code->next_code_link()->IsUndefined());
358 code->set_next_code_link(get(OPTIMIZED_CODE_LIST));
359 set(OPTIMIZED_CODE_LIST, code);
360}
361
362
363void Context::SetOptimizedCodeListHead(Object* head) {
364 DCHECK(IsNativeContext());
365 set(OPTIMIZED_CODE_LIST, head);
366}
367
368
369Object* Context::OptimizedCodeListHead() {
370 DCHECK(IsNativeContext());
371 return get(OPTIMIZED_CODE_LIST);
372}
373
374
375void Context::SetDeoptimizedCodeListHead(Object* head) {
376 DCHECK(IsNativeContext());
377 set(DEOPTIMIZED_CODE_LIST, head);
378}
379
380
381Object* Context::DeoptimizedCodeListHead() {
382 DCHECK(IsNativeContext());
383 return get(DEOPTIMIZED_CODE_LIST);
384}
385
386
387Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() {
388 Isolate* isolate = GetIsolate();
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");
Ben Murdochb0fe1622011-05-05 13:52:32 +0100393}
394
395
Steve Blocka7e24c12009-10-30 11:49:00 +0000396#ifdef DEBUG
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000397bool Context::IsBootstrappingOrValidParentContext(
398 Object* object, Context* child) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000399 // During bootstrapping we allow all objects to pass as
400 // contexts. This is necessary to fix circular dependencies.
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000401 if (child->GetIsolate()->bootstrapper()->IsActive()) return true;
402 if (!object->IsContext()) return false;
403 Context* context = Context::cast(object);
404 return context->IsNativeContext() || context->IsGlobalContext() ||
405 context->IsModuleContext() || !child->IsModuleContext();
Steve Blocka7e24c12009-10-30 11:49:00 +0000406}
407
408
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000409bool Context::IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object) {
Steve Blocka7e24c12009-10-30 11:49:00 +0000410 // During bootstrapping we allow all objects to pass as global
411 // objects. This is necessary to fix circular dependencies.
Steve Block44f0eee2011-05-26 01:26:41 +0100412 return isolate->heap()->gc_state() != Heap::NOT_IN_GC ||
413 isolate->bootstrapper()->IsActive() ||
414 object->IsGlobalObject();
Steve Blocka7e24c12009-10-30 11:49:00 +0000415}
416#endif
417
418} } // namespace v8::internal