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 2142333002: Refactor class declaration logic to the parser and runtime Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor cleanup per Adam Created 4 years, 5 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/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | src/ast/ast.cc » ('J')
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 a89fc24fa0364887c572ae129c4da263c79ed370..7bcbffca92b7aad611b4b8196d7675f2bce6fc36 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -87,7 +87,6 @@ namespace internal {
PROPERTY_NODE_LIST(V) \
CALL_NODE_LIST(V) \
V(FunctionLiteral) \
- V(ClassLiteral) \
V(NativeFunctionLiteral) \
V(Conditional) \
V(VariableProxy) \
@@ -479,10 +478,19 @@ class DoExpression final : public Expression {
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), block_(block), result_(result) {
+ : Expression(zone, pos),
+ block_(block),
+ result_(result),
+ represented_function_(nullptr) {
DCHECK_NOT_NULL(block_);
DCHECK_NOT_NULL(result_);
}
@@ -493,6 +501,7 @@ class DoExpression final : public Expression {
Block* block_;
VariableProxy* result_;
+ FunctionLiteral* represented_function_;
};
@@ -2735,81 +2744,6 @@ class FunctionLiteral final : public Expression {
};
-class ClassLiteral final : public Expression {
- public:
- typedef ObjectLiteralProperty Property;
-
- 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; }
- FunctionLiteral* constructor() const { return constructor_; }
- void set_constructor(FunctionLiteral* f) { constructor_ = f; }
- ZoneList<Property*>* properties() const { return properties_; }
- int start_position() const { return position(); }
- int end_position() const { return end_position_; }
-
- 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 + 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() + 5 + properties()->length(); }
-
- // Object literals need one feedback slot for each non-trivial value, as well
- // as some slots for home objects.
- void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
- FeedbackVectorSlotCache* cache);
-
- bool NeedsProxySlot() const {
- return class_variable_proxy() != nullptr &&
- class_variable_proxy()->var()->IsUnallocated();
- }
-
- FeedbackVectorSlot PrototypeSlot() const { return prototype_slot_; }
- FeedbackVectorSlot ProxySlot() const { return proxy_slot_; }
-
- 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),
- scope_(scope),
- class_variable_proxy_(class_variable_proxy),
- extends_(extends),
- constructor_(constructor),
- properties_(properties),
- end_position_(end_position) {}
-
- static int parent_num_ids() { return Expression::num_ids(); }
-
- private:
- int local_id(int n) const { return base_id() + parent_num_ids() + n; }
-
- Scope* scope_;
- VariableProxy* class_variable_proxy_;
- Expression* extends_;
- FunctionLiteral* constructor_;
- ZoneList<Property*>* properties_;
- int end_position_;
- FeedbackVectorSlot prototype_slot_;
- FeedbackVectorSlot proxy_slot_;
-};
-
-
class NativeFunctionLiteral final : public Expression {
public:
DECLARE_NODE_TYPE(NativeFunctionLiteral)
@@ -3432,16 +3366,6 @@ class AstNodeFactory final BASE_EMBEDDED {
false);
}
- ClassLiteral* NewClassLiteral(Scope* scope, VariableProxy* proxy,
- Expression* extends,
- FunctionLiteral* constructor,
- ZoneList<ObjectLiteral::Property*>* properties,
- int start_position, int end_position) {
- return new (parser_zone_)
- ClassLiteral(parser_zone_, scope, proxy, extends, constructor,
- properties, start_position, end_position);
- }
-
NativeFunctionLiteral* NewNativeFunctionLiteral(const AstRawString* name,
v8::Extension* extension,
int pos) {
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast.cc » ('j') | src/ast/ast.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698