| 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 2930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2941 RUNTIME_FUNCTION(MaybeObject*, Runtime_ResumeJSGeneratorObject) { | 2941 RUNTIME_FUNCTION(MaybeObject*, Runtime_ResumeJSGeneratorObject) { |
| 2942 SealHandleScope shs(isolate); | 2942 SealHandleScope shs(isolate); |
| 2943 ASSERT(args.length() == 3); | 2943 ASSERT(args.length() == 3); |
| 2944 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); | 2944 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); |
| 2945 CONVERT_ARG_CHECKED(Object, value, 1); | 2945 CONVERT_ARG_CHECKED(Object, value, 1); |
| 2946 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); | 2946 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); |
| 2947 JavaScriptFrameIterator stack_iterator(isolate); | 2947 JavaScriptFrameIterator stack_iterator(isolate); |
| 2948 JavaScriptFrame* frame = stack_iterator.frame(); | 2948 JavaScriptFrame* frame = stack_iterator.frame(); |
| 2949 | 2949 |
| 2950 ASSERT_EQ(frame->function(), generator_object->function()); | 2950 ASSERT_EQ(frame->function(), generator_object->function()); |
| 2951 ASSERT(frame->function()->is_compiled()); | |
| 2952 | 2951 |
| 2953 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 2952 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); |
| 2954 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 2953 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); |
| 2955 | 2954 |
| 2956 Address pc = generator_object->function()->code()->instruction_start(); | 2955 Address pc = generator_object->function()->code()->instruction_start(); |
| 2957 int offset = generator_object->continuation(); | 2956 int offset = generator_object->continuation(); |
| 2958 ASSERT(offset > 0); | 2957 ASSERT(offset > 0); |
| 2959 frame->set_pc(pc + offset); | 2958 frame->set_pc(pc + offset); |
| 2960 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); | 2959 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); |
| 2961 | 2960 |
| (...skipping 5463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8425 } | 8424 } |
| 8426 bool sync_with_compiler_thread = true; | 8425 bool sync_with_compiler_thread = true; |
| 8427 if (args.length() == 2) { | 8426 if (args.length() == 2) { |
| 8428 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); | 8427 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
| 8429 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { | 8428 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { |
| 8430 sync_with_compiler_thread = false; | 8429 sync_with_compiler_thread = false; |
| 8431 } | 8430 } |
| 8432 } | 8431 } |
| 8433 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8432 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8434 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { | 8433 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { |
| 8435 while (function->IsInRecompileQueue() || | 8434 while (function->IsMarkedForParallelRecompilation() || |
| 8435 function->IsInRecompileQueue() || |
| 8436 function->IsMarkedForInstallingRecompiledCode()) { | 8436 function->IsMarkedForInstallingRecompiledCode()) { |
| 8437 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8437 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 8438 OS::Sleep(50); | 8438 OS::Sleep(50); |
| 8439 } | 8439 } |
| 8440 } | 8440 } |
| 8441 if (FLAG_always_opt) { | 8441 if (FLAG_always_opt) { |
| 8442 // We may have always opt, but that is more best-effort than a real | 8442 // We may have always opt, but that is more best-effort than a real |
| 8443 // promise, so we still say "no" if it is not optimized. | 8443 // promise, so we still say "no" if it is not optimized. |
| 8444 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8444 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
| 8445 : Smi::FromInt(2); // 2 == "no". | 8445 : Smi::FromInt(2); // 2 == "no". |
| (...skipping 5461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13907 // Handle last resort GC and make sure to allow future allocations | 13907 // Handle last resort GC and make sure to allow future allocations |
| 13908 // to grow the heap without causing GCs (if possible). | 13908 // to grow the heap without causing GCs (if possible). |
| 13909 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13909 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13911 "Runtime::PerformGC"); | 13911 "Runtime::PerformGC"); |
| 13912 } | 13912 } |
| 13913 } | 13913 } |
| 13914 | 13914 |
| 13915 | 13915 |
| 13916 } } // namespace v8::internal | 13916 } } // namespace v8::internal |
| OLD | NEW |