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

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

Issue 1220823004: [turbofan]: Add a context relaxation Reducer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 5 months 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 input_buffer_(nullptr), 445 input_buffer_(nullptr),
446 exit_controls_(local_zone), 446 exit_controls_(local_zone),
447 loop_assignment_analysis_(loop), 447 loop_assignment_analysis_(loop),
448 state_values_cache_(jsgraph), 448 state_values_cache_(jsgraph),
449 liveness_analyzer_(static_cast<size_t>(info->scope()->num_stack_slots()), 449 liveness_analyzer_(static_cast<size_t>(info->scope()->num_stack_slots()),
450 local_zone), 450 local_zone),
451 frame_state_function_info_(common()->CreateFrameStateFunctionInfo( 451 frame_state_function_info_(common()->CreateFrameStateFunctionInfo(
452 FrameStateType::kJavaScriptFunction, 452 FrameStateType::kJavaScriptFunction,
453 info->num_parameters_including_this(), 453 info->num_parameters_including_this(),
454 info->scope()->num_stack_slots(), info->shared_info())), 454 info->scope()->num_stack_slots(), info->shared_info())),
455 js_type_feedback_(js_type_feedback) { 455 js_type_feedback_(js_type_feedback),
456 relaxed_context_(nullptr) {
456 InitializeAstVisitor(info->isolate(), local_zone); 457 InitializeAstVisitor(info->isolate(), local_zone);
457 } 458 }
458 459
459 460
460 Node* AstGraphBuilder::GetFunctionClosureForContext() { 461 Node* AstGraphBuilder::GetFunctionClosureForContext() {
461 Scope* declaration_scope = current_scope()->DeclarationScope(); 462 Scope* declaration_scope = current_scope()->DeclarationScope();
462 if (declaration_scope->is_script_scope() || 463 if (declaration_scope->is_script_scope() ||
463 declaration_scope->is_module_scope()) { 464 declaration_scope->is_module_scope()) {
464 // Contexts nested in the native context have a canonical empty function as 465 // Contexts nested in the native context have a canonical empty function as
465 // their closure, not the anonymous closure containing the global code. 466 // their closure, not the anonymous closure containing the global code.
(...skipping 11 matching lines...) Expand all
477 const Operator* op = common()->Parameter( 478 const Operator* op = common()->Parameter(
478 Linkage::kJSFunctionCallClosureParamIndex, "%closure"); 479 Linkage::kJSFunctionCallClosureParamIndex, "%closure");
479 Node* node = NewNode(op, graph()->start()); 480 Node* node = NewNode(op, graph()->start());
480 function_closure_.set(node); 481 function_closure_.set(node);
481 } 482 }
482 return function_closure_.get(); 483 return function_closure_.get();
483 } 484 }
484 485
485 486
486 void AstGraphBuilder::CreateFunctionContext(bool constant_context) { 487 void AstGraphBuilder::CreateFunctionContext(bool constant_context) {
488 relaxed_context_ = NewOuterContextParam();
487 function_context_.set(constant_context 489 function_context_.set(constant_context
488 ? jsgraph()->HeapConstant(info()->context()) 490 ? jsgraph()->HeapConstant(info()->context())
489 : NewOuterContextParam()); 491 : relaxed_context_);
490 } 492 }
491 493
492 494
493 Node* AstGraphBuilder::NewOuterContextParam() { 495 Node* AstGraphBuilder::NewOuterContextParam() {
494 // Parameter (arity + 1) is special for the outer context of the function 496 // Parameter (arity + 1) is special for the outer context of the function
495 const Operator* op = 497 const Operator* op =
496 common()->Parameter(info()->num_parameters_including_this(), "%context"); 498 common()->Parameter(info()->num_parameters_including_this(), "%context");
497 return NewNode(op, graph()->start()); 499 return NewNode(op, graph()->start());
498 } 500 }
499 501
(...skipping 3677 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 // Phi does not exist yet, introduce one. 4179 // Phi does not exist yet, introduce one.
4178 value = NewPhi(inputs, value, control); 4180 value = NewPhi(inputs, value, control);
4179 value->ReplaceInput(inputs - 1, other); 4181 value->ReplaceInput(inputs - 1, other);
4180 } 4182 }
4181 return value; 4183 return value;
4182 } 4184 }
4183 4185
4184 } // namespace compiler 4186 } // namespace compiler
4185 } // namespace internal 4187 } // namespace internal
4186 } // namespace v8 4188 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698