Reviewers: oth, rmcilroy,
Description:
[turbofan] Clarify comment about Parameter indexing.
This calrifies a comments in the AstGraphBuilder that has lead 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.
[email protected],[email protected]
Please review this at https://codereview.chromium.org/1329043002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+6, -5 lines):
M src/compiler/ast-graph-builder.cc
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
d3fe03704da37dd1b7da001bdb35193c20cf4acf..8fee623d1b39e7d20b599518c54e63e45c9b6f35
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -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());
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.