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()); |
2951 | 2952 |
2952 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 2953 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); |
2953 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 2954 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); |
2954 | 2955 |
2955 Address pc = generator_object->function()->code()->instruction_start(); | 2956 Address pc = generator_object->function()->code()->instruction_start(); |
2956 int offset = generator_object->continuation(); | 2957 int offset = generator_object->continuation(); |
2957 ASSERT(offset > 0); | 2958 ASSERT(offset > 0); |
2958 frame->set_pc(pc + offset); | 2959 frame->set_pc(pc + offset); |
2959 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); | 2960 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); |
2960 | 2961 |
(...skipping 5497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8458 } | 8459 } |
8459 bool sync_with_compiler_thread = true; | 8460 bool sync_with_compiler_thread = true; |
8460 if (args.length() == 2) { | 8461 if (args.length() == 2) { |
8461 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); | 8462 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
8462 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { | 8463 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { |
8463 sync_with_compiler_thread = false; | 8464 sync_with_compiler_thread = false; |
8464 } | 8465 } |
8465 } | 8466 } |
8466 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8467 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8467 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { | 8468 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { |
8468 while (function->IsMarkedForParallelRecompilation() || | 8469 while (function->IsInRecompileQueue() || |
8469 function->IsInRecompileQueue() || | |
8470 function->IsMarkedForInstallingRecompiledCode()) { | 8470 function->IsMarkedForInstallingRecompiledCode()) { |
8471 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8471 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
8472 OS::Sleep(50); | 8472 OS::Sleep(50); |
8473 } | 8473 } |
8474 } | 8474 } |
8475 if (FLAG_always_opt) { | 8475 if (FLAG_always_opt) { |
8476 // We may have always opt, but that is more best-effort than a real | 8476 // We may have always opt, but that is more best-effort than a real |
8477 // promise, so we still say "no" if it is not optimized. | 8477 // promise, so we still say "no" if it is not optimized. |
8478 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8478 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
8479 : Smi::FromInt(2); // 2 == "no". | 8479 : Smi::FromInt(2); // 2 == "no". |
(...skipping 5461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13941 // Handle last resort GC and make sure to allow future allocations | 13941 // Handle last resort GC and make sure to allow future allocations |
13942 // to grow the heap without causing GCs (if possible). | 13942 // to grow the heap without causing GCs (if possible). |
13943 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13943 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13944 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13944 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13945 "Runtime::PerformGC"); | 13945 "Runtime::PerformGC"); |
13946 } | 13946 } |
13947 } | 13947 } |
13948 | 13948 |
13949 | 13949 |
13950 } } // namespace v8::internal | 13950 } } // namespace v8::internal |
OLD | NEW |