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

Unified Diff: src/ast/ast-numbering.cc

Issue 2676583002: [ic] Encode [Keyed]StoreIC's language mode in slot kind instead of code object's flags. (Closed)
Patch Set: Rebasing Created 3 years, 10 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
Index: src/ast/ast-numbering.cc
diff --git a/src/ast/ast-numbering.cc b/src/ast/ast-numbering.cc
index 96d5372dee2b691d3130eece05482ceb9e3ca5c1..d0522dfddbc3920e0f85e9686f57342e2d08405f 100644
--- a/src/ast/ast-numbering.cc
+++ b/src/ast/ast-numbering.cc
@@ -21,6 +21,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> {
next_id_(BailoutId::FirstUsable().ToInt()),
yield_count_(0),
properties_(zone),
+ language_mode_(SLOPPY),
slot_cache_(zone),
disable_crankshaft_reason_(kNoReason),
dont_optimize_reason_(kNoReason),
@@ -40,6 +41,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> {
void VisitPropertyReference(Property* node);
void VisitReference(Expression* expr);
+ void VisitStatementsAndDeclarations(Block* node);
void VisitStatements(ZoneList<Statement*>* statements);
void VisitDeclarations(Declaration::List* declarations);
void VisitArguments(ZoneList<Expression*>* arguments);
@@ -66,9 +68,23 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> {
template <typename Node>
void ReserveFeedbackSlots(Node* node) {
- node->AssignFeedbackVectorSlots(properties_.get_spec(), &slot_cache_);
+ node->AssignFeedbackVectorSlots(properties_.get_spec(), language_mode_,
+ &slot_cache_);
}
+ class LanguageModeScope {
+ public:
+ LanguageModeScope(AstNumberingVisitor* visitor, LanguageMode language_mode)
+ : visitor_(visitor), outer_language_mode_(visitor->language_mode_) {
+ visitor_->language_mode_ = language_mode;
+ }
+ ~LanguageModeScope() { visitor_->language_mode_ = outer_language_mode_; }
+
+ private:
+ AstNumberingVisitor* visitor_;
+ LanguageMode outer_language_mode_;
+ };
+
BailoutReason dont_optimize_reason() const { return dont_optimize_reason_; }
Zone* zone() const { return zone_; }
@@ -78,6 +94,7 @@ class AstNumberingVisitor final : public AstVisitor<AstNumberingVisitor> {
int next_id_;
int yield_count_;
AstProperties properties_;
+ LanguageMode language_mode_;
// The slot cache allows us to reuse certain feedback vector slots.
FeedbackVectorSlotCache slot_cache_;
BailoutReason disable_crankshaft_reason_;
@@ -249,10 +266,22 @@ void AstNumberingVisitor::VisitCountOperation(CountOperation* node) {
void AstNumberingVisitor::VisitBlock(Block* node) {
IncrementNodeCount();
node->set_base_id(ReserveIdRange(Block::num_ids()));
- if (node->scope() != NULL) VisitDeclarations(node->scope()->declarations());
- VisitStatements(node->statements());
+ Scope* scope = node->scope();
+ // TODO(ishell): remove scope->NeedsContext() condition once v8:5927 is fixed.
+ // Current logic mimics what BytecodeGenerator::VisitBlock() does.
+ if (scope != NULL && scope->NeedsContext()) {
+ LanguageModeScope language_mode_scope(this, scope->language_mode());
+ VisitStatementsAndDeclarations(node);
+ } else {
+ VisitStatementsAndDeclarations(node);
+ }
}
+void AstNumberingVisitor::VisitStatementsAndDeclarations(Block* node) {
+ Scope* scope = node->scope();
+ if (scope) VisitDeclarations(scope->declarations());
+ VisitStatements(node->statements());
+}
void AstNumberingVisitor::VisitFunctionDeclaration(FunctionDeclaration* node) {
IncrementNodeCount();
@@ -640,6 +669,8 @@ bool AstNumberingVisitor::Renumber(FunctionLiteral* node) {
DisableFullCodegenAndCrankshaft(kClassConstructorFunction);
}
+ LanguageModeScope language_mode_scope(this, node->language_mode());
+
VisitDeclarations(scope->declarations());
VisitStatements(node->body());
« no previous file with comments | « src/ast/ast.cc ('k') | src/builtins/builtins.h » ('j') | src/compiler/bytecode-graph-builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698