| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 Scope* global_scope() const { return global_scope_; } | 77 Scope* global_scope() const { return global_scope_; } |
| 78 Handle<Code> code() const { return code_; } | 78 Handle<Code> code() const { return code_; } |
| 79 Handle<JSFunction> closure() const { return closure_; } | 79 Handle<JSFunction> closure() const { return closure_; } |
| 80 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } | 80 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } |
| 81 Handle<Script> script() const { return script_; } | 81 Handle<Script> script() const { return script_; } |
| 82 HydrogenCodeStub* code_stub() const {return code_stub_; } | 82 HydrogenCodeStub* code_stub() const {return code_stub_; } |
| 83 v8::Extension* extension() const { return extension_; } | 83 v8::Extension* extension() const { return extension_; } |
| 84 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } | 84 ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; } |
| 85 Handle<Context> context() const { return context_; } | 85 Handle<Context> context() const { return context_; } |
| 86 BailoutId osr_ast_id() const { return osr_ast_id_; } | 86 BailoutId osr_ast_id() const { return osr_ast_id_; } |
| 87 uint32_t osr_pc_offset() const { return osr_pc_offset_; } | |
| 88 int opt_count() const { return opt_count_; } | 87 int opt_count() const { return opt_count_; } |
| 89 int num_parameters() const; | 88 int num_parameters() const; |
| 90 int num_heap_slots() const; | 89 int num_heap_slots() const; |
| 91 Code::Flags flags() const; | 90 Code::Flags flags() const; |
| 92 | 91 |
| 93 void MarkAsEval() { | 92 void MarkAsEval() { |
| 94 ASSERT(!is_lazy()); | 93 ASSERT(!is_lazy()); |
| 95 flags_ |= IsEval::encode(true); | 94 flags_ |= IsEval::encode(true); |
| 96 } | 95 } |
| 97 void MarkAsGlobal() { | 96 void MarkAsGlobal() { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 void AbortDueToDependencyChange() { | 303 void AbortDueToDependencyChange() { |
| 305 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 304 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
| 306 abort_due_to_dependency_ = true; | 305 abort_due_to_dependency_ = true; |
| 307 } | 306 } |
| 308 | 307 |
| 309 bool HasAbortedDueToDependencyChange() { | 308 bool HasAbortedDueToDependencyChange() { |
| 310 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 309 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
| 311 return abort_due_to_dependency_; | 310 return abort_due_to_dependency_; |
| 312 } | 311 } |
| 313 | 312 |
| 314 void set_osr_pc_offset(uint32_t pc_offset) { | 313 bool HasSameOsrEntry(Handle<JSFunction> function, BailoutId osr_ast_id) { |
| 315 osr_pc_offset_ = pc_offset; | 314 return osr_ast_id == osr_ast_id_ && function.is_identical_to(closure_); |
| 316 } | |
| 317 | |
| 318 bool HasSameOsrEntry(Handle<JSFunction> function, uint32_t pc_offset) { | |
| 319 return osr_pc_offset_ == pc_offset && function.is_identical_to(closure_); | |
| 320 } | 315 } |
| 321 | 316 |
| 322 protected: | 317 protected: |
| 323 CompilationInfo(Handle<Script> script, | 318 CompilationInfo(Handle<Script> script, |
| 324 Zone* zone); | 319 Zone* zone); |
| 325 CompilationInfo(Handle<SharedFunctionInfo> shared_info, | 320 CompilationInfo(Handle<SharedFunctionInfo> shared_info, |
| 326 Zone* zone); | 321 Zone* zone); |
| 327 CompilationInfo(HydrogenCodeStub* stub, | 322 CompilationInfo(HydrogenCodeStub* stub, |
| 328 Isolate* isolate, | 323 Isolate* isolate, |
| 329 Zone* zone); | 324 Zone* zone); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 v8::Extension* extension_; | 401 v8::Extension* extension_; |
| 407 ScriptDataImpl* pre_parse_data_; | 402 ScriptDataImpl* pre_parse_data_; |
| 408 | 403 |
| 409 // The context of the caller for eval code, and the global context for a | 404 // The context of the caller for eval code, and the global context for a |
| 410 // global script. Will be a null handle otherwise. | 405 // global script. Will be a null handle otherwise. |
| 411 Handle<Context> context_; | 406 Handle<Context> context_; |
| 412 | 407 |
| 413 // Compilation mode flag and whether deoptimization is allowed. | 408 // Compilation mode flag and whether deoptimization is allowed. |
| 414 Mode mode_; | 409 Mode mode_; |
| 415 BailoutId osr_ast_id_; | 410 BailoutId osr_ast_id_; |
| 416 // The pc_offset corresponding to osr_ast_id_ in unoptimized code. | |
| 417 // We can look this up in the back edge table, but cache it for quick access. | |
| 418 uint32_t osr_pc_offset_; | |
| 419 | 411 |
| 420 // Flag whether compilation needs to be aborted due to dependency change. | 412 // Flag whether compilation needs to be aborted due to dependency change. |
| 421 bool abort_due_to_dependency_; | 413 bool abort_due_to_dependency_; |
| 422 | 414 |
| 423 // The zone from which the compilation pipeline working on this | 415 // The zone from which the compilation pipeline working on this |
| 424 // CompilationInfo allocates. | 416 // CompilationInfo allocates. |
| 425 Zone* zone_; | 417 Zone* zone_; |
| 426 | 418 |
| 427 DeferredHandles* deferred_handles_; | 419 DeferredHandles* deferred_handles_; |
| 428 | 420 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 bool is_global, | 611 bool is_global, |
| 620 LanguageMode language_mode, | 612 LanguageMode language_mode, |
| 621 ParseRestriction restriction, | 613 ParseRestriction restriction, |
| 622 int scope_position); | 614 int scope_position); |
| 623 | 615 |
| 624 // Compile from function info (used for lazy compilation). Returns true on | 616 // Compile from function info (used for lazy compilation). Returns true on |
| 625 // success and false if the compilation resulted in a stack overflow. | 617 // success and false if the compilation resulted in a stack overflow. |
| 626 static bool CompileLazy(CompilationInfo* info); | 618 static bool CompileLazy(CompilationInfo* info); |
| 627 | 619 |
| 628 static bool RecompileConcurrent(Handle<JSFunction> function, | 620 static bool RecompileConcurrent(Handle<JSFunction> function, |
| 629 uint32_t osr_pc_offset = 0); | 621 BailoutId osr_ast_id = BailoutId::None()); |
| 630 | 622 |
| 631 // Compile a shared function info object (the function is possibly lazily | 623 // Compile a shared function info object (the function is possibly lazily |
| 632 // compiled). | 624 // compiled). |
| 633 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, | 625 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, |
| 634 Handle<Script> script); | 626 Handle<Script> script); |
| 635 | 627 |
| 636 // Set the function info for a newly compiled function. | 628 // Set the function info for a newly compiled function. |
| 637 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, | 629 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
| 638 FunctionLiteral* lit, | 630 FunctionLiteral* lit, |
| 639 bool is_toplevel, | 631 bool is_toplevel, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 unsigned info_zone_start_allocation_size_; | 663 unsigned info_zone_start_allocation_size_; |
| 672 ElapsedTimer timer_; | 664 ElapsedTimer timer_; |
| 673 | 665 |
| 674 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 666 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
| 675 }; | 667 }; |
| 676 | 668 |
| 677 | 669 |
| 678 } } // namespace v8::internal | 670 } } // namespace v8::internal |
| 679 | 671 |
| 680 #endif // V8_COMPILER_H_ | 672 #endif // V8_COMPILER_H_ |
| OLD | NEW |