Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: src/compiler.cc

Issue 24957003: Add tool to visualize machine code/lithium. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Final polish before review Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 status = job.OptimizeGraph(); 306 status = job.OptimizeGraph();
307 if (status != RecompileJob::SUCCEEDED) { 307 if (status != RecompileJob::SUCCEEDED) {
308 status = job.AbortOptimization(); 308 status = job.AbortOptimization();
309 return status != RecompileJob::FAILED; 309 return status != RecompileJob::FAILED;
310 } 310 }
311 status = job.GenerateAndInstallCode(); 311 status = job.GenerateAndInstallCode();
312 return status != RecompileJob::FAILED; 312 return status != RecompileJob::FAILED;
313 } 313 }
314 314
315 315
316 class HOptimizedGraphBuilderWithPotisions: public HOptimizedGraphBuilder {
317 public:
318 explicit HOptimizedGraphBuilderWithPotisions(CompilationInfo* info)
319 : HOptimizedGraphBuilder(info) {
320 }
321
322 #define DEF_VISIT(type) \
323 virtual void Visit##type(type* node) V8_OVERRIDE { \
324 if (node->position() != RelocInfo::kNoPosition) { \
325 SetSourcePosition(node->position()); \
326 } \
327 HOptimizedGraphBuilder::Visit##type(node); \
328 }
329 EXPRESSION_NODE_LIST(DEF_VISIT)
330 #undef DEF_VISIT
331
332 #define DEF_VISIT(type) \
333 virtual void Visit##type(type* node) V8_OVERRIDE { \
334 if (node->position() != RelocInfo::kNoPosition) { \
335 SetSourcePosition(node->position()); \
336 } \
337 HOptimizedGraphBuilder::Visit##type(node); \
338 }
339 STATEMENT_NODE_LIST(DEF_VISIT)
340 #undef DEF_VISIT
341
342 #define DEF_VISIT(type) \
343 virtual void Visit##type(type* node) V8_OVERRIDE { \
344 HOptimizedGraphBuilder::Visit##type(node); \
345 }
346 MODULE_NODE_LIST(DEF_VISIT)
347 DECLARATION_NODE_LIST(DEF_VISIT)
348 AUXILIARY_NODE_LIST(DEF_VISIT)
349 #undef DEF_VISIT
350 };
351
352
316 RecompileJob::Status RecompileJob::CreateGraph() { 353 RecompileJob::Status RecompileJob::CreateGraph() {
317 ASSERT(isolate()->use_crankshaft()); 354 ASSERT(isolate()->use_crankshaft());
318 ASSERT(info()->IsOptimizing()); 355 ASSERT(info()->IsOptimizing());
319 ASSERT(!info()->IsCompilingForDebugging()); 356 ASSERT(!info()->IsCompilingForDebugging());
320 357
321 // We should never arrive here if there is no code object on the 358 // We should never arrive here if there is no code object on the
322 // shared function object. 359 // shared function object.
323 ASSERT(info()->shared_info()->code()->kind() == Code::FUNCTION); 360 ASSERT(info()->shared_info()->code()->kind() == Code::FUNCTION);
324 361
325 // We should never arrive here if optimization has been disabled on the 362 // We should never arrive here if optimization has been disabled on the
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (FLAG_trace_hydrogen) { 449 if (FLAG_trace_hydrogen) {
413 Handle<String> name = info()->function()->debug_name(); 450 Handle<String> name = info()->function()->debug_name();
414 PrintF("-----------------------------------------------------------\n"); 451 PrintF("-----------------------------------------------------------\n");
415 PrintF("Compiling method %s using hydrogen\n", *name->ToCString()); 452 PrintF("Compiling method %s using hydrogen\n", *name->ToCString());
416 isolate()->GetHTracer()->TraceCompilation(info()); 453 isolate()->GetHTracer()->TraceCompilation(info());
417 } 454 }
418 455
419 // Type-check the function. 456 // Type-check the function.
420 AstTyper::Run(info()); 457 AstTyper::Run(info());
421 458
422 graph_builder_ = new(info()->zone()) HOptimizedGraphBuilder(info()); 459 graph_builder_ = FLAG_opt_code_positions
460 ? new(info()->zone()) HOptimizedGraphBuilderWithPotisions(info())
461 : new(info()->zone()) HOptimizedGraphBuilder(info());
423 462
424 Timer t(this, &time_taken_to_create_graph_); 463 Timer t(this, &time_taken_to_create_graph_);
425 graph_ = graph_builder_->CreateGraph(); 464 graph_ = graph_builder_->CreateGraph();
426 465
427 if (isolate()->has_pending_exception()) { 466 if (isolate()->has_pending_exception()) {
428 info()->SetCode(Handle<Code>::null()); 467 info()->SetCode(Handle<Code>::null());
429 return SetLastStatus(FAILED); 468 return SetLastStatus(FAILED);
430 } 469 }
431 470
432 // The function being compiled may have bailed out due to an inline 471 // The function being compiled may have bailed out due to an inline
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 AllowHandleDereference allow_deref; 1319 AllowHandleDereference allow_deref;
1281 bool tracing_on = info()->IsStub() 1320 bool tracing_on = info()->IsStub()
1282 ? FLAG_trace_hydrogen_stubs 1321 ? FLAG_trace_hydrogen_stubs
1283 : (FLAG_trace_hydrogen && 1322 : (FLAG_trace_hydrogen &&
1284 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1323 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1285 return (tracing_on && 1324 return (tracing_on &&
1286 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1325 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1287 } 1326 }
1288 1327
1289 } } // namespace v8::internal 1328 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698