| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 329 } |
| 330 | 330 |
| 331 | 331 |
| 332 bool CompilationInfo::is_simple_parameter_list() { | 332 bool CompilationInfo::is_simple_parameter_list() { |
| 333 return scope_->is_simple_parameter_list(); | 333 return scope_->is_simple_parameter_list(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 | 336 |
| 337 int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, | 337 int CompilationInfo::TraceInlinedFunction(Handle<SharedFunctionInfo> shared, |
| 338 SourcePosition position) { | 338 SourcePosition position) { |
| 339 if (!FLAG_hydrogen_track_positions) { | 339 DCHECK(FLAG_hydrogen_track_positions); |
| 340 return 0; | |
| 341 } | |
| 342 | 340 |
| 343 DCHECK(inlined_function_infos_); | 341 DCHECK(inlined_function_infos_); |
| 344 DCHECK(inlining_id_to_function_id_); | 342 DCHECK(inlining_id_to_function_id_); |
| 345 int id = 0; | 343 int id = 0; |
| 346 for (; id < inlined_function_infos_->length(); id++) { | 344 for (; id < inlined_function_infos_->length(); id++) { |
| 347 if (inlined_function_infos_->at(id).shared().is_identical_to(shared)) { | 345 if (inlined_function_infos_->at(id).shared().is_identical_to(shared)) { |
| 348 break; | 346 break; |
| 349 } | 347 } |
| 350 } | 348 } |
| 351 if (id == inlined_function_infos_->length()) { | 349 if (id == inlined_function_infos_->length()) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 return inline_id; | 386 return inline_id; |
| 389 } | 387 } |
| 390 | 388 |
| 391 | 389 |
| 392 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { | 390 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { |
| 393 public: | 391 public: |
| 394 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) | 392 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) |
| 395 : HOptimizedGraphBuilder(info) { | 393 : HOptimizedGraphBuilder(info) { |
| 396 } | 394 } |
| 397 | 395 |
| 398 #define DEF_VISIT(type) \ | 396 #define DEF_VISIT(type) \ |
| 399 void Visit##type(type* node) OVERRIDE { \ | 397 void Visit##type(type* node) OVERRIDE { \ |
| 400 if (node->position() != RelocInfo::kNoPosition) { \ | 398 SourcePosition old_position = SourcePosition::Unknown(); \ |
| 401 SetSourcePosition(node->position()); \ | 399 if (node->position() != RelocInfo::kNoPosition) { \ |
| 402 } \ | 400 old_position = source_position(); \ |
| 403 HOptimizedGraphBuilder::Visit##type(node); \ | 401 SetSourcePosition(node->position()); \ |
| 402 } \ |
| 403 HOptimizedGraphBuilder::Visit##type(node); \ |
| 404 if (!old_position.IsUnknown()) { \ |
| 405 set_source_position(old_position); \ |
| 406 } \ |
| 404 } | 407 } |
| 405 EXPRESSION_NODE_LIST(DEF_VISIT) | 408 EXPRESSION_NODE_LIST(DEF_VISIT) |
| 406 #undef DEF_VISIT | 409 #undef DEF_VISIT |
| 407 | 410 |
| 408 #define DEF_VISIT(type) \ | 411 #define DEF_VISIT(type) \ |
| 409 void Visit##type(type* node) OVERRIDE { \ | 412 void Visit##type(type* node) OVERRIDE { \ |
| 410 if (node->position() != RelocInfo::kNoPosition) { \ | 413 SourcePosition old_position = SourcePosition::Unknown(); \ |
| 411 SetSourcePosition(node->position()); \ | 414 if (node->position() != RelocInfo::kNoPosition) { \ |
| 412 } \ | 415 old_position = source_position(); \ |
| 413 HOptimizedGraphBuilder::Visit##type(node); \ | 416 SetSourcePosition(node->position()); \ |
| 417 } \ |
| 418 HOptimizedGraphBuilder::Visit##type(node); \ |
| 419 if (!old_position.IsUnknown()) { \ |
| 420 set_source_position(old_position); \ |
| 421 } \ |
| 414 } | 422 } |
| 415 STATEMENT_NODE_LIST(DEF_VISIT) | 423 STATEMENT_NODE_LIST(DEF_VISIT) |
| 416 #undef DEF_VISIT | 424 #undef DEF_VISIT |
| 417 | 425 |
| 418 #define DEF_VISIT(type) \ | 426 #define DEF_VISIT(type) \ |
| 419 void Visit##type(type* node) OVERRIDE { \ | 427 void Visit##type(type* node) OVERRIDE { \ |
| 420 HOptimizedGraphBuilder::Visit##type(node); \ | 428 HOptimizedGraphBuilder::Visit##type(node); \ |
| 421 } | 429 } |
| 422 MODULE_NODE_LIST(DEF_VISIT) | 430 MODULE_NODE_LIST(DEF_VISIT) |
| 423 DECLARATION_NODE_LIST(DEF_VISIT) | 431 DECLARATION_NODE_LIST(DEF_VISIT) |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 } | 1609 } |
| 1602 | 1610 |
| 1603 | 1611 |
| 1604 #if DEBUG | 1612 #if DEBUG |
| 1605 void CompilationInfo::PrintAstForTesting() { | 1613 void CompilationInfo::PrintAstForTesting() { |
| 1606 PrintF("--- Source from AST ---\n%s\n", | 1614 PrintF("--- Source from AST ---\n%s\n", |
| 1607 PrettyPrinter(isolate(), zone()).PrintProgram(function())); | 1615 PrettyPrinter(isolate(), zone()).PrintProgram(function())); |
| 1608 } | 1616 } |
| 1609 #endif | 1617 #endif |
| 1610 } } // namespace v8::internal | 1618 } } // namespace v8::internal |
| OLD | NEW |