[turbofan] Clarify comment about Parameter indexing.
This clarifies a comments in the AstGraphBuilder that has led to confusion about what "parameter index" refers to. The off-by-one is confusing and a terribly phrased comment doesn't make it any better. R=rmcilroy@chromium.org,oth@chromium.org Review URL: https://codereview.chromium.org/1329043002 Cr-Commit-Position: refs/heads/master@{#30616}
This commit is contained in:
parent
0e0c802858
commit
b48e0c4a58
@ -682,7 +682,8 @@ AstGraphBuilder::Environment::Environment(AstGraphBuilder* builder,
|
||||
}
|
||||
|
||||
// Bind all parameter variables. The parameter indices are shifted by 1
|
||||
// (receiver is parameter index -1 but environment index 0).
|
||||
// (receiver is variable index -1 but {Parameter} node index 0 and located at
|
||||
// index 0 in the environment).
|
||||
for (int i = 0; i < scope->num_parameters(); ++i) {
|
||||
const char* debug_name = GetDebugParameterName(graph()->zone(), scope, i);
|
||||
const Operator* op = common()->Parameter(param_num++, debug_name);
|
||||
@ -721,8 +722,8 @@ AstGraphBuilder::Environment::Environment(AstGraphBuilder::Environment* copy,
|
||||
void AstGraphBuilder::Environment::Bind(Variable* variable, Node* node) {
|
||||
DCHECK(variable->IsStackAllocated());
|
||||
if (variable->IsParameter()) {
|
||||
// The parameter indices are shifted by 1 (receiver is parameter
|
||||
// index -1 but environment index 0).
|
||||
// The parameter indices are shifted by 1 (receiver is variable
|
||||
// index -1 but located at index 0 in the environment).
|
||||
values()->at(variable->index() + 1) = node;
|
||||
} else {
|
||||
DCHECK(variable->IsStackLocal());
|
||||
@ -738,8 +739,8 @@ void AstGraphBuilder::Environment::Bind(Variable* variable, Node* node) {
|
||||
Node* AstGraphBuilder::Environment::Lookup(Variable* variable) {
|
||||
DCHECK(variable->IsStackAllocated());
|
||||
if (variable->IsParameter()) {
|
||||
// The parameter indices are shifted by 1 (receiver is parameter
|
||||
// index -1 but environment index 0).
|
||||
// The parameter indices are shifted by 1 (receiver is variable
|
||||
// index -1 but located at index 0 in the environment).
|
||||
return values()->at(variable->index() + 1);
|
||||
} else {
|
||||
DCHECK(variable->IsStackLocal());
|
||||
|
Loading…
Reference in New Issue
Block a user