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 30 matching lines...) Expand all Loading... |
41 namespace internal { | 41 namespace internal { |
42 | 42 |
43 // Forward declarations. | 43 // Forward declarations. |
44 class BitVector; | 44 class BitVector; |
45 class FunctionState; | 45 class FunctionState; |
46 class HEnvironment; | 46 class HEnvironment; |
47 class HGraph; | 47 class HGraph; |
48 class HLoopInformation; | 48 class HLoopInformation; |
49 class HTracer; | 49 class HTracer; |
50 class LAllocator; | 50 class LAllocator; |
51 class LChunkBase; | 51 class LChunk; |
52 class LiveRange; | 52 class LiveRange; |
53 | 53 |
54 | 54 |
55 class HBasicBlock: public ZoneObject { | 55 class HBasicBlock: public ZoneObject { |
56 public: | 56 public: |
57 explicit HBasicBlock(HGraph* graph); | 57 explicit HBasicBlock(HGraph* graph); |
58 virtual ~HBasicBlock() { } | 58 virtual ~HBasicBlock() { } |
59 | 59 |
60 // Simple accessors. | 60 // Simple accessors. |
61 int block_id() const { return block_id_; } | 61 int block_id() const { return block_id_; } |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 | 1329 |
1330 class HPhase BASE_EMBEDDED { | 1330 class HPhase BASE_EMBEDDED { |
1331 public: | 1331 public: |
1332 static const char* const kFullCodeGen; | 1332 static const char* const kFullCodeGen; |
1333 static const char* const kTotal; | 1333 static const char* const kTotal; |
1334 | 1334 |
1335 explicit HPhase(const char* name) { Begin(name, NULL, NULL, NULL); } | 1335 explicit HPhase(const char* name) { Begin(name, NULL, NULL, NULL); } |
1336 HPhase(const char* name, HGraph* graph) { | 1336 HPhase(const char* name, HGraph* graph) { |
1337 Begin(name, graph, NULL, NULL); | 1337 Begin(name, graph, NULL, NULL); |
1338 } | 1338 } |
1339 HPhase(const char* name, LChunkBase* chunk) { | 1339 HPhase(const char* name, LChunk* chunk) { |
1340 Begin(name, NULL, chunk, NULL); | 1340 Begin(name, NULL, chunk, NULL); |
1341 } | 1341 } |
1342 HPhase(const char* name, LAllocator* allocator) { | 1342 HPhase(const char* name, LAllocator* allocator) { |
1343 Begin(name, NULL, NULL, allocator); | 1343 Begin(name, NULL, NULL, allocator); |
1344 } | 1344 } |
1345 | 1345 |
1346 ~HPhase() { | 1346 ~HPhase() { |
1347 End(); | 1347 End(); |
1348 } | 1348 } |
1349 | 1349 |
1350 private: | 1350 private: |
1351 void Begin(const char* name, | 1351 void Begin(const char* name, |
1352 HGraph* graph, | 1352 HGraph* graph, |
1353 LChunkBase* chunk, | 1353 LChunk* chunk, |
1354 LAllocator* allocator); | 1354 LAllocator* allocator); |
1355 void End() const; | 1355 void End() const; |
1356 | 1356 |
1357 int64_t start_; | 1357 int64_t start_; |
1358 const char* name_; | 1358 const char* name_; |
1359 HGraph* graph_; | 1359 HGraph* graph_; |
1360 LChunkBase* chunk_; | 1360 LChunk* chunk_; |
1361 LAllocator* allocator_; | 1361 LAllocator* allocator_; |
1362 unsigned start_allocation_size_; | 1362 unsigned start_allocation_size_; |
1363 }; | 1363 }; |
1364 | 1364 |
1365 | 1365 |
1366 class HTracer: public Malloced { | 1366 class HTracer: public Malloced { |
1367 public: | 1367 public: |
1368 void TraceCompilation(FunctionLiteral* function); | 1368 void TraceCompilation(FunctionLiteral* function); |
1369 void TraceHydrogen(const char* name, HGraph* graph); | 1369 void TraceHydrogen(const char* name, HGraph* graph); |
1370 void TraceLithium(const char* name, LChunkBase* chunk); | 1370 void TraceLithium(const char* name, LChunk* chunk); |
1371 void TraceLiveRanges(const char* name, LAllocator* allocator); | 1371 void TraceLiveRanges(const char* name, LAllocator* allocator); |
1372 | 1372 |
1373 static HTracer* Instance() { | 1373 static HTracer* Instance() { |
1374 static SetOncePointer<HTracer> instance; | 1374 static SetOncePointer<HTracer> instance; |
1375 if (!instance.is_set()) { | 1375 if (!instance.is_set()) { |
1376 instance.set(new HTracer("hydrogen.cfg")); | 1376 instance.set(new HTracer("hydrogen.cfg")); |
1377 } | 1377 } |
1378 return instance.get(); | 1378 return instance.get(); |
1379 } | 1379 } |
1380 | 1380 |
(...skipping 20 matching lines...) Expand all Loading... |
1401 HTracer* tracer_; | 1401 HTracer* tracer_; |
1402 const char* name_; | 1402 const char* name_; |
1403 }; | 1403 }; |
1404 | 1404 |
1405 explicit HTracer(const char* filename) | 1405 explicit HTracer(const char* filename) |
1406 : filename_(filename), trace_(&string_allocator_), indent_(0) { | 1406 : filename_(filename), trace_(&string_allocator_), indent_(0) { |
1407 WriteChars(filename, "", 0, false); | 1407 WriteChars(filename, "", 0, false); |
1408 } | 1408 } |
1409 | 1409 |
1410 void TraceLiveRange(LiveRange* range, const char* type, Zone* zone); | 1410 void TraceLiveRange(LiveRange* range, const char* type, Zone* zone); |
1411 void Trace(const char* name, HGraph* graph, LChunkBase* chunk); | 1411 void Trace(const char* name, HGraph* graph, LChunk* chunk); |
1412 void FlushToFile(); | 1412 void FlushToFile(); |
1413 | 1413 |
1414 void PrintEmptyProperty(const char* name) { | 1414 void PrintEmptyProperty(const char* name) { |
1415 PrintIndent(); | 1415 PrintIndent(); |
1416 trace_.Add("%s\n", name); | 1416 trace_.Add("%s\n", name); |
1417 } | 1417 } |
1418 | 1418 |
1419 void PrintStringProperty(const char* name, const char* value) { | 1419 void PrintStringProperty(const char* name, const char* value) { |
1420 PrintIndent(); | 1420 PrintIndent(); |
1421 trace_.Add("%s \"%s\"\n", name, value); | 1421 trace_.Add("%s \"%s\"\n", name, value); |
(...skipping 23 matching lines...) Expand all Loading... |
1445 const char* filename_; | 1445 const char* filename_; |
1446 HeapStringAllocator string_allocator_; | 1446 HeapStringAllocator string_allocator_; |
1447 StringStream trace_; | 1447 StringStream trace_; |
1448 int indent_; | 1448 int indent_; |
1449 }; | 1449 }; |
1450 | 1450 |
1451 | 1451 |
1452 } } // namespace v8::internal | 1452 } } // namespace v8::internal |
1453 | 1453 |
1454 #endif // V8_HYDROGEN_H_ | 1454 #endif // V8_HYDROGEN_H_ |
OLD | NEW |