| 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 |  | 
| 320 #ifdef DEBUG | 308 #ifdef DEBUG | 
| 321 bool Context::IsBootstrappingOrValidParentContext( | 309 bool Context::IsBootstrappingOrValidParentContext( | 
| 322     Object* object, Context* child) { | 310     Object* object, Context* child) { | 
| 323   // During bootstrapping we allow all objects to pass as | 311   // During bootstrapping we allow all objects to pass as | 
| 324   // contexts. This is necessary to fix circular dependencies. | 312   // contexts. This is necessary to fix circular dependencies. | 
| 325   if (Isolate::Current()->bootstrapper()->IsActive()) return true; | 313   if (Isolate::Current()->bootstrapper()->IsActive()) return true; | 
| 326   if (!object->IsContext()) return false; | 314   if (!object->IsContext()) return false; | 
| 327   Context* context = Context::cast(object); | 315   Context* context = Context::cast(object); | 
| 328   return context->IsNativeContext() || context->IsGlobalContext() || | 316   return context->IsNativeContext() || context->IsGlobalContext() || | 
| 329          context->IsModuleContext() || !child->IsModuleContext(); | 317          context->IsModuleContext() || !child->IsModuleContext(); | 
| 330 } | 318 } | 
| 331 | 319 | 
| 332 | 320 | 
| 333 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 321 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 
| 334   // During bootstrapping we allow all objects to pass as global | 322   // During bootstrapping we allow all objects to pass as global | 
| 335   // objects. This is necessary to fix circular dependencies. | 323   // objects. This is necessary to fix circular dependencies. | 
| 336   Isolate* isolate = Isolate::Current(); | 324   Isolate* isolate = Isolate::Current(); | 
| 337   return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 325   return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 
| 338       isolate->bootstrapper()->IsActive() || | 326       isolate->bootstrapper()->IsActive() || | 
| 339       object->IsGlobalObject(); | 327       object->IsGlobalObject(); | 
| 340 } | 328 } | 
| 341 #endif | 329 #endif | 
| 342 | 330 | 
| 343 } }  // namespace v8::internal | 331 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|