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

Unified Diff: src/ast/ast.cc

Issue 2445333002: Ensure slow properties for simple {__proto__:null} literals. (Closed)
Patch Set: updated bytecode expectations Created 3 years, 9 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
« src/ast/ast.h ('K') | « src/ast/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.cc
diff --git a/src/ast/ast.cc b/src/ast/ast.cc
index 5b98e3165447f69f292b898139d85d8ab5161b6c..8e847c4c86e20e049093f2d2d155b4f28d033421 100644
--- a/src/ast/ast.cc
+++ b/src/ast/ast.cc
@@ -490,7 +490,7 @@ void ObjectLiteral::AssignFeedbackSlots(FeedbackVectorSpec* spec,
ObjectLiteral::Property* property = properties()->at(property_index);
Expression* value = property->value();
- if (property->kind() != ObjectLiteral::Property::PROTOTYPE) {
+ if (!property->IsPrototype()) {
if (FunctionLiteral::NeedsHomeObject(value)) {
property->SetSlot(spec->AddStoreICSlot(language_mode));
}
@@ -512,7 +512,7 @@ void ObjectLiteral::CalculateEmitStore(Zone* zone) {
for (int i = properties()->length() - 1; i >= 0; i--) {
ObjectLiteral::Property* property = properties()->at(i);
if (property->is_computed_name()) continue;
- if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue;
+ if (property->IsPrototype()) continue;
Literal* literal = property->key()->AsLiteral();
DCHECK(!literal->IsNullLiteral());
@@ -534,8 +534,7 @@ void ObjectLiteral::CalculateEmitStore(Zone* zone) {
bool ObjectLiteral::IsBoilerplateProperty(ObjectLiteral::Property* property) {
- return property != NULL &&
- property->kind() != ObjectLiteral::Property::PROTOTYPE;
+ return property != NULL && !property->IsPrototype();
}
void ObjectLiteral::InitDepthAndFlags() {
@@ -550,6 +549,9 @@ void ObjectLiteral::InitDepthAndFlags() {
for (int i = 0; i < properties()->length(); i++) {
ObjectLiteral::Property* property = properties()->at(i);
if (!IsBoilerplateProperty(property)) {
+ // __proto__:null at the first position has no side-effects and is set
adamk 2017/03/13 18:10:44 Why do you say "first position"? The placement of
+ // directly on the boilerplate.
+ if (property->IsNullPrototype()) continue;
is_simple = false;
continue;
}
« src/ast/ast.h ('K') | « src/ast/ast.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698