diff options
Diffstat (limited to 'deps/v8/src/ast/ast.cc')
-rw-r--r-- | deps/v8/src/ast/ast.cc | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/deps/v8/src/ast/ast.cc b/deps/v8/src/ast/ast.cc index 69e7351a7d..9b2c6388c1 100644 --- a/deps/v8/src/ast/ast.cc +++ b/deps/v8/src/ast/ast.cc @@ -5,6 +5,8 @@ #include "src/ast/ast.h" #include <cmath> // For isfinite. + +#include "src/ast/prettyprinter.h" #include "src/ast/scopes.h" #include "src/builtins.h" #include "src/code-stubs.h" @@ -32,6 +34,25 @@ AST_NODE_LIST(DECL_ACCEPT) // ---------------------------------------------------------------------------- // Implementation of other node functionality. +#ifdef DEBUG + +void AstNode::Print() { Print(Isolate::Current()); } + + +void AstNode::Print(Isolate* isolate) { + AstPrinter::PrintOut(isolate, this); +} + + +void AstNode::PrettyPrint() { PrettyPrint(Isolate::Current()); } + + +void AstNode::PrettyPrint(Isolate* isolate) { + PrettyPrinter::PrintOut(isolate, this); +} + +#endif // DEBUG + bool Expression::IsSmiLiteral() const { return IsLiteral() && AsLiteral()->value()->IsSmi(); @@ -254,14 +275,21 @@ ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory, } } +bool ObjectLiteralProperty::NeedsSetFunctionName() const { + return is_computed_name_ && + (value_->IsAnonymousFunctionDefinition() || + (value_->IsFunctionLiteral() && + IsConciseMethod(value_->AsFunctionLiteral()->kind()))); +} void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, FeedbackVectorSlotCache* cache) { // This logic that computes the number of slots needed for vector store // ICs must mirror FullCodeGenerator::VisitClassLiteral. + prototype_slot_ = spec->AddLoadICSlot(); if (NeedsProxySlot()) { - slot_ = spec->AddStoreICSlot(); + proxy_slot_ = spec->AddStoreICSlot(); } for (int i = 0; i < properties()->length(); i++) { @@ -476,10 +504,11 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) { void ArrayLiteral::BuildConstantElements(Isolate* isolate) { + DCHECK_LT(first_spread_index_, 0); + if (!constant_elements_.is_null()) return; - int constants_length = - first_spread_index_ >= 0 ? first_spread_index_ : values()->length(); + int constants_length = values()->length(); // Allocate a fixed array to hold all the object literals. Handle<JSArray> array = isolate->factory()->NewJSArray( @@ -487,7 +516,7 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) { Strength::WEAK, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); // Fill in the literals. - bool is_simple = (first_spread_index_ < 0); + bool is_simple = true; int depth_acc = 1; bool is_holey = false; int array_index = 0; @@ -553,7 +582,7 @@ void ArrayLiteral::AssignFeedbackVectorSlots(Isolate* isolate, int array_index = 0; for (; array_index < values()->length(); array_index++) { Expression* subexpr = values()->at(array_index); - if (subexpr->IsSpread()) break; + DCHECK(!subexpr->IsSpread()); if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; // We'll reuse the same literal slot for all of the non-constant @@ -797,14 +826,12 @@ void AstVisitor::VisitExpressions(ZoneList<Expression*>* expressions) { } } - CaseClause::CaseClause(Zone* zone, Expression* label, ZoneList<Statement*>* statements, int pos) : Expression(zone, pos), label_(label), statements_(statements), - compare_type_(Type::None(zone)) {} - + compare_type_(Type::None()) {} uint32_t Literal::Hash() { return raw_value()->IsString() |