OLD | NEW |
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 ASSERT(IsNativeContext()); | 298 ASSERT(IsNativeContext()); |
299 return get(OPTIMIZED_FUNCTIONS_LIST); | 299 return get(OPTIMIZED_FUNCTIONS_LIST); |
300 } | 300 } |
301 | 301 |
302 | 302 |
303 void Context::ClearOptimizedFunctions() { | 303 void Context::ClearOptimizedFunctions() { |
304 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); | 304 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); |
305 } | 305 } |
306 | 306 |
307 | 307 |
| 308 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { |
| 309 Handle<Object> result(error_message_for_code_gen_from_strings()); |
| 310 if (result->IsUndefined()) { |
| 311 const char* error = |
| 312 "Code generation from strings disallowed for this context"; |
| 313 Isolate* isolate = Isolate::Current(); |
| 314 result = isolate->factory()->NewStringFromAscii(i::CStrVector(error)); |
| 315 } |
| 316 return result; |
| 317 } |
| 318 |
| 319 |
308 #ifdef DEBUG | 320 #ifdef DEBUG |
309 bool Context::IsBootstrappingOrValidParentContext( | 321 bool Context::IsBootstrappingOrValidParentContext( |
310 Object* object, Context* child) { | 322 Object* object, Context* child) { |
311 // During bootstrapping we allow all objects to pass as | 323 // During bootstrapping we allow all objects to pass as |
312 // contexts. This is necessary to fix circular dependencies. | 324 // contexts. This is necessary to fix circular dependencies. |
313 if (Isolate::Current()->bootstrapper()->IsActive()) return true; | 325 if (Isolate::Current()->bootstrapper()->IsActive()) return true; |
314 if (!object->IsContext()) return false; | 326 if (!object->IsContext()) return false; |
315 Context* context = Context::cast(object); | 327 Context* context = Context::cast(object); |
316 return context->IsNativeContext() || context->IsGlobalContext() || | 328 return context->IsNativeContext() || context->IsGlobalContext() || |
317 context->IsModuleContext() || !child->IsModuleContext(); | 329 context->IsModuleContext() || !child->IsModuleContext(); |
318 } | 330 } |
319 | 331 |
320 | 332 |
321 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 333 bool Context::IsBootstrappingOrGlobalObject(Object* object) { |
322 // During bootstrapping we allow all objects to pass as global | 334 // During bootstrapping we allow all objects to pass as global |
323 // objects. This is necessary to fix circular dependencies. | 335 // objects. This is necessary to fix circular dependencies. |
324 Isolate* isolate = Isolate::Current(); | 336 Isolate* isolate = Isolate::Current(); |
325 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 337 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
326 isolate->bootstrapper()->IsActive() || | 338 isolate->bootstrapper()->IsActive() || |
327 object->IsGlobalObject(); | 339 object->IsGlobalObject(); |
328 } | 340 } |
329 #endif | 341 #endif |
330 | 342 |
331 } } // namespace v8::internal | 343 } } // namespace v8::internal |
OLD | NEW |