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

Unified Diff: src/full-codegen/full-codegen.cc

Issue 2411873004: [ignition] Eliminate hole checks where statically possible for loads and stores (Closed)
Patch Set: Rebased Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/full-codegen.cc
diff --git a/src/full-codegen/full-codegen.cc b/src/full-codegen/full-codegen.cc
index 33a1cf3f57b7e5307cd43f86b747b04c5d71e4c0..2e94841f0abae3162abc6a87f3f433c9f3f25c0b 100644
--- a/src/full-codegen/full-codegen.cc
+++ b/src/full-codegen/full-codegen.cc
@@ -1982,65 +1982,6 @@ FullCodeGenerator::EnterBlockScopeIfNeeded::~EnterBlockScopeIfNeeded() {
codegen_->scope_ = saved_scope_;
}
-
-bool FullCodeGenerator::NeedsHoleCheckForLoad(VariableProxy* proxy) {
- Variable* var = proxy->var();
-
- if (!var->binding_needs_init()) {
- return false;
- }
-
- // var->scope() may be NULL when the proxy is located in eval code and
- // refers to a potential outside binding. Currently those bindings are
- // always looked up dynamically, i.e. in that case
- // var->location() == LOOKUP.
- // always holds.
- DCHECK(var->scope() != NULL);
- DCHECK(var->location() == VariableLocation::PARAMETER ||
- var->location() == VariableLocation::LOCAL ||
- var->location() == VariableLocation::CONTEXT);
-
- // Check if the binding really needs an initialization check. The check
- // can be skipped in the following situation: we have a LET or CONST
- // binding in harmony mode, both the Variable and the VariableProxy have
- // the same declaration scope (i.e. they are both in global code, in the
- // same function or in the same eval code), the VariableProxy is in
- // the source physically located after the initializer of the variable,
- // and that the initializer cannot be skipped due to a nonlinear scope.
- //
- // We cannot skip any initialization checks for CONST in non-harmony
- // mode because const variables may be declared but never initialized:
- // if (false) { const x; }; var y = x;
- //
- // The condition on the declaration scopes is a conservative check for
- // nested functions that access a binding and are called before the
- // binding is initialized:
- // function() { f(); let x = 1; function f() { x = 2; } }
- //
- // The check cannot be skipped on non-linear scopes, namely switch
- // scopes, to ensure tests are done in cases like the following:
- // switch (1) { case 0: let x = 2; case 1: f(x); }
- // The scope of the variable needs to be checked, in case the use is
- // in a sub-block which may be linear.
- if (var->scope()->GetDeclarationScope() != scope()->GetDeclarationScope()) {
- return true;
- }
-
- if (var->is_this()) {
- DCHECK(literal() != nullptr &&
- (literal()->kind() & kSubclassConstructor) != 0);
- // TODO(littledan): implement 'this' hole check elimination.
- return true;
- }
-
- // Check that we always have valid source position.
- DCHECK(var->initializer_position() != kNoSourcePosition);
- DCHECK(proxy->position() != kNoSourcePosition);
-
- return var->scope()->is_nonlinear() ||
- var->initializer_position() >= proxy->position();
-}
-
Handle<Script> FullCodeGenerator::script() { return info_->script(); }
LanguageMode FullCodeGenerator::language_mode() {
« no previous file with comments | « src/full-codegen/full-codegen.h ('k') | src/full-codegen/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698