OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 static bool GenerateCode(CompilationInfo* info) { | 317 static bool GenerateCode(CompilationInfo* info) { |
318 return info->IsCompilingForDebugging() || !V8::UseCrankshaft() ? | 318 return info->IsCompilingForDebugging() || !V8::UseCrankshaft() ? |
319 FullCodeGenerator::MakeCode(info) : | 319 FullCodeGenerator::MakeCode(info) : |
320 MakeCrankshaftCode(info); | 320 MakeCrankshaftCode(info); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 static bool MakeCode(CompilationInfo* info) { | 324 bool Compiler::MakeCode(CompilationInfo* info) { |
325 // Precondition: code has been parsed. Postcondition: the code field in | 325 // Precondition: code has been parsed. Postcondition: the code field in |
326 // the compilation info is set if compilation succeeded. | 326 // the compilation info is set if compilation succeeded. |
327 ASSERT(info->function() != NULL); | 327 ASSERT(info->function() != NULL); |
328 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); | 328 return Rewriter::Rewrite(info) && Scope::Analyze(info) && GenerateCode(info); |
329 } | 329 } |
330 | 330 |
331 | 331 |
332 #ifdef ENABLE_DEBUGGER_SUPPORT | 332 #ifdef ENABLE_DEBUGGER_SUPPORT |
333 bool Compiler::MakeCodeForLiveEdit(CompilationInfo* info) { | 333 bool Compiler::MakeCodeForLiveEdit(CompilationInfo* info) { |
334 // Precondition: code has been parsed. Postcondition: the code field in | 334 // Precondition: code has been parsed. Postcondition: the code field in |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // rest of the function into account to avoid overlap with the | 390 // rest of the function into account to avoid overlap with the |
391 // parsing statistics. | 391 // parsing statistics. |
392 HistogramTimer* rate = info->is_eval() | 392 HistogramTimer* rate = info->is_eval() |
393 ? info->isolate()->counters()->compile_eval() | 393 ? info->isolate()->counters()->compile_eval() |
394 : info->isolate()->counters()->compile(); | 394 : info->isolate()->counters()->compile(); |
395 HistogramTimerScope timer(rate); | 395 HistogramTimerScope timer(rate); |
396 | 396 |
397 // Compile the code. | 397 // Compile the code. |
398 FunctionLiteral* lit = info->function(); | 398 FunctionLiteral* lit = info->function(); |
399 LiveEditFunctionTracker live_edit_tracker(isolate, lit); | 399 LiveEditFunctionTracker live_edit_tracker(isolate, lit); |
400 if (!MakeCode(info)) { | 400 if (!Compiler::MakeCode(info)) { |
401 isolate->StackOverflow(); | 401 isolate->StackOverflow(); |
402 return Handle<SharedFunctionInfo>::null(); | 402 return Handle<SharedFunctionInfo>::null(); |
403 } | 403 } |
404 | 404 |
405 // Allocate function. | 405 // Allocate function. |
406 ASSERT(!info->code().is_null()); | 406 ASSERT(!info->code().is_null()); |
407 Handle<SharedFunctionInfo> result = | 407 Handle<SharedFunctionInfo> result = |
408 isolate->factory()->NewSharedFunctionInfo( | 408 isolate->factory()->NewSharedFunctionInfo( |
409 lit->name(), | 409 lit->name(), |
410 lit->materialized_literal_count(), | 410 lit->materialized_literal_count(), |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 } | 786 } |
787 } | 787 } |
788 | 788 |
789 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 789 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
790 Handle<Script>(info->script()), | 790 Handle<Script>(info->script()), |
791 Handle<Code>(info->code()), | 791 Handle<Code>(info->code()), |
792 info)); | 792 info)); |
793 } | 793 } |
794 | 794 |
795 } } // namespace v8::internal | 795 } } // namespace v8::internal |
OLD | NEW |