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

Side by Side Diff: src/parser.cc

Issue 352583008: Rollback to Version 3.28.4 (based on bleeding_edge revision r22031) (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/char-predicates-inl.h" 10 #include "src/char-predicates-inl.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 void ParserTraits::CheckPossibleEvalCall(Expression* expression, 446 void ParserTraits::CheckPossibleEvalCall(Expression* expression,
447 Scope* scope) { 447 Scope* scope) {
448 VariableProxy* callee = expression->AsVariableProxy(); 448 VariableProxy* callee = expression->AsVariableProxy();
449 if (callee != NULL && 449 if (callee != NULL &&
450 callee->raw_name() == parser_->ast_value_factory_->eval_string()) { 450 callee->raw_name() == parser_->ast_value_factory_->eval_string()) {
451 scope->DeclarationScope()->RecordEvalCall(); 451 scope->DeclarationScope()->RecordEvalCall();
452 } 452 }
453 } 453 }
454 454
455 455
456 Expression* ParserTraits::MarkExpressionAsAssigned(Expression* expression) { 456 Expression* ParserTraits::MarkExpressionAsLValue(Expression* expression) {
457 VariableProxy* proxy = 457 VariableProxy* proxy = expression != NULL
458 expression != NULL ? expression->AsVariableProxy() : NULL; 458 ? expression->AsVariableProxy()
459 if (proxy != NULL) proxy->set_is_assigned(); 459 : NULL;
460 if (proxy != NULL) proxy->MarkAsLValue();
460 return expression; 461 return expression;
461 } 462 }
462 463
463 464
464 bool ParserTraits::ShortcutNumericLiteralBinaryExpression( 465 bool ParserTraits::ShortcutNumericLiteralBinaryExpression(
465 Expression** x, Expression* y, Token::Value op, int pos, 466 Expression** x, Expression* y, Token::Value op, int pos,
466 AstNodeFactory<AstConstructionVisitor>* factory) { 467 AstNodeFactory<AstConstructionVisitor>* factory) {
467 if ((*x)->AsLiteral() && (*x)->AsLiteral()->raw_value()->IsNumber() && 468 if ((*x)->AsLiteral() && (*x)->AsLiteral()->raw_value()->IsNumber() &&
468 y->AsLiteral() && y->AsLiteral()->raw_value()->IsNumber()) { 469 y->AsLiteral() && y->AsLiteral()->raw_value()->IsNumber()) {
469 double x_val = (*x)->AsLiteral()->raw_value()->AsNumber(); 470 double x_val = (*x)->AsLiteral()->raw_value()->AsNumber();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 message, arg, pos); 586 message, arg, pos);
586 } 587 }
587 588
588 589
589 Expression* ParserTraits::NewThrowError( 590 Expression* ParserTraits::NewThrowError(
590 const AstRawString* constructor, const char* message, 591 const AstRawString* constructor, const char* message,
591 const AstRawString* arg, int pos) { 592 const AstRawString* arg, int pos) {
592 Zone* zone = parser_->zone(); 593 Zone* zone = parser_->zone();
593 int argc = arg != NULL ? 1 : 0; 594 int argc = arg != NULL ? 1 : 0;
594 const AstRawString* type = 595 const AstRawString* type =
595 parser_->ast_value_factory_->GetOneByteString(message); 596 parser_->ast_value_factory_->GetOneByteString(Vector<const uint8_t>(
597 reinterpret_cast<const uint8_t*>(message), StrLength(message)));
596 ZoneList<const AstRawString*>* array = 598 ZoneList<const AstRawString*>* array =
597 new (zone) ZoneList<const AstRawString*>(argc, zone); 599 new (zone) ZoneList<const AstRawString*>(argc, zone);
598 if (arg != NULL) { 600 if (arg != NULL) {
599 array->Add(arg, zone); 601 array->Add(arg, zone);
600 } 602 }
601 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(2, zone); 603 ZoneList<Expression*>* args = new (zone) ZoneList<Expression*>(2, zone);
602 args->Add(parser_->factory()->NewStringLiteral(type, pos), zone); 604 args->Add(parser_->factory()->NewStringLiteral(type, pos), zone);
603 args->Add(parser_->factory()->NewStringListLiteral(array, pos), zone); 605 args->Add(parser_->factory()->NewStringListLiteral(array, pos), zone);
604 CallRuntime* call_constructor = 606 CallRuntime* call_constructor =
605 parser_->factory()->NewCallRuntime(constructor, NULL, args, pos); 607 parser_->factory()->NewCallRuntime(constructor, NULL, args, pos);
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 if (allow_harmony_scoping() && strict_mode() == STRICT) { 1715 if (allow_harmony_scoping() && strict_mode() == STRICT) {
1714 // In harmony we treat re-declarations as early errors. See 1716 // In harmony we treat re-declarations as early errors. See
1715 // ES5 16 for a definition of early errors. 1717 // ES5 16 for a definition of early errors.
1716 ParserTraits::ReportMessage("var_redeclaration", name); 1718 ParserTraits::ReportMessage("var_redeclaration", name);
1717 *ok = false; 1719 *ok = false;
1718 return; 1720 return;
1719 } 1721 }
1720 Expression* expression = NewThrowTypeError( 1722 Expression* expression = NewThrowTypeError(
1721 "var_redeclaration", name, declaration->position()); 1723 "var_redeclaration", name, declaration->position());
1722 declaration_scope->SetIllegalRedeclaration(expression); 1724 declaration_scope->SetIllegalRedeclaration(expression);
1723 } else if (mode == VAR) {
1724 var->set_maybe_assigned();
1725 } 1725 }
1726 } 1726 }
1727 1727
1728 // We add a declaration node for every declaration. The compiler 1728 // We add a declaration node for every declaration. The compiler
1729 // will only generate code if necessary. In particular, declarations 1729 // will only generate code if necessary. In particular, declarations
1730 // for inner local variables that do not represent functions won't 1730 // for inner local variables that do not represent functions won't
1731 // result in any generated code. 1731 // result in any generated code.
1732 // 1732 //
1733 // Note that we always add an unresolved proxy even if it's not 1733 // Note that we always add an unresolved proxy even if it's not
1734 // used, simply because we don't know in this method (w/o extra 1734 // used, simply because we don't know in this method (w/o extra
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 Handle<FixedArray> elements = factory->NewFixedArray(has_arg ? 1 : 0); 3881 Handle<FixedArray> elements = factory->NewFixedArray(has_arg ? 1 : 0);
3882 if (pending_error_arg_ != NULL) { 3882 if (pending_error_arg_ != NULL) {
3883 Handle<String> arg_string = pending_error_arg_->string(); 3883 Handle<String> arg_string = pending_error_arg_->string();
3884 elements->set(0, *arg_string); 3884 elements->set(0, *arg_string);
3885 } else if (pending_error_char_arg_ != NULL) { 3885 } else if (pending_error_char_arg_ != NULL) {
3886 Handle<String> arg_string = 3886 Handle<String> arg_string =
3887 factory->NewStringFromUtf8(CStrVector(pending_error_char_arg_)) 3887 factory->NewStringFromUtf8(CStrVector(pending_error_char_arg_))
3888 .ToHandleChecked(); 3888 .ToHandleChecked();
3889 elements->set(0, *arg_string); 3889 elements->set(0, *arg_string);
3890 } 3890 }
3891 isolate()->debug()->OnCompileError(script_);
3892
3893 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); 3891 Handle<JSArray> array = factory->NewJSArrayWithElements(elements);
3894 Handle<Object> result = pending_error_is_reference_error_ 3892 Handle<Object> result = pending_error_is_reference_error_
3895 ? factory->NewReferenceError(pending_error_message_, array) 3893 ? factory->NewReferenceError(pending_error_message_, array)
3896 : factory->NewSyntaxError(pending_error_message_, array); 3894 : factory->NewSyntaxError(pending_error_message_, array);
3897 isolate()->Throw(*result, &location); 3895 isolate()->Throw(*result, &location);
3898 } 3896 }
3899 } 3897 }
3900 3898
3901 3899
3902 // ---------------------------------------------------------------------------- 3900 // ----------------------------------------------------------------------------
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
4837 ASSERT(ast_value_factory_->IsInternalized()); 4835 ASSERT(ast_value_factory_->IsInternalized());
4838 // info takes ownership of ast_value_factory_. 4836 // info takes ownership of ast_value_factory_.
4839 if (info()->ast_value_factory() == NULL) { 4837 if (info()->ast_value_factory() == NULL) {
4840 info()->SetAstValueFactory(ast_value_factory_); 4838 info()->SetAstValueFactory(ast_value_factory_);
4841 } 4839 }
4842 ast_value_factory_ = NULL; 4840 ast_value_factory_ = NULL;
4843 return (result != NULL); 4841 return (result != NULL);
4844 } 4842 }
4845 4843
4846 } } // namespace v8::internal 4844 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698