| 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 28 matching lines...) Expand all Loading... |
| 39 #include "isolate-inl.h" | 39 #include "isolate-inl.h" |
| 40 #include "lithium.h" | 40 #include "lithium.h" |
| 41 #include "liveedit.h" | 41 #include "liveedit.h" |
| 42 #include "parser.h" | 42 #include "parser.h" |
| 43 #include "rewriter.h" | 43 #include "rewriter.h" |
| 44 #include "runtime-profiler.h" | 44 #include "runtime-profiler.h" |
| 45 #include "scanner-character-streams.h" | 45 #include "scanner-character-streams.h" |
| 46 #include "scopeinfo.h" | 46 #include "scopeinfo.h" |
| 47 #include "scopes.h" | 47 #include "scopes.h" |
| 48 #include "vm-state-inl.h" | 48 #include "vm-state-inl.h" |
| 49 #include "third_party/vtune/vtune-jit.h" |
| 49 | 50 |
| 50 namespace v8 { | 51 namespace v8 { |
| 51 namespace internal { | 52 namespace internal { |
| 52 | 53 |
| 53 | 54 |
| 54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) | 55 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
| 55 : isolate_(script->GetIsolate()), | 56 : isolate_(script->GetIsolate()), |
| 56 flags_(LanguageModeField::encode(CLASSIC_MODE)), | 57 flags_(LanguageModeField::encode(CLASSIC_MODE)), |
| 57 function_(NULL), | 58 function_(NULL), |
| 58 scope_(NULL), | 59 scope_(NULL), |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 364 |
| 364 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { | 365 OptimizingCompiler::Status OptimizingCompiler::GenerateAndInstallCode() { |
| 365 ASSERT(last_status() == SUCCEEDED); | 366 ASSERT(last_status() == SUCCEEDED); |
| 366 Timer timer(this, &time_taken_to_codegen_); | 367 Timer timer(this, &time_taken_to_codegen_); |
| 367 ASSERT(chunk_ != NULL); | 368 ASSERT(chunk_ != NULL); |
| 368 ASSERT(graph_ != NULL); | 369 ASSERT(graph_ != NULL); |
| 369 Handle<Code> optimized_code = chunk_->Codegen(); | 370 Handle<Code> optimized_code = chunk_->Codegen(); |
| 370 if (optimized_code.is_null()) return AbortOptimization(); | 371 if (optimized_code.is_null()) return AbortOptimization(); |
| 371 info()->SetCode(optimized_code); | 372 info()->SetCode(optimized_code); |
| 372 RecordOptimizationStats(); | 373 RecordOptimizationStats(); |
| 374 Handle<String> name = info()->function()->debug_name(); |
| 375 VTUNEJIT(AddCode(Handle<String>(name), |
| 376 optimized_code, |
| 377 Handle<Script>(info()->script()))); |
| 373 return SetLastStatus(SUCCEEDED); | 378 return SetLastStatus(SUCCEEDED); |
| 374 } | 379 } |
| 375 | 380 |
| 376 | 381 |
| 377 static bool GenerateCode(CompilationInfo* info) { | 382 static bool GenerateCode(CompilationInfo* info) { |
| 378 bool is_optimizing = V8::UseCrankshaft() && | 383 bool is_optimizing = V8::UseCrankshaft() && |
| 379 !info->IsCompilingForDebugging() && | 384 !info->IsCompilingForDebugging() && |
| 380 info->IsOptimizing(); | 385 info->IsOptimizing(); |
| 381 if (is_optimizing) { | 386 if (is_optimizing) { |
| 382 return MakeCrankshaftCode(info); | 387 return MakeCrankshaftCode(info); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 info->is_eval() | 495 info->is_eval() |
| 491 ? Logger::EVAL_TAG | 496 ? Logger::EVAL_TAG |
| 492 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 497 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 493 *info->code(), | 498 *info->code(), |
| 494 *result, | 499 *result, |
| 495 String::cast(script->name()))); | 500 String::cast(script->name()))); |
| 496 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), | 501 GDBJIT(AddCode(Handle<String>(String::cast(script->name())), |
| 497 script, | 502 script, |
| 498 info->code(), | 503 info->code(), |
| 499 info)); | 504 info)); |
| 505 VTUNEJIT(AddCode(Handle<String>(String::cast(script->name())), |
| 506 info->code(), |
| 507 script)); |
| 500 } else { | 508 } else { |
| 501 PROFILE(isolate, CodeCreateEvent( | 509 PROFILE(isolate, CodeCreateEvent( |
| 502 info->is_eval() | 510 info->is_eval() |
| 503 ? Logger::EVAL_TAG | 511 ? Logger::EVAL_TAG |
| 504 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), | 512 : Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script), |
| 505 *info->code(), | 513 *info->code(), |
| 506 *result, | 514 *result, |
| 507 isolate->heap()->empty_string())); | 515 isolate->heap()->empty_string())); |
| 508 GDBJIT(AddCode(Handle<String>(), script, info->code(), info)); | 516 GDBJIT(AddCode(Handle<String>(), script, info->code(), info)); |
| 517 VTUNEJIT(AddCode(Handle<String>(isolate->heap()->empty_string()), |
| 518 info->code(), |
| 519 script)); |
| 509 } | 520 } |
| 510 | 521 |
| 511 // Hint to the runtime system used when allocating space for initial | 522 // Hint to the runtime system used when allocating space for initial |
| 512 // property space by setting the expected number of properties for | 523 // property space by setting the expected number of properties for |
| 513 // the instances of the function. | 524 // the instances of the function. |
| 514 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); | 525 SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count()); |
| 515 | 526 |
| 516 script->set_compilation_state( | 527 script->set_compilation_state( |
| 517 Smi::FromInt(Script::COMPILATION_STATE_COMPILED)); | 528 Smi::FromInt(Script::COMPILATION_STATE_COMPILED)); |
| 518 | 529 |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1024 *code, | 1035 *code, |
| 1025 *shared, | 1036 *shared, |
| 1026 shared->DebugName())); | 1037 shared->DebugName())); |
| 1027 } | 1038 } |
| 1028 } | 1039 } |
| 1029 | 1040 |
| 1030 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1041 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1031 Handle<Script>(info->script()), | 1042 Handle<Script>(info->script()), |
| 1032 Handle<Code>(info->code()), | 1043 Handle<Code>(info->code()), |
| 1033 info)); | 1044 info)); |
| 1045 if (tag == Logger::FUNCTION_TAG ) |
| 1046 VTUNEJIT(AddCode(Handle<String>(shared->DebugName()), |
| 1047 Handle<Code>(info->code()), |
| 1048 Handle<Script>(info->script()))); |
| 1034 } | 1049 } |
| 1035 | 1050 |
| 1036 } } // namespace v8::internal | 1051 } } // namespace v8::internal |
| OLD | NEW |