OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { | 320 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { |
321 public: | 321 public: |
322 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) | 322 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) |
323 : HOptimizedGraphBuilder(info) { | 323 : HOptimizedGraphBuilder(info) { |
324 } | 324 } |
325 | 325 |
326 #define DEF_VISIT(type) \ | 326 #define DEF_VISIT(type) \ |
327 void Visit##type(type* node) OVERRIDE { \ | 327 void Visit##type(type* node) override { \ |
328 SourcePosition old_position = SourcePosition::Unknown(); \ | 328 SourcePosition old_position = SourcePosition::Unknown(); \ |
329 if (node->position() != RelocInfo::kNoPosition) { \ | 329 if (node->position() != RelocInfo::kNoPosition) { \ |
330 old_position = source_position(); \ | 330 old_position = source_position(); \ |
331 SetSourcePosition(node->position()); \ | 331 SetSourcePosition(node->position()); \ |
332 } \ | 332 } \ |
333 HOptimizedGraphBuilder::Visit##type(node); \ | 333 HOptimizedGraphBuilder::Visit##type(node); \ |
334 if (!old_position.IsUnknown()) { \ | 334 if (!old_position.IsUnknown()) { \ |
335 set_source_position(old_position); \ | 335 set_source_position(old_position); \ |
336 } \ | 336 } \ |
337 } | 337 } |
338 EXPRESSION_NODE_LIST(DEF_VISIT) | 338 EXPRESSION_NODE_LIST(DEF_VISIT) |
339 #undef DEF_VISIT | 339 #undef DEF_VISIT |
340 | 340 |
341 #define DEF_VISIT(type) \ | 341 #define DEF_VISIT(type) \ |
342 void Visit##type(type* node) OVERRIDE { \ | 342 void Visit##type(type* node) override { \ |
343 SourcePosition old_position = SourcePosition::Unknown(); \ | 343 SourcePosition old_position = SourcePosition::Unknown(); \ |
344 if (node->position() != RelocInfo::kNoPosition) { \ | 344 if (node->position() != RelocInfo::kNoPosition) { \ |
345 old_position = source_position(); \ | 345 old_position = source_position(); \ |
346 SetSourcePosition(node->position()); \ | 346 SetSourcePosition(node->position()); \ |
347 } \ | 347 } \ |
348 HOptimizedGraphBuilder::Visit##type(node); \ | 348 HOptimizedGraphBuilder::Visit##type(node); \ |
349 if (!old_position.IsUnknown()) { \ | 349 if (!old_position.IsUnknown()) { \ |
350 set_source_position(old_position); \ | 350 set_source_position(old_position); \ |
351 } \ | 351 } \ |
352 } | 352 } |
353 STATEMENT_NODE_LIST(DEF_VISIT) | 353 STATEMENT_NODE_LIST(DEF_VISIT) |
354 #undef DEF_VISIT | 354 #undef DEF_VISIT |
355 | 355 |
356 #define DEF_VISIT(type) \ | 356 #define DEF_VISIT(type) \ |
357 void Visit##type(type* node) OVERRIDE { \ | 357 void Visit##type(type* node) override { \ |
358 HOptimizedGraphBuilder::Visit##type(node); \ | 358 HOptimizedGraphBuilder::Visit##type(node); \ |
359 } | 359 } |
360 MODULE_NODE_LIST(DEF_VISIT) | 360 MODULE_NODE_LIST(DEF_VISIT) |
361 DECLARATION_NODE_LIST(DEF_VISIT) | 361 DECLARATION_NODE_LIST(DEF_VISIT) |
362 #undef DEF_VISIT | 362 #undef DEF_VISIT |
363 }; | 363 }; |
364 | 364 |
365 | 365 |
366 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { | 366 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
367 DCHECK(info()->IsOptimizing()); | 367 DCHECK(info()->IsOptimizing()); |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 } | 1591 } |
1592 | 1592 |
1593 | 1593 |
1594 #if DEBUG | 1594 #if DEBUG |
1595 void CompilationInfo::PrintAstForTesting() { | 1595 void CompilationInfo::PrintAstForTesting() { |
1596 PrintF("--- Source from AST ---\n%s\n", | 1596 PrintF("--- Source from AST ---\n%s\n", |
1597 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1597 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
1598 } | 1598 } |
1599 #endif | 1599 #endif |
1600 } } // namespace v8::internal | 1600 } } // namespace v8::internal |
OLD | NEW |