| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/asmjs/asm-js.h" | 8 #include "src/asmjs/asm-js.h" |
| 9 #include "src/compiler-dispatcher/compiler-dispatcher.h" |
| 9 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" | 10 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
| 10 #include "src/compiler.h" | 11 #include "src/compiler.h" |
| 11 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
| 12 #include "src/frames-inl.h" | 13 #include "src/frames-inl.h" |
| 13 #include "src/full-codegen/full-codegen.h" | 14 #include "src/full-codegen/full-codegen.h" |
| 14 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
| 15 #include "src/messages.h" | 16 #include "src/messages.h" |
| 16 #include "src/v8threads.h" | 17 #include "src/v8threads.h" |
| 17 #include "src/vm-state-inl.h" | 18 #include "src/vm-state-inl.h" |
| 18 | 19 |
| 19 namespace v8 { | 20 namespace v8 { |
| 20 namespace internal { | 21 namespace internal { |
| 21 | 22 |
| 22 RUNTIME_FUNCTION(Runtime_CompileLazy) { | 23 RUNTIME_FUNCTION(Runtime_CompileLazy) { |
| 23 HandleScope scope(isolate); | 24 HandleScope scope(isolate); |
| 24 DCHECK_EQ(1, args.length()); | 25 DCHECK_EQ(1, args.length()); |
| 25 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 26 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 26 | 27 |
| 27 #ifdef DEBUG | 28 #ifdef DEBUG |
| 28 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { | 29 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { |
| 29 PrintF("[unoptimized: "); | 30 PrintF("[unoptimized: "); |
| 30 function->PrintName(); | 31 function->PrintName(); |
| 31 PrintF("]\n"); | 32 PrintF("]\n"); |
| 32 } | 33 } |
| 33 #endif | 34 #endif |
| 34 | 35 |
| 35 StackLimitCheck check(isolate); | 36 StackLimitCheck check(isolate); |
| 36 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); | 37 if (check.JsHasOverflowed(1 * KB)) return isolate->StackOverflow(); |
| 37 if (!Compiler::Compile(function, Compiler::KEEP_EXCEPTION)) { | 38 CompilerDispatcher* dispatcher = isolate->compiler_dispatcher(); |
| 39 Handle<SharedFunctionInfo> shared(function->shared(), isolate); |
| 40 if (dispatcher->IsEnqueued(shared)) { |
| 41 if (!dispatcher->FinishNow(shared)) { |
| 42 return isolate->heap()->exception(); |
| 43 } |
| 44 } else if (!Compiler::Compile(function, Compiler::KEEP_EXCEPTION)) { |
| 38 return isolate->heap()->exception(); | 45 return isolate->heap()->exception(); |
| 39 } | 46 } |
| 40 DCHECK(function->is_compiled()); | 47 DCHECK(function->is_compiled()); |
| 41 return function->code(); | 48 return function->code(); |
| 42 } | 49 } |
| 43 | 50 |
| 44 RUNTIME_FUNCTION(Runtime_CompileBaseline) { | 51 RUNTIME_FUNCTION(Runtime_CompileBaseline) { |
| 45 HandleScope scope(isolate); | 52 HandleScope scope(isolate); |
| 46 DCHECK_EQ(1, args.length()); | 53 DCHECK_EQ(1, args.length()); |
| 47 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 54 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 DCHECK(is_valid_language_mode(args.smi_at(3))); | 477 DCHECK(is_valid_language_mode(args.smi_at(3))); |
| 471 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); | 478 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3)); |
| 472 DCHECK(args[4]->IsSmi()); | 479 DCHECK(args[4]->IsSmi()); |
| 473 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 480 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
| 474 isolate); | 481 isolate); |
| 475 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 482 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
| 476 language_mode, args.smi_at(4), args.smi_at(5)); | 483 language_mode, args.smi_at(4), args.smi_at(5)); |
| 477 } | 484 } |
| 478 } // namespace internal | 485 } // namespace internal |
| 479 } // namespace v8 | 486 } // namespace v8 |
| OLD | NEW |