Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 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 | 49 |
| 50 #if V8_TARGET_ARCH_IA32 | |
| 51 #include "ia32/lithium-ia32.h" | |
|
danno
2012/07/12 11:14:54
Why do you need these? At this point, all of the c
sanjoy
2012/07/12 11:34:18
The register allocator needed an LChunk to operate
| |
| 52 #elif V8_TARGET_ARCH_X64 | |
| 53 #include "x64/lithium-x64.h" | |
| 54 #elif V8_TARGET_ARCH_ARM | |
| 55 #include "arm/lithium-arm.h" | |
| 56 #elif V8_TARGET_ARCH_MIPS | |
| 57 #include "mips/lithium-mips.h" | |
| 58 #else | |
| 59 #error "Unknown architecture." | |
| 60 #endif | |
| 61 | |
| 50 namespace v8 { | 62 namespace v8 { |
| 51 namespace internal { | 63 namespace internal { |
| 52 | 64 |
| 53 | 65 |
| 54 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) | 66 CompilationInfo::CompilationInfo(Handle<Script> script, Zone* zone) |
| 55 : isolate_(script->GetIsolate()), | 67 : isolate_(script->GetIsolate()), |
| 56 flags_(LanguageModeField::encode(CLASSIC_MODE)), | 68 flags_(LanguageModeField::encode(CLASSIC_MODE)), |
| 57 function_(NULL), | 69 function_(NULL), |
| 58 scope_(NULL), | 70 scope_(NULL), |
| 59 global_scope_(NULL), | 71 global_scope_(NULL), |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 info->zone()); | 313 info->zone()); |
| 302 HGraphBuilder builder(info, &oracle); | 314 HGraphBuilder builder(info, &oracle); |
| 303 HPhase phase(HPhase::kTotal); | 315 HPhase phase(HPhase::kTotal); |
| 304 HGraph* graph = builder.CreateGraph(); | 316 HGraph* graph = builder.CreateGraph(); |
| 305 if (info->isolate()->has_pending_exception()) { | 317 if (info->isolate()->has_pending_exception()) { |
| 306 info->SetCode(Handle<Code>::null()); | 318 info->SetCode(Handle<Code>::null()); |
| 307 return false; | 319 return false; |
| 308 } | 320 } |
| 309 | 321 |
| 310 if (graph != NULL) { | 322 if (graph != NULL) { |
| 311 Handle<Code> optimized_code = graph->Compile(); | 323 SmartArrayPointer<char> bailout_reason; |
| 312 if (!optimized_code.is_null()) { | 324 if (!graph->Optimize(&bailout_reason)) { |
| 313 info->SetCode(optimized_code); | 325 if (!bailout_reason.is_empty()) builder.Bailout(*bailout_reason); |
| 314 FinishOptimization(info->closure(), start); | 326 } else { |
| 315 return true; | 327 LChunk* chunk = LChunkBase::NewChunk(graph); |
| 328 if (chunk != NULL) { | |
| 329 Handle<Code> optimized_code = chunk->Codegen(); | |
| 330 if (!optimized_code.is_null()) { | |
| 331 info->SetCode(optimized_code); | |
| 332 FinishOptimization(info->closure(), start); | |
| 333 return true; | |
| 334 } | |
| 335 } | |
| 316 } | 336 } |
| 317 } | 337 } |
| 318 | 338 |
| 319 // Keep using the shared code. | 339 // Keep using the shared code. |
| 320 info->AbortOptimization(); | 340 info->AbortOptimization(); |
| 321 if (!builder.inline_bailout()) { | 341 if (!builder.inline_bailout()) { |
| 322 // Mark the shared code as unoptimizable unless it was an inlined | 342 // Mark the shared code as unoptimizable unless it was an inlined |
| 323 // function that bailed out. | 343 // function that bailed out. |
| 324 info->shared_info()->DisableOptimization(); | 344 info->shared_info()->DisableOptimization(); |
| 325 } | 345 } |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 870 } | 890 } |
| 871 } | 891 } |
| 872 | 892 |
| 873 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 893 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
| 874 Handle<Script>(info->script()), | 894 Handle<Script>(info->script()), |
| 875 Handle<Code>(info->code()), | 895 Handle<Code>(info->code()), |
| 876 info)); | 896 info)); |
| 877 } | 897 } |
| 878 | 898 |
| 879 } } // namespace v8::internal | 899 } } // namespace v8::internal |
| OLD | NEW |