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

Side by Side Diff: src/compiler/bytecode-graph-builder.cc

Issue 2465913002: [turbofan] Move OSR BailoutId translation into graph builder. (Closed)
Patch Set: Addressed comments. Created 4 years 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
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/runtime/runtime-compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/compiler-source-position-table.h" 10 #include "src/compiler/compiler-source-position-table.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 invocation_frequency_(invocation_frequency), 458 invocation_frequency_(invocation_frequency),
459 bytecode_array_(handle(info->shared_info()->bytecode_array())), 459 bytecode_array_(handle(info->shared_info()->bytecode_array())),
460 exception_handler_table_( 460 exception_handler_table_(
461 handle(HandlerTable::cast(bytecode_array()->handler_table()))), 461 handle(HandlerTable::cast(bytecode_array()->handler_table()))),
462 feedback_vector_(handle(info->closure()->feedback_vector())), 462 feedback_vector_(handle(info->closure()->feedback_vector())),
463 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( 463 frame_state_function_info_(common()->CreateFrameStateFunctionInfo(
464 FrameStateType::kInterpretedFunction, 464 FrameStateType::kInterpretedFunction,
465 bytecode_array()->parameter_count(), 465 bytecode_array()->parameter_count(),
466 bytecode_array()->register_count(), info->shared_info())), 466 bytecode_array()->register_count(), info->shared_info())),
467 osr_ast_id_(info->osr_ast_id()), 467 osr_ast_id_(info->osr_ast_id()),
468 osr_loop_offset_(-1),
468 merge_environments_(local_zone), 469 merge_environments_(local_zone),
469 exception_handlers_(local_zone), 470 exception_handlers_(local_zone),
470 current_exception_handler_(0), 471 current_exception_handler_(0),
471 input_buffer_size_(0), 472 input_buffer_size_(0),
472 input_buffer_(nullptr), 473 input_buffer_(nullptr),
473 exit_controls_(local_zone), 474 exit_controls_(local_zone),
474 is_liveness_analysis_enabled_(FLAG_analyze_environment_liveness), 475 is_liveness_analysis_enabled_(FLAG_analyze_environment_liveness),
475 state_values_cache_(jsgraph), 476 state_values_cache_(jsgraph),
476 source_positions_(source_positions), 477 source_positions_(source_positions),
477 start_position_(info->shared_info()->start_position(), inlining_id) { 478 start_position_(info->shared_info()->start_position(), inlining_id) {
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 } 1886 }
1886 set_environment(nullptr); 1887 set_environment(nullptr);
1887 } 1888 }
1888 1889
1889 void BytecodeGraphBuilder::MergeControlToLeaveFunction(Node* exit) { 1890 void BytecodeGraphBuilder::MergeControlToLeaveFunction(Node* exit) {
1890 exit_controls_.push_back(exit); 1891 exit_controls_.push_back(exit);
1891 set_environment(nullptr); 1892 set_environment(nullptr);
1892 } 1893 }
1893 1894
1894 void BytecodeGraphBuilder::BuildOSRLoopEntryPoint(int current_offset) { 1895 void BytecodeGraphBuilder::BuildOSRLoopEntryPoint(int current_offset) {
1895 if (!osr_ast_id_.IsNone() && osr_ast_id_.ToInt() == current_offset) { 1896 if (!osr_ast_id_.IsNone() && osr_loop_offset_ == current_offset) {
1896 // For OSR add a special {OsrLoopEntry} node into the current loop header. 1897 // For OSR add a special {OsrLoopEntry} node into the current loop header.
1897 // It will be turned into a usable entry by the OSR deconstruction. 1898 // It will be turned into a usable entry by the OSR deconstruction.
1898 Environment* loop_env = merge_environments_[current_offset]; 1899 Environment* loop_env = merge_environments_[current_offset];
1899 Environment* osr_env = loop_env->CopyForOsrEntry(); 1900 Environment* osr_env = loop_env->CopyForOsrEntry();
1900 osr_env->PrepareForOsrEntry(); 1901 osr_env->PrepareForOsrEntry();
1901 loop_env->Merge(osr_env); 1902 loop_env->Merge(osr_env);
1902 } 1903 }
1903 } 1904 }
1904 1905
1905 void BytecodeGraphBuilder::BuildOSRNormalEntryPoint() { 1906 void BytecodeGraphBuilder::BuildOSRNormalEntryPoint() {
1906 if (!osr_ast_id_.IsNone()) { 1907 if (!osr_ast_id_.IsNone()) {
1907 // For OSR add an {OsrNormalEntry} as the the top-level environment start. 1908 // For OSR add an {OsrNormalEntry} as the the top-level environment start.
1908 // It will be replaced with {Dead} by the OSR deconstruction. 1909 // It will be replaced with {Dead} by the OSR deconstruction.
1909 NewNode(common()->OsrNormalEntry()); 1910 NewNode(common()->OsrNormalEntry());
1910 // Note that the requested OSR entry point must be the header of a loop. 1911 // Translate the offset of the jump instruction to the jump target offset of
1911 DCHECK(bytecode_analysis()->IsLoopHeader(osr_ast_id_.ToInt())); 1912 // that instruction so that the derived BailoutId points to the loop header.
1913 osr_loop_offset_ =
1914 bytecode_analysis()->GetLoopOffsetFor(osr_ast_id_.ToInt());
1915 DCHECK(bytecode_analysis()->IsLoopHeader(osr_loop_offset_));
1912 } 1916 }
1913 } 1917 }
1914 1918
1915 void BytecodeGraphBuilder::BuildLoopExitsForBranch(int target_offset) { 1919 void BytecodeGraphBuilder::BuildLoopExitsForBranch(int target_offset) {
1916 int origin_offset = bytecode_iterator().current_offset(); 1920 int origin_offset = bytecode_iterator().current_offset();
1917 // Only build loop exits for forward edges. 1921 // Only build loop exits for forward edges.
1918 if (target_offset > origin_offset) { 1922 if (target_offset > origin_offset) {
1919 BuildLoopExitsUntilLoop( 1923 BuildLoopExitsUntilLoop(
1920 bytecode_analysis()->GetLoopOffsetFor(target_offset)); 1924 bytecode_analysis()->GetLoopOffsetFor(target_offset));
1921 } 1925 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 it->source_position().ScriptOffset(), start_position_.InliningId())); 2194 it->source_position().ScriptOffset(), start_position_.InliningId()));
2191 it->Advance(); 2195 it->Advance();
2192 } else { 2196 } else {
2193 DCHECK_GT(it->code_offset(), offset); 2197 DCHECK_GT(it->code_offset(), offset);
2194 } 2198 }
2195 } 2199 }
2196 2200
2197 } // namespace compiler 2201 } // namespace compiler
2198 } // namespace internal 2202 } // namespace internal
2199 } // namespace v8 2203 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-graph-builder.h ('k') | src/runtime/runtime-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698