OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 17 matching lines...) Expand all Loading... |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "compiler.h" | 30 #include "compiler.h" |
31 | 31 |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
33 #include "codegen-inl.h" | 33 #include "codegen-inl.h" |
34 #include "compilation-cache.h" | 34 #include "compilation-cache.h" |
35 #include "data-flow.h" | 35 #include "data-flow.h" |
36 #include "debug.h" | 36 #include "debug.h" |
37 #include "full-codegen.h" | 37 #include "full-codegen.h" |
| 38 #include "gdb-jit.h" |
38 #include "hydrogen.h" | 39 #include "hydrogen.h" |
39 #include "lithium-allocator.h" | 40 #include "lithium-allocator.h" |
40 #include "liveedit.h" | 41 #include "liveedit.h" |
41 #include "oprofile-agent.h" | 42 #include "oprofile-agent.h" |
42 #include "parser.h" | 43 #include "parser.h" |
43 #include "rewriter.h" | 44 #include "rewriter.h" |
44 #include "runtime-profiler.h" | 45 #include "runtime-profiler.h" |
45 #include "scopeinfo.h" | 46 #include "scopeinfo.h" |
46 #include "scopes.h" | 47 #include "scopes.h" |
47 #include "vm-state-inl.h" | 48 #include "vm-state-inl.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // Fall back to using the full code generator if it's not possible | 201 // Fall back to using the full code generator if it's not possible |
201 // to use the Hydrogen-based optimizing compiler. We already have | 202 // to use the Hydrogen-based optimizing compiler. We already have |
202 // generated code for this from the shared function object. | 203 // generated code for this from the shared function object. |
203 if (AlwaysFullCompiler() || !FLAG_use_hydrogen) { | 204 if (AlwaysFullCompiler() || !FLAG_use_hydrogen) { |
204 info->SetCode(code); | 205 info->SetCode(code); |
205 return true; | 206 return true; |
206 } | 207 } |
207 | 208 |
208 // Limit the number of times we re-compile a functions with | 209 // Limit the number of times we re-compile a functions with |
209 // the optimizing compiler. | 210 // the optimizing compiler. |
210 const int kMaxOptCount = FLAG_deopt_every_n_times == 0 ? 10 : 1000; | 211 const int kMaxOptCount = |
| 212 FLAG_deopt_every_n_times == 0 ? Compiler::kDefaultMaxOptCount : 1000; |
211 if (info->shared_info()->opt_count() > kMaxOptCount) { | 213 if (info->shared_info()->opt_count() > kMaxOptCount) { |
212 AbortAndDisable(info); | 214 AbortAndDisable(info); |
213 // True indicates the compilation pipeline is still going, not | 215 // True indicates the compilation pipeline is still going, not |
214 // necessarily that we optimized the code. | 216 // necessarily that we optimized the code. |
215 return true; | 217 return true; |
216 } | 218 } |
217 | 219 |
218 // Due to an encoding limit on LUnallocated operands in the Lithium | 220 // Due to an encoding limit on LUnallocated operands in the Lithium |
219 // language, we cannot optimize functions with too many formal parameters | 221 // language, we cannot optimize functions with too many formal parameters |
220 // or perform on-stack replacement for function with too many | 222 // or perform on-stack replacement for function with too many |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (script->name()->IsString()) { | 415 if (script->name()->IsString()) { |
414 PROFILE(CodeCreateEvent( | 416 PROFILE(CodeCreateEvent( |
415 info->is_eval() | 417 info->is_eval() |
416 ? Logger::EVAL_TAG | 418 ? Logger::EVAL_TAG |
417 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 419 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
418 *info->code(), | 420 *info->code(), |
419 String::cast(script->name()))); | 421 String::cast(script->name()))); |
420 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()), | 422 OPROFILE(CreateNativeCodeRegion(String::cast(script->name()), |
421 info->code()->instruction_start(), | 423 info->code()->instruction_start(), |
422 info->code()->instruction_size())); | 424 info->code()->instruction_size())); |
| 425 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), |
| 426 script, |
| 427 info->code())); |
423 } else { | 428 } else { |
424 PROFILE(CodeCreateEvent( | 429 PROFILE(CodeCreateEvent( |
425 info->is_eval() | 430 info->is_eval() |
426 ? Logger::EVAL_TAG | 431 ? Logger::EVAL_TAG |
427 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 432 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
428 *info->code(), | 433 *info->code(), |
429 "")); | 434 "")); |
430 OPROFILE(CreateNativeCodeRegion(info->is_eval() ? "Eval" : "Script", | 435 OPROFILE(CreateNativeCodeRegion(info->is_eval() ? "Eval" : "Script", |
431 info->code()->instruction_start(), | 436 info->code()->instruction_start(), |
432 info->code()->instruction_size())); | 437 info->code()->instruction_size())); |
| 438 GDBJIT(AddCode(Handle<String>(), script, info->code())); |
433 } | 439 } |
434 | 440 |
435 // Allocate function. | 441 // Allocate function. |
436 Handle<SharedFunctionInfo> result = | 442 Handle<SharedFunctionInfo> result = |
437 Factory::NewSharedFunctionInfo( | 443 Factory::NewSharedFunctionInfo( |
438 lit->name(), | 444 lit->name(), |
439 lit->materialized_literal_count(), | 445 lit->materialized_literal_count(), |
440 info->code(), | 446 info->code(), |
441 SerializedScopeInfo::Create(info->scope())); | 447 SerializedScopeInfo::Create(info->scope())); |
442 | 448 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 code->instruction_size())); | 792 code->instruction_size())); |
787 } else { | 793 } else { |
788 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), | 794 PROFILE(CodeCreateEvent(Logger::ToNativeByScript(tag, *script), |
789 *code, | 795 *code, |
790 *name)); | 796 *name)); |
791 OPROFILE(CreateNativeCodeRegion(*name, | 797 OPROFILE(CreateNativeCodeRegion(*name, |
792 code->instruction_start(), | 798 code->instruction_start(), |
793 code->instruction_size())); | 799 code->instruction_size())); |
794 } | 800 } |
795 } | 801 } |
| 802 |
| 803 GDBJIT(AddCode(name, |
| 804 Handle<Script>(info->script()), |
| 805 Handle<Code>(info->code()))); |
796 } | 806 } |
797 | 807 |
798 } } // namespace v8::internal | 808 } } // namespace v8::internal |
OLD | NEW |