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

Unified Diff: src/ast/ast.h

Issue 2849773002: Revert of Wrap ClassLiterals in DoExpressions instead of giving them BlockScopes. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 3 years, 8 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 | « no previous file | src/ast/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 19e530c915912f5df9a28ca6581df7b6d8cc40d0..f0138723f540120eeaf1ff9cf772795130c7f590 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -474,18 +474,10 @@
void set_block(Block* b) { block_ = b; }
VariableProxy* result() { return result_; }
void set_result(VariableProxy* v) { result_ = v; }
- FunctionLiteral* represented_function() { return represented_function_; }
- void set_represented_function(FunctionLiteral* f) {
- represented_function_ = f;
- }
- bool IsAnonymousFunctionDefinition() const;
protected:
DoExpression(Zone* zone, Block* block, VariableProxy* result, int pos)
- : Expression(zone, pos, kDoExpression),
- block_(block),
- result_(result),
- represented_function_(nullptr) {
+ : Expression(zone, pos, kDoExpression), block_(block), result_(result) {
DCHECK_NOT_NULL(block_);
DCHECK_NOT_NULL(result_);
}
@@ -496,7 +488,6 @@
Block* block_;
VariableProxy* result_;
- FunctionLiteral* represented_function_;
};
@@ -2724,6 +2715,7 @@
DECLARE_NODE_TYPE(ClassLiteral)
+ Scope* scope() const { return scope_; }
VariableProxy* class_variable_proxy() const { return class_variable_proxy_; }
Expression* extends() const { return extends_; }
void set_extends(Expression* e) { extends_ = e; }
@@ -2733,15 +2725,18 @@
int start_position() const { return position(); }
int end_position() const { return end_position_; }
- BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); }
- BailoutId PrototypeId() { return BailoutId(local_id(1)); }
+ BailoutId EntryId() const { return BailoutId(local_id(0)); }
+ BailoutId DeclsId() const { return BailoutId(local_id(1)); }
+ BailoutId ExitId() { return BailoutId(local_id(2)); }
+ BailoutId CreateLiteralId() const { return BailoutId(local_id(3)); }
+ BailoutId PrototypeId() { return BailoutId(local_id(4)); }
// Return an AST id for a property that is used in simulate instructions.
- BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 2)); }
+ BailoutId GetIdForProperty(int i) { return BailoutId(local_id(i + 5)); }
// Unlike other AST nodes, this number of bailout IDs allocated for an
// ClassLiteral can vary, so num_ids() is not a static method.
- int num_ids() const { return parent_num_ids() + 2 + properties()->length(); }
+ int num_ids() const { return parent_num_ids() + 5 + properties()->length(); }
// Object literals need one feedback slot for each non-trivial value, as well
// as some slots for home objects.
@@ -2756,14 +2751,18 @@
FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; }
FeedbackVectorSlot ProxySlot() const { return proxy_slot_; }
-
- protected:
- ClassLiteral(Zone* zone, VariableProxy* class_variable_proxy,
+ bool IsAnonymousFunctionDefinition() const {
+ return constructor()->raw_name()->length() == 0;
+ }
+
+ protected:
+ ClassLiteral(Zone* zone, Scope* scope, VariableProxy* class_variable_proxy,
Expression* extends, FunctionLiteral* constructor,
ZoneList<Property*>* properties, int start_position,
int end_position)
: Expression(zone, start_position, kClassLiteral),
end_position_(end_position),
+ scope_(scope),
class_variable_proxy_(class_variable_proxy),
extends_(extends),
constructor_(constructor),
@@ -2777,6 +2776,7 @@
int end_position_;
FeedbackVectorSlot prototype_slot_;
FeedbackVectorSlot proxy_slot_;
+ Scope* scope_;
VariableProxy* class_variable_proxy_;
Expression* extends_;
FunctionLiteral* constructor_;
@@ -3425,13 +3425,14 @@
false);
}
- ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends,
+ ClassLiteral* NewClassLiteral(Scope* scope, VariableProxy* proxy,
+ Expression* extends,
FunctionLiteral* constructor,
ZoneList<ObjectLiteral::Property*>* properties,
int start_position, int end_position) {
return new (local_zone_)
- ClassLiteral(local_zone_, proxy, extends, constructor, properties,
- start_position, end_position);
+ ClassLiteral(local_zone_, scope, proxy, extends, constructor,
+ properties, start_position, end_position);
}
NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698