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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 void AbortDueToDependencyChange() { | 301 void AbortDueToDependencyChange() { |
302 ASSERT(!isolate()->optimizing_compiler_thread()->IsOptimizerThread()); | 302 ASSERT(!isolate()->optimizing_compiler_thread()->IsOptimizerThread()); |
303 abort_due_to_dependency_ = true; | 303 abort_due_to_dependency_ = true; |
304 } | 304 } |
305 | 305 |
306 bool HasAbortedDueToDependencyChange() { | 306 bool HasAbortedDueToDependencyChange() { |
307 ASSERT(!isolate()->optimizing_compiler_thread()->IsOptimizerThread()); | 307 ASSERT(!isolate()->optimizing_compiler_thread()->IsOptimizerThread()); |
308 return abort_due_to_dependency_; | 308 return abort_due_to_dependency_; |
309 } | 309 } |
310 | 310 |
| 311 void set_osr_pc_offset(uint32_t pc_offset) { |
| 312 osr_pc_offset_ = pc_offset; |
| 313 } |
| 314 |
| 315 bool HasSameOsrEntry(Handle<JSFunction> function, uint32_t pc_offset) { |
| 316 return osr_pc_offset_ == pc_offset && function.is_identical_to(closure_); |
| 317 } |
| 318 |
311 protected: | 319 protected: |
312 CompilationInfo(Handle<Script> script, | 320 CompilationInfo(Handle<Script> script, |
313 Zone* zone); | 321 Zone* zone); |
314 CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 322 CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
315 Zone* zone); | 323 Zone* zone); |
316 CompilationInfo(HydrogenCodeStub* stub, | 324 CompilationInfo(HydrogenCodeStub* stub, |
317 Isolate* isolate, | 325 Isolate* isolate, |
318 Zone* zone); | 326 Zone* zone); |
319 | 327 |
320 private: | 328 private: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 v8::Extension* extension_; | 403 v8::Extension* extension_; |
396 ScriptDataImpl* pre_parse_data_; | 404 ScriptDataImpl* pre_parse_data_; |
397 | 405 |
398 // The context of the caller for eval code, and the global context for a | 406 // The context of the caller for eval code, and the global context for a |
399 // global script. Will be a null handle otherwise. | 407 // global script. Will be a null handle otherwise. |
400 Handle<Context> context_; | 408 Handle<Context> context_; |
401 | 409 |
402 // Compilation mode flag and whether deoptimization is allowed. | 410 // Compilation mode flag and whether deoptimization is allowed. |
403 Mode mode_; | 411 Mode mode_; |
404 BailoutId osr_ast_id_; | 412 BailoutId osr_ast_id_; |
| 413 // The pc_offset corresponding to osr_ast_id_ in unoptimized code. |
| 414 // We can look this up in the back edge table, but cache it for quick access. |
| 415 uint32_t osr_pc_offset_; |
405 | 416 |
406 // Flag whether compilation needs to be aborted due to dependency change. | 417 // Flag whether compilation needs to be aborted due to dependency change. |
407 bool abort_due_to_dependency_; | 418 bool abort_due_to_dependency_; |
408 | 419 |
409 // The zone from which the compilation pipeline working on this | 420 // The zone from which the compilation pipeline working on this |
410 // CompilationInfo allocates. | 421 // CompilationInfo allocates. |
411 Zone* zone_; | 422 Zone* zone_; |
412 | 423 |
413 DeferredHandles* deferred_handles_; | 424 DeferredHandles* deferred_handles_; |
414 | 425 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 Handle<Context> context, | 604 Handle<Context> context, |
594 bool is_global, | 605 bool is_global, |
595 LanguageMode language_mode, | 606 LanguageMode language_mode, |
596 ParseRestriction restriction, | 607 ParseRestriction restriction, |
597 int scope_position); | 608 int scope_position); |
598 | 609 |
599 // Compile from function info (used for lazy compilation). Returns true on | 610 // Compile from function info (used for lazy compilation). Returns true on |
600 // success and false if the compilation resulted in a stack overflow. | 611 // success and false if the compilation resulted in a stack overflow. |
601 static bool CompileLazy(CompilationInfo* info); | 612 static bool CompileLazy(CompilationInfo* info); |
602 | 613 |
603 static void RecompileConcurrent(Handle<JSFunction> function); | 614 static void RecompileConcurrent(Handle<JSFunction> function, |
| 615 uint32_t osr_pc_offset = 0); |
604 | 616 |
605 // Compile a shared function info object (the function is possibly lazily | 617 // Compile a shared function info object (the function is possibly lazily |
606 // compiled). | 618 // compiled). |
607 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, | 619 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, |
608 Handle<Script> script); | 620 Handle<Script> script); |
609 | 621 |
610 // Set the function info for a newly compiled function. | 622 // Set the function info for a newly compiled function. |
611 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, | 623 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
612 FunctionLiteral* lit, | 624 FunctionLiteral* lit, |
613 bool is_toplevel, | 625 bool is_toplevel, |
614 Handle<Script> script); | 626 Handle<Script> script); |
615 | 627 |
616 static void InstallOptimizedCode(OptimizingCompiler* info); | 628 static void InstallOptimizedCode(OptimizingCompiler* info); |
617 | 629 |
| 630 static bool CompileForOnStackReplacement(Handle<JSFunction> function, |
| 631 BailoutId* ast_id_out); |
| 632 |
| 633 static bool CompileForConcurrentOSR(Handle<JSFunction> function, |
| 634 BailoutId* ast_id_out); |
| 635 |
618 #ifdef ENABLE_DEBUGGER_SUPPORT | 636 #ifdef ENABLE_DEBUGGER_SUPPORT |
619 static bool MakeCodeForLiveEdit(CompilationInfo* info); | 637 static bool MakeCodeForLiveEdit(CompilationInfo* info); |
620 #endif | 638 #endif |
621 | 639 |
622 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 640 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
623 CompilationInfo* info, | 641 CompilationInfo* info, |
624 Handle<SharedFunctionInfo> shared); | 642 Handle<SharedFunctionInfo> shared); |
625 }; | 643 }; |
626 | 644 |
627 | 645 |
(...skipping 17 matching lines...) Expand all Loading... |
645 unsigned info_zone_start_allocation_size_; | 663 unsigned info_zone_start_allocation_size_; |
646 ElapsedTimer timer_; | 664 ElapsedTimer timer_; |
647 | 665 |
648 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 666 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
649 }; | 667 }; |
650 | 668 |
651 | 669 |
652 } } // namespace v8::internal | 670 } } // namespace v8::internal |
653 | 671 |
654 #endif // V8_COMPILER_H_ | 672 #endif // V8_COMPILER_H_ |
OLD | NEW |