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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_; } | 87 uint32_t osr_pc_offset() const { return osr_pc_offset_; } |
| 88 Handle<Code> osr_patched_code() const { return osr_patched_code_; } |
88 int opt_count() const { return opt_count_; } | 89 int opt_count() const { return opt_count_; } |
89 int num_parameters() const; | 90 int num_parameters() const; |
90 int num_heap_slots() const; | 91 int num_heap_slots() const; |
91 Code::Flags flags() const; | 92 Code::Flags flags() const; |
92 | 93 |
93 void MarkAsEval() { | 94 void MarkAsEval() { |
94 ASSERT(!is_lazy()); | 95 ASSERT(!is_lazy()); |
95 flags_ |= IsEval::encode(true); | 96 flags_ |= IsEval::encode(true); |
96 } | 97 } |
97 void MarkAsGlobal() { | 98 void MarkAsGlobal() { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 259 |
259 void CommitDependencies(Handle<Code> code); | 260 void CommitDependencies(Handle<Code> code); |
260 | 261 |
261 void RollbackDependencies(); | 262 void RollbackDependencies(); |
262 | 263 |
263 void SaveHandles() { | 264 void SaveHandles() { |
264 SaveHandle(&closure_); | 265 SaveHandle(&closure_); |
265 SaveHandle(&shared_info_); | 266 SaveHandle(&shared_info_); |
266 SaveHandle(&context_); | 267 SaveHandle(&context_); |
267 SaveHandle(&script_); | 268 SaveHandle(&script_); |
| 269 SaveHandle(&osr_patched_code_); |
268 } | 270 } |
269 | 271 |
270 BailoutReason bailout_reason() const { return bailout_reason_; } | 272 BailoutReason bailout_reason() const { return bailout_reason_; } |
271 void set_bailout_reason(BailoutReason reason) { bailout_reason_ = reason; } | 273 void set_bailout_reason(BailoutReason reason) { bailout_reason_ = reason; } |
272 | 274 |
273 int prologue_offset() const { | 275 int prologue_offset() const { |
274 ASSERT_NE(Code::kPrologueOffsetNotSet, prologue_offset_); | 276 ASSERT_NE(Code::kPrologueOffsetNotSet, prologue_offset_); |
275 return prologue_offset_; | 277 return prologue_offset_; |
276 } | 278 } |
277 | 279 |
(...skipping 26 matching lines...) Expand all Loading... |
304 void AbortDueToDependencyChange() { | 306 void AbortDueToDependencyChange() { |
305 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 307 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
306 abort_due_to_dependency_ = true; | 308 abort_due_to_dependency_ = true; |
307 } | 309 } |
308 | 310 |
309 bool HasAbortedDueToDependencyChange() { | 311 bool HasAbortedDueToDependencyChange() { |
310 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); | 312 ASSERT(!OptimizingCompilerThread::IsOptimizerThread(isolate())); |
311 return abort_due_to_dependency_; | 313 return abort_due_to_dependency_; |
312 } | 314 } |
313 | 315 |
314 void set_osr_pc_offset(uint32_t pc_offset) { | 316 void SetOsrInfo(Handle<Code> code, uint32_t pc_offset) { |
| 317 osr_patched_code_ = code; |
315 osr_pc_offset_ = pc_offset; | 318 osr_pc_offset_ = pc_offset; |
316 } | 319 } |
317 | 320 |
318 bool HasSameOsrEntry(Handle<JSFunction> function, uint32_t pc_offset) { | 321 bool HasSameOsrEntry(Handle<JSFunction> function, uint32_t pc_offset) { |
319 return osr_pc_offset_ == pc_offset && function.is_identical_to(closure_); | 322 return osr_pc_offset_ == pc_offset && function.is_identical_to(closure_); |
320 } | 323 } |
321 | 324 |
322 protected: | 325 protected: |
323 CompilationInfo(Handle<Script> script, | 326 CompilationInfo(Handle<Script> script, |
324 Zone* zone); | 327 Zone* zone); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // The context of the caller for eval code, and the global context for a | 412 // The context of the caller for eval code, and the global context for a |
410 // global script. Will be a null handle otherwise. | 413 // global script. Will be a null handle otherwise. |
411 Handle<Context> context_; | 414 Handle<Context> context_; |
412 | 415 |
413 // Compilation mode flag and whether deoptimization is allowed. | 416 // Compilation mode flag and whether deoptimization is allowed. |
414 Mode mode_; | 417 Mode mode_; |
415 BailoutId osr_ast_id_; | 418 BailoutId osr_ast_id_; |
416 // The pc_offset corresponding to osr_ast_id_ in unoptimized code. | 419 // 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. | 420 // We can look this up in the back edge table, but cache it for quick access. |
418 uint32_t osr_pc_offset_; | 421 uint32_t osr_pc_offset_; |
| 422 // The unoptimized code we patched for OSR may not be the shared code |
| 423 // afterwards, since we may need to compile it again to include deoptimization |
| 424 // data. Keep track which code we patched. |
| 425 Handle<Code> osr_patched_code_; |
419 | 426 |
420 // Flag whether compilation needs to be aborted due to dependency change. | 427 // Flag whether compilation needs to be aborted due to dependency change. |
421 bool abort_due_to_dependency_; | 428 bool abort_due_to_dependency_; |
422 | 429 |
423 // The zone from which the compilation pipeline working on this | 430 // The zone from which the compilation pipeline working on this |
424 // CompilationInfo allocates. | 431 // CompilationInfo allocates. |
425 Zone* zone_; | 432 Zone* zone_; |
426 | 433 |
427 DeferredHandles* deferred_handles_; | 434 DeferredHandles* deferred_handles_; |
428 | 435 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 bool is_global, | 626 bool is_global, |
620 LanguageMode language_mode, | 627 LanguageMode language_mode, |
621 ParseRestriction restriction, | 628 ParseRestriction restriction, |
622 int scope_position); | 629 int scope_position); |
623 | 630 |
624 // Compile from function info (used for lazy compilation). Returns true on | 631 // Compile from function info (used for lazy compilation). Returns true on |
625 // success and false if the compilation resulted in a stack overflow. | 632 // success and false if the compilation resulted in a stack overflow. |
626 static bool CompileLazy(CompilationInfo* info); | 633 static bool CompileLazy(CompilationInfo* info); |
627 | 634 |
628 static bool RecompileConcurrent(Handle<JSFunction> function, | 635 static bool RecompileConcurrent(Handle<JSFunction> function, |
| 636 Handle<Code> unoptimized, |
629 uint32_t osr_pc_offset = 0); | 637 uint32_t osr_pc_offset = 0); |
630 | 638 |
631 // Compile a shared function info object (the function is possibly lazily | 639 // Compile a shared function info object (the function is possibly lazily |
632 // compiled). | 640 // compiled). |
633 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, | 641 static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node, |
634 Handle<Script> script); | 642 Handle<Script> script); |
635 | 643 |
636 // Set the function info for a newly compiled function. | 644 // Set the function info for a newly compiled function. |
637 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, | 645 static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info, |
638 FunctionLiteral* lit, | 646 FunctionLiteral* lit, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 unsigned info_zone_start_allocation_size_; | 679 unsigned info_zone_start_allocation_size_; |
672 ElapsedTimer timer_; | 680 ElapsedTimer timer_; |
673 | 681 |
674 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); | 682 DISALLOW_COPY_AND_ASSIGN(CompilationPhase); |
675 }; | 683 }; |
676 | 684 |
677 | 685 |
678 } } // namespace v8::internal | 686 } } // namespace v8::internal |
679 | 687 |
680 #endif // V8_COMPILER_H_ | 688 #endif // V8_COMPILER_H_ |
OLD | NEW |