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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 return get(OPTIMIZED_FUNCTIONS_LIST); | 320 return get(OPTIMIZED_FUNCTIONS_LIST); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 void Context::ClearOptimizedFunctions() { | 324 void Context::ClearOptimizedFunctions() { |
325 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); | 325 set(OPTIMIZED_FUNCTIONS_LIST, GetHeap()->undefined_value()); |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { | 329 Handle<Object> Context::ErrorMessageForCodeGenerationFromStrings() { |
330 Handle<Object> result(error_message_for_code_gen_from_strings()); | 330 Handle<Object> result(error_message_for_code_gen_from_strings(), |
331 if (result->IsUndefined()) { | 331 GetIsolate()); |
332 const char* error = | 332 if (!result->IsUndefined()) return result; |
333 "Code generation from strings disallowed for this context"; | 333 return GetIsolate()->factory()->NewStringFromAscii(i::CStrVector( |
334 Isolate* isolate = Isolate::Current(); | 334 "Code generation from strings disallowed for this context")); |
335 result = isolate->factory()->NewStringFromAscii(i::CStrVector(error)); | |
336 } | |
337 return result; | |
338 } | 335 } |
339 | 336 |
340 | 337 |
341 #ifdef DEBUG | 338 #ifdef DEBUG |
342 bool Context::IsBootstrappingOrValidParentContext( | 339 bool Context::IsBootstrappingOrValidParentContext( |
343 Object* object, Context* child) { | 340 Object* object, Context* child) { |
344 // During bootstrapping we allow all objects to pass as | 341 // During bootstrapping we allow all objects to pass as |
345 // contexts. This is necessary to fix circular dependencies. | 342 // contexts. This is necessary to fix circular dependencies. |
346 if (Isolate::Current()->bootstrapper()->IsActive()) return true; | 343 if (child->GetIsolate()->bootstrapper()->IsActive()) return true; |
347 if (!object->IsContext()) return false; | 344 if (!object->IsContext()) return false; |
348 Context* context = Context::cast(object); | 345 Context* context = Context::cast(object); |
349 return context->IsNativeContext() || context->IsGlobalContext() || | 346 return context->IsNativeContext() || context->IsGlobalContext() || |
350 context->IsModuleContext() || !child->IsModuleContext(); | 347 context->IsModuleContext() || !child->IsModuleContext(); |
351 } | 348 } |
352 | 349 |
353 | 350 |
354 bool Context::IsBootstrappingOrGlobalObject(Object* object) { | 351 bool Context::IsBootstrappingOrGlobalObject(Object* object) { |
355 // During bootstrapping we allow all objects to pass as global | 352 // During bootstrapping we allow all objects to pass as global |
356 // objects. This is necessary to fix circular dependencies. | 353 // objects. This is necessary to fix circular dependencies. |
357 Isolate* isolate = Isolate::Current(); | 354 Isolate* isolate = Isolate::Current(); |
358 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || | 355 return isolate->heap()->gc_state() != Heap::NOT_IN_GC || |
359 isolate->bootstrapper()->IsActive() || | 356 isolate->bootstrapper()->IsActive() || |
360 object->IsGlobalObject(); | 357 object->IsGlobalObject(); |
361 } | 358 } |
362 #endif | 359 #endif |
363 | 360 |
364 } } // namespace v8::internal | 361 } } // namespace v8::internal |
OLD | NEW |