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

Side by Side Diff: src/parser.h

Issue 227483006: Version 3.25.28.6 (merged r20316, r20366, r20428, r20451) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.25
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/parser.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 } 455 }
456 456
457 // Helper functions for recursive descent. 457 // Helper functions for recursive descent.
458 bool IsEvalOrArguments(Handle<String> identifier) const; 458 bool IsEvalOrArguments(Handle<String> identifier) const;
459 459
460 // Returns true if the expression is of type "this.foo". 460 // Returns true if the expression is of type "this.foo".
461 static bool IsThisProperty(Expression* expression); 461 static bool IsThisProperty(Expression* expression);
462 462
463 static bool IsIdentifier(Expression* expression); 463 static bool IsIdentifier(Expression* expression);
464 464
465 static Handle<String> AsIdentifier(Expression* expression) {
466 ASSERT(IsIdentifier(expression));
467 return expression->AsVariableProxy()->name();
468 }
469
465 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) { 470 static bool IsBoilerplateProperty(ObjectLiteral::Property* property) {
466 return ObjectLiteral::IsBoilerplateProperty(property); 471 return ObjectLiteral::IsBoilerplateProperty(property);
467 } 472 }
468 473
469 static bool IsArrayIndex(Handle<String> string, uint32_t* index) { 474 static bool IsArrayIndex(Handle<String> string, uint32_t* index) {
470 return !string.is_null() && string->AsArrayIndex(index); 475 return !string.is_null() && string->AsArrayIndex(index);
471 } 476 }
472 477
473 // Functions for encapsulating the differences between parsing and preparsing; 478 // Functions for encapsulating the differences between parsing and preparsing;
474 // operations interleaved with the recursive descent. 479 // operations interleaved with the recursive descent.
(...skipping 19 matching lines...) Expand all
494 // Keep track of eval() calls since they disable all local variable 499 // Keep track of eval() calls since they disable all local variable
495 // optimizations. This checks if expression is an eval call, and if yes, 500 // optimizations. This checks if expression is an eval call, and if yes,
496 // forwards the information to scope. 501 // forwards the information to scope.
497 void CheckPossibleEvalCall(Expression* expression, Scope* scope); 502 void CheckPossibleEvalCall(Expression* expression, Scope* scope);
498 503
499 // Determine if the expression is a variable proxy and mark it as being used 504 // Determine if the expression is a variable proxy and mark it as being used
500 // in an assignment or with a increment/decrement operator. This is currently 505 // in an assignment or with a increment/decrement operator. This is currently
501 // used on for the statically checking assignments to harmony const bindings. 506 // used on for the statically checking assignments to harmony const bindings.
502 static Expression* MarkExpressionAsLValue(Expression* expression); 507 static Expression* MarkExpressionAsLValue(Expression* expression);
503 508
504 // Checks LHS expression for assignment and prefix/postfix increment/decrement
505 // in strict mode.
506 void CheckStrictModeLValue(Expression* expression, bool* ok);
507
508 // Returns true if we have a binary expression between two numeric 509 // Returns true if we have a binary expression between two numeric
509 // literals. In that case, *x will be changed to an expression which is the 510 // literals. In that case, *x will be changed to an expression which is the
510 // computed value. 511 // computed value.
511 bool ShortcutNumericLiteralBinaryExpression( 512 bool ShortcutNumericLiteralBinaryExpression(
512 Expression** x, Expression* y, Token::Value op, int pos, 513 Expression** x, Expression* y, Token::Value op, int pos,
513 AstNodeFactory<AstConstructionVisitor>* factory); 514 AstNodeFactory<AstConstructionVisitor>* factory);
514 515
515 // Rewrites the following types of unary expressions: 516 // Rewrites the following types of unary expressions:
516 // not <literal> -> true / false 517 // not <literal> -> true / false
517 // + <numeric literal> -> <numeric literal> 518 // + <numeric literal> -> <numeric literal>
518 // - <numeric literal> -> <numeric literal with value negated> 519 // - <numeric literal> -> <numeric literal with value negated>
519 // ! <literal> -> true / false 520 // ! <literal> -> true / false
520 // The following rewriting rules enable the collection of type feedback 521 // The following rewriting rules enable the collection of type feedback
521 // without any special stub and the multiplication is removed later in 522 // without any special stub and the multiplication is removed later in
522 // Crankshaft's canonicalization pass. 523 // Crankshaft's canonicalization pass.
523 // + foo -> foo * 1 524 // + foo -> foo * 1
524 // - foo -> foo * (-1) 525 // - foo -> foo * (-1)
525 // ~ foo -> foo ^(~0) 526 // ~ foo -> foo ^(~0)
526 Expression* BuildUnaryExpression( 527 Expression* BuildUnaryExpression(
527 Expression* expression, Token::Value op, int pos, 528 Expression* expression, Token::Value op, int pos,
528 AstNodeFactory<AstConstructionVisitor>* factory); 529 AstNodeFactory<AstConstructionVisitor>* factory);
529 530
531 // Generate AST node that throws a ReferenceError with the given type.
532 Expression* NewThrowReferenceError(const char* type, int pos);
533
534 // Generate AST node that throws a SyntaxError with the given
535 // type. The first argument may be null (in the handle sense) in
536 // which case no arguments are passed to the constructor.
537 Expression* NewThrowSyntaxError(
538 const char* type, Handle<Object> arg, int pos);
539
540 // Generate AST node that throws a TypeError with the given
541 // type. Both arguments must be non-null (in the handle sense).
542 Expression* NewThrowTypeError(
543 const char* type, Handle<Object> arg1, Handle<Object> arg2, int pos);
544
545 // Generic AST generator for throwing errors from compiled code.
546 Expression* NewThrowError(
547 Handle<String> constructor, const char* type,
548 Vector<Handle<Object> > arguments, int pos);
549
530 // Reporting errors. 550 // Reporting errors.
531 void ReportMessageAt(Scanner::Location source_location, 551 void ReportMessageAt(Scanner::Location source_location,
532 const char* message, 552 const char* message,
533 Vector<const char*> args, 553 Vector<const char*> args,
534 bool is_reference_error = false); 554 bool is_reference_error = false);
535 void ReportMessage(const char* message, 555 void ReportMessage(const char* message,
536 Vector<Handle<String> > args, 556 Vector<Handle<String> > args,
537 bool is_reference_error = false); 557 bool is_reference_error = false);
538 void ReportMessageAt(Scanner::Location source_location, 558 void ReportMessageAt(Scanner::Location source_location,
539 const char* message, 559 const char* message,
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 IterationStatement* LookupContinueTarget(Handle<String> label, bool* ok); 791 IterationStatement* LookupContinueTarget(Handle<String> label, bool* ok);
772 792
773 void RegisterTargetUse(Label* target, Target* stop); 793 void RegisterTargetUse(Label* target, Target* stop);
774 794
775 // Factory methods. 795 // Factory methods.
776 796
777 Scope* NewScope(Scope* parent, ScopeType type); 797 Scope* NewScope(Scope* parent, ScopeType type);
778 798
779 Handle<String> LookupCachedSymbol(int symbol_id); 799 Handle<String> LookupCachedSymbol(int symbol_id);
780 800
781 // Generate AST node that throw a ReferenceError with the given type.
782 Expression* NewThrowReferenceError(Handle<String> type);
783
784 // Generate AST node that throw a SyntaxError with the given
785 // type. The first argument may be null (in the handle sense) in
786 // which case no arguments are passed to the constructor.
787 Expression* NewThrowSyntaxError(Handle<String> type, Handle<Object> first);
788
789 // Generate AST node that throw a TypeError with the given
790 // type. Both arguments must be non-null (in the handle sense).
791 Expression* NewThrowTypeError(Handle<String> type,
792 Handle<Object> first,
793 Handle<Object> second);
794
795 // Generic AST generator for throwing errors from compiled code.
796 Expression* NewThrowError(Handle<String> constructor,
797 Handle<String> type,
798 Vector< Handle<Object> > arguments);
799
800 PreParser::PreParseResult LazyParseFunctionLiteral( 801 PreParser::PreParseResult LazyParseFunctionLiteral(
801 SingletonLogger* logger); 802 SingletonLogger* logger);
802 803
803 Isolate* isolate_; 804 Isolate* isolate_;
804 ZoneList<Handle<String> > symbol_cache_; 805 ZoneList<Handle<String> > symbol_cache_;
805 806
806 Handle<Script> script_; 807 Handle<Script> script_;
807 Scanner scanner_; 808 Scanner scanner_;
808 PreParser* reusable_preparser_; 809 PreParser* reusable_preparser_;
809 Scope* original_scope_; // for ES5 function declarations in sloppy eval 810 Scope* original_scope_; // for ES5 function declarations in sloppy eval
(...skipping 29 matching lines...) Expand all
839 private: 840 private:
840 static const int kLiteralTypeSlot = 0; 841 static const int kLiteralTypeSlot = 0;
841 static const int kElementsSlot = 1; 842 static const int kElementsSlot = 1;
842 843
843 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 844 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
844 }; 845 };
845 846
846 } } // namespace v8::internal 847 } } // namespace v8::internal
847 848
848 #endif // V8_PARSER_H_ 849 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698