OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 3434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3445 maximum_environment_size_(0), | 3445 maximum_environment_size_(0), |
3446 no_side_effects_scope_count_(0), | 3446 no_side_effects_scope_count_(0), |
3447 disallow_adding_new_values_(false) { | 3447 disallow_adding_new_values_(false) { |
3448 if (info->IsStub()) { | 3448 if (info->IsStub()) { |
3449 CallInterfaceDescriptor descriptor = | 3449 CallInterfaceDescriptor descriptor = |
3450 info->code_stub()->GetCallInterfaceDescriptor(); | 3450 info->code_stub()->GetCallInterfaceDescriptor(); |
3451 start_environment_ = new (zone_) | 3451 start_environment_ = new (zone_) |
3452 HEnvironment(zone_, descriptor.GetEnvironmentParameterCount()); | 3452 HEnvironment(zone_, descriptor.GetEnvironmentParameterCount()); |
3453 } else { | 3453 } else { |
3454 if (FLAG_hydrogen_track_positions) { | 3454 if (FLAG_hydrogen_track_positions) { |
3455 info->TraceInlinedFunction(info->shared_info(), | 3455 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), |
3456 SourcePosition::Unknown()); | 3456 InlinedFunctionInfo::kNoParentId); |
3457 } | 3457 } |
3458 start_environment_ = | 3458 start_environment_ = |
3459 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); | 3459 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); |
3460 } | 3460 } |
3461 start_environment_->set_ast_id(BailoutId::FunctionEntry()); | 3461 start_environment_->set_ast_id(BailoutId::FunctionEntry()); |
3462 entry_block_ = CreateBasicBlock(); | 3462 entry_block_ = CreateBasicBlock(); |
3463 entry_block_->SetInitialEnvironment(start_environment_); | 3463 entry_block_->SetInitialEnvironment(start_environment_); |
3464 } | 3464 } |
3465 | 3465 |
3466 | 3466 |
(...skipping 13 matching lines...) Expand all Loading... |
3480 } | 3480 } |
3481 } | 3481 } |
3482 } | 3482 } |
3483 | 3483 |
3484 | 3484 |
3485 int HGraph::SourcePositionToScriptPosition(SourcePosition pos) { | 3485 int HGraph::SourcePositionToScriptPosition(SourcePosition pos) { |
3486 if (!FLAG_hydrogen_track_positions || pos.IsUnknown()) { | 3486 if (!FLAG_hydrogen_track_positions || pos.IsUnknown()) { |
3487 return pos.raw(); | 3487 return pos.raw(); |
3488 } | 3488 } |
3489 | 3489 |
3490 const int id = info()->inlining_id_to_function_id()->at(pos.inlining_id()); | 3490 return info()->inlined_function_infos()->at(pos.inlining_id()) |
3491 return info()->inlined_function_infos()->at(id).start_position() + | 3491 .start_position + pos.position(); |
3492 pos.position(); | |
3493 } | 3492 } |
3494 | 3493 |
3495 | 3494 |
3496 // Block ordering was implemented with two mutually recursive methods, | 3495 // Block ordering was implemented with two mutually recursive methods, |
3497 // HGraph::Postorder and HGraph::PostorderLoopBlocks. | 3496 // HGraph::Postorder and HGraph::PostorderLoopBlocks. |
3498 // The recursion could lead to stack overflow so the algorithm has been | 3497 // The recursion could lead to stack overflow so the algorithm has been |
3499 // implemented iteratively. | 3498 // implemented iteratively. |
3500 // At a high level the algorithm looks like this: | 3499 // At a high level the algorithm looks like this: |
3501 // | 3500 // |
3502 // Postorder(block, loop_header) : { | 3501 // Postorder(block, loop_header) : { |
(...skipping 4404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7907 // ---------------------------------------------------------------- | 7906 // ---------------------------------------------------------------- |
7908 // After this point, we've made a decision to inline this function (so | 7907 // After this point, we've made a decision to inline this function (so |
7909 // TryInline should always return true). | 7908 // TryInline should always return true). |
7910 | 7909 |
7911 // Type-check the inlined function. | 7910 // Type-check the inlined function. |
7912 DCHECK(target_shared->has_deoptimization_support()); | 7911 DCHECK(target_shared->has_deoptimization_support()); |
7913 AstTyper::Run(&target_info); | 7912 AstTyper::Run(&target_info); |
7914 | 7913 |
7915 int function_id = 0; | 7914 int function_id = 0; |
7916 if (FLAG_hydrogen_track_positions) { | 7915 if (FLAG_hydrogen_track_positions) { |
7917 function_id = | 7916 function_id = top_info()->TraceInlinedFunction( |
7918 top_info()->TraceInlinedFunction(target_shared, source_position()); | 7917 target_shared, source_position(), function_state()->inlining_id()); |
7919 } | 7918 } |
7920 | 7919 |
7921 // Save the pending call context. Set up new one for the inlined function. | 7920 // Save the pending call context. Set up new one for the inlined function. |
7922 // The function state is new-allocated because we need to delete it | 7921 // The function state is new-allocated because we need to delete it |
7923 // in two different places. | 7922 // in two different places. |
7924 FunctionState* target_state = new FunctionState( | 7923 FunctionState* target_state = new FunctionState( |
7925 this, &target_info, inlining_kind, function_id); | 7924 this, &target_info, inlining_kind, function_id); |
7926 | 7925 |
7927 HConstant* undefined = graph()->GetConstantUndefined(); | 7926 HConstant* undefined = graph()->GetConstantUndefined(); |
7928 | 7927 |
(...skipping 5434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13363 if (ShouldProduceTraceOutput()) { | 13362 if (ShouldProduceTraceOutput()) { |
13364 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13363 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13365 } | 13364 } |
13366 | 13365 |
13367 #ifdef DEBUG | 13366 #ifdef DEBUG |
13368 graph_->Verify(false); // No full verify. | 13367 graph_->Verify(false); // No full verify. |
13369 #endif | 13368 #endif |
13370 } | 13369 } |
13371 | 13370 |
13372 } } // namespace v8::internal | 13371 } } // namespace v8::internal |
OLD | NEW |