| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2998 RUNTIME_FUNCTION(MaybeObject*, Runtime_ResumeJSGeneratorObject) { | 2998 RUNTIME_FUNCTION(MaybeObject*, Runtime_ResumeJSGeneratorObject) { |
| 2999 SealHandleScope shs(isolate); | 2999 SealHandleScope shs(isolate); |
| 3000 ASSERT(args.length() == 3); | 3000 ASSERT(args.length() == 3); |
| 3001 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); | 3001 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); |
| 3002 CONVERT_ARG_CHECKED(Object, value, 1); | 3002 CONVERT_ARG_CHECKED(Object, value, 1); |
| 3003 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); | 3003 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); |
| 3004 JavaScriptFrameIterator stack_iterator(isolate); | 3004 JavaScriptFrameIterator stack_iterator(isolate); |
| 3005 JavaScriptFrame* frame = stack_iterator.frame(); | 3005 JavaScriptFrame* frame = stack_iterator.frame(); |
| 3006 | 3006 |
| 3007 ASSERT_EQ(frame->function(), generator_object->function()); | 3007 ASSERT_EQ(frame->function(), generator_object->function()); |
| 3008 ASSERT(frame->function()->is_compiled()); |
| 3008 | 3009 |
| 3009 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 3010 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); |
| 3010 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 3011 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); |
| 3011 | 3012 |
| 3012 Address pc = generator_object->function()->code()->instruction_start(); | 3013 Address pc = generator_object->function()->code()->instruction_start(); |
| 3013 int offset = generator_object->continuation(); | 3014 int offset = generator_object->continuation(); |
| 3014 ASSERT(offset > 0); | 3015 ASSERT(offset > 0); |
| 3015 frame->set_pc(pc + offset); | 3016 frame->set_pc(pc + offset); |
| 3016 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); | 3017 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); |
| 3017 | 3018 |
| (...skipping 5463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8481 } | 8482 } |
| 8482 bool sync_with_compiler_thread = true; | 8483 bool sync_with_compiler_thread = true; |
| 8483 if (args.length() == 2) { | 8484 if (args.length() == 2) { |
| 8484 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); | 8485 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
| 8485 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { | 8486 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { |
| 8486 sync_with_compiler_thread = false; | 8487 sync_with_compiler_thread = false; |
| 8487 } | 8488 } |
| 8488 } | 8489 } |
| 8489 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8490 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8490 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { | 8491 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { |
| 8491 while (function->IsMarkedForParallelRecompilation() || | 8492 while (function->IsInRecompileQueue() || |
| 8492 function->IsInRecompileQueue() || | |
| 8493 function->IsMarkedForInstallingRecompiledCode()) { | 8493 function->IsMarkedForInstallingRecompiledCode()) { |
| 8494 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8494 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 8495 OS::Sleep(50); | 8495 OS::Sleep(50); |
| 8496 } | 8496 } |
| 8497 } | 8497 } |
| 8498 if (FLAG_always_opt) { | 8498 if (FLAG_always_opt) { |
| 8499 // We may have always opt, but that is more best-effort than a real | 8499 // We may have always opt, but that is more best-effort than a real |
| 8500 // promise, so we still say "no" if it is not optimized. | 8500 // promise, so we still say "no" if it is not optimized. |
| 8501 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8501 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
| 8502 : Smi::FromInt(2); // 2 == "no". | 8502 : Smi::FromInt(2); // 2 == "no". |
| (...skipping 5667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14170 // Handle last resort GC and make sure to allow future allocations | 14170 // Handle last resort GC and make sure to allow future allocations |
| 14171 // to grow the heap without causing GCs (if possible). | 14171 // to grow the heap without causing GCs (if possible). |
| 14172 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14172 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14173 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14173 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14174 "Runtime::PerformGC"); | 14174 "Runtime::PerformGC"); |
| 14175 } | 14175 } |
| 14176 } | 14176 } |
| 14177 | 14177 |
| 14178 | 14178 |
| 14179 } } // namespace v8::internal | 14179 } } // namespace v8::internal |
| OLD | NEW |