Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 Scope* scope, AstNodeFactory<AstConstructionVisitor>* factory, int pos) { | 637 Scope* scope, AstNodeFactory<AstConstructionVisitor>* factory, int pos) { |
| 638 return factory->NewSuperReference( | 638 return factory->NewSuperReference( |
| 639 ThisExpression(scope, factory, pos)->AsVariableProxy(), | 639 ThisExpression(scope, factory, pos)->AsVariableProxy(), |
| 640 pos); | 640 pos); |
| 641 } | 641 } |
| 642 | 642 |
| 643 Expression* ParserTraits::ClassExpression( | 643 Expression* ParserTraits::ClassExpression( |
| 644 const AstRawString* name, Expression* extends, Expression* constructor, | 644 const AstRawString* name, Expression* extends, Expression* constructor, |
| 645 ZoneList<ObjectLiteral::Property*>* properties, int start_position, | 645 ZoneList<ObjectLiteral::Property*>* properties, int start_position, |
| 646 int end_position, AstNodeFactory<AstConstructionVisitor>* factory) { | 646 int end_position, AstNodeFactory<AstConstructionVisitor>* factory) { |
| 647 if (constructor == NULL) { | |
| 648 // Create default constructor. | |
| 649 Scope* scope = NewScope(parser_->scope_, FUNCTION_SCOPE); | |
| 650 // Set position and force eager compilation since lazy parsing tries to | |
|
arv (Not doing code reviews)
2014/11/04 17:53:05
This is not very good. Suggestions welcome.
Dmitry Lomov (no reviews)
2014/11/04 18:06:07
I believe we need a new kind of function: a flag o
| |
| 651 // parse the content which does not exist. | |
| 652 scope->set_start_position(0); | |
| 653 scope->set_end_position(0); | |
| 654 scope->SetScopeName(name); | |
| 655 scope->ForceEagerCompilation(); | |
| 656 constructor = factory->NewDefaultConstructor(name, ast_value_factory(), | |
| 657 scope, RelocInfo::kNoPosition); | |
| 658 } | |
| 647 return factory->NewClassLiteral(name, extends, constructor, properties, | 659 return factory->NewClassLiteral(name, extends, constructor, properties, |
| 648 start_position, end_position); | 660 start_position, end_position); |
| 649 } | 661 } |
| 650 | 662 |
| 663 | |
| 651 Literal* ParserTraits::ExpressionFromLiteral( | 664 Literal* ParserTraits::ExpressionFromLiteral( |
| 652 Token::Value token, int pos, | 665 Token::Value token, int pos, |
| 653 Scanner* scanner, | 666 Scanner* scanner, |
| 654 AstNodeFactory<AstConstructionVisitor>* factory) { | 667 AstNodeFactory<AstConstructionVisitor>* factory) { |
| 655 switch (token) { | 668 switch (token) { |
| 656 case Token::NULL_LITERAL: | 669 case Token::NULL_LITERAL: |
| 657 return factory->NewNullLiteral(pos); | 670 return factory->NewNullLiteral(pos); |
| 658 case Token::TRUE_LITERAL: | 671 case Token::TRUE_LITERAL: |
| 659 return factory->NewBooleanLiteral(true, pos); | 672 return factory->NewBooleanLiteral(true, pos); |
| 660 case Token::FALSE_LITERAL: | 673 case Token::FALSE_LITERAL: |
| (...skipping 4299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4960 | 4973 |
| 4961 // We cannot internalize on a background thread; a foreground task will take | 4974 // We cannot internalize on a background thread; a foreground task will take |
| 4962 // care of calling Parser::Internalize just before compilation. | 4975 // care of calling Parser::Internalize just before compilation. |
| 4963 | 4976 |
| 4964 if (compile_options() == ScriptCompiler::kProduceParserCache) { | 4977 if (compile_options() == ScriptCompiler::kProduceParserCache) { |
| 4965 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); | 4978 if (result != NULL) *info_->cached_data() = recorder.GetScriptData(); |
| 4966 log_ = NULL; | 4979 log_ = NULL; |
| 4967 } | 4980 } |
| 4968 } | 4981 } |
| 4969 } } // namespace v8::internal | 4982 } } // namespace v8::internal |
| OLD | NEW |