| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/frames.h" | 10 #include "src/frames.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 (function->shared()->ast_node_count() > 512) | 225 (function->shared()->ast_node_count() > 512) |
| 226 ? Compiler::CONCURRENT | 226 ? Compiler::CONCURRENT |
| 227 : Compiler::NOT_CONCURRENT; | 227 : Compiler::NOT_CONCURRENT; |
| 228 Handle<Code> result = Handle<Code>::null(); | 228 Handle<Code> result = Handle<Code>::null(); |
| 229 | 229 |
| 230 OptimizedCompileJob* job = NULL; | 230 OptimizedCompileJob* job = NULL; |
| 231 if (mode == Compiler::CONCURRENT) { | 231 if (mode == Compiler::CONCURRENT) { |
| 232 // Gate the OSR entry with a stack check. | 232 // Gate the OSR entry with a stack check. |
| 233 BackEdgeTable::AddStackCheck(caller_code, pc_offset); | 233 BackEdgeTable::AddStackCheck(caller_code, pc_offset); |
| 234 // Poll already queued compilation jobs. | 234 // Poll already queued compilation jobs. |
| 235 OptimizingCompilerThread* thread = isolate->optimizing_compiler_thread(); | 235 OptimizingCompileDispatcher* dispatcher = |
| 236 if (thread->IsQueuedForOSR(function, ast_id)) { | 236 isolate->optimizing_compile_dispatcher(); |
| 237 if (dispatcher->IsQueuedForOSR(function, ast_id)) { |
| 237 if (FLAG_trace_osr) { | 238 if (FLAG_trace_osr) { |
| 238 PrintF("[OSR - Still waiting for queued: "); | 239 PrintF("[OSR - Still waiting for queued: "); |
| 239 function->PrintName(); | 240 function->PrintName(); |
| 240 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 241 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
| 241 } | 242 } |
| 242 return NULL; | 243 return NULL; |
| 243 } | 244 } |
| 244 | 245 |
| 245 job = thread->FindReadyOSRCandidate(function, ast_id); | 246 job = dispatcher->FindReadyOSRCandidate(function, ast_id); |
| 246 } | 247 } |
| 247 | 248 |
| 248 if (job != NULL) { | 249 if (job != NULL) { |
| 249 if (FLAG_trace_osr) { | 250 if (FLAG_trace_osr) { |
| 250 PrintF("[OSR - Found ready: "); | 251 PrintF("[OSR - Found ready: "); |
| 251 function->PrintName(); | 252 function->PrintName(); |
| 252 PrintF(" at AST id %d]\n", ast_id.ToInt()); | 253 PrintF(" at AST id %d]\n", ast_id.ToInt()); |
| 253 } | 254 } |
| 254 result = Compiler::GetConcurrentlyOptimizedCode(job); | 255 result = Compiler::GetConcurrentlyOptimizedCode(job); |
| 255 } else if (IsSuitableForOnStackReplacement(isolate, function, caller_code)) { | 256 } else if (IsSuitableForOnStackReplacement(isolate, function, caller_code)) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 DCHECK(args.length() == 1); | 318 DCHECK(args.length() == 1); |
| 318 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 319 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 319 | 320 |
| 320 // First check if this is a real stack overflow. | 321 // First check if this is a real stack overflow. |
| 321 StackLimitCheck check(isolate); | 322 StackLimitCheck check(isolate); |
| 322 if (check.JsHasOverflowed()) { | 323 if (check.JsHasOverflowed()) { |
| 323 SealHandleScope shs(isolate); | 324 SealHandleScope shs(isolate); |
| 324 return isolate->StackOverflow(); | 325 return isolate->StackOverflow(); |
| 325 } | 326 } |
| 326 | 327 |
| 327 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 328 isolate->optimizing_compile_dispatcher()->InstallOptimizedFunctions(); |
| 328 return (function->IsOptimized()) ? function->code() | 329 return (function->IsOptimized()) ? function->code() |
| 329 : function->shared()->code(); | 330 : function->shared()->code(); |
| 330 } | 331 } |
| 331 | 332 |
| 332 | 333 |
| 333 bool CodeGenerationFromStringsAllowed(Isolate* isolate, | 334 bool CodeGenerationFromStringsAllowed(Isolate* isolate, |
| 334 Handle<Context> context) { | 335 Handle<Context> context) { |
| 335 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); | 336 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); |
| 336 // Check with callback if set. | 337 // Check with callback if set. |
| 337 AllowCodeGenerationFromStringsCallback callback = | 338 AllowCodeGenerationFromStringsCallback callback = |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 DCHECK(is_valid_language_mode(args.smi_at(4))); | 436 DCHECK(is_valid_language_mode(args.smi_at(4))); |
| 436 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(4)); | 437 LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(4)); |
| 437 DCHECK(args[5]->IsSmi()); | 438 DCHECK(args[5]->IsSmi()); |
| 438 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), | 439 Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(), |
| 439 isolate); | 440 isolate); |
| 440 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, | 441 return CompileGlobalEval(isolate, args.at<String>(1), outer_info, |
| 441 args.at<Object>(3), language_mode, args.smi_at(5)); | 442 args.at<Object>(3), language_mode, args.smi_at(5)); |
| 442 } | 443 } |
| 443 } | 444 } |
| 444 } // namespace v8::internal | 445 } // namespace v8::internal |
| OLD | NEW |