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

Side by Side Diff: src/parser.h

Issue 24104006: Limit entry points into the parser API. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 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 | « no previous file | 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 void set_allow_harmony_numeric_literals(bool allow) { 454 void set_allow_harmony_numeric_literals(bool allow) {
455 scanner().SetHarmonyNumericLiterals(allow); 455 scanner().SetHarmonyNumericLiterals(allow);
456 } 456 }
457 457
458 // Parses the source code represented by the compilation info and sets its 458 // Parses the source code represented by the compilation info and sets its
459 // function literal. Returns false (and deallocates any allocated AST 459 // function literal. Returns false (and deallocates any allocated AST
460 // nodes) if parsing failed. 460 // nodes) if parsing failed.
461 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); } 461 static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); }
462 bool Parse(); 462 bool Parse();
463 463
464 // Returns NULL if parsing failed.
465 FunctionLiteral* ParseProgram();
466
467 void ReportMessageAt(Scanner::Location loc, 464 void ReportMessageAt(Scanner::Location loc,
468 const char* message, 465 const char* message,
469 Vector<const char*> args); 466 Vector<const char*> args);
470 void ReportMessageAt(Scanner::Location loc, 467 void ReportMessageAt(Scanner::Location loc,
471 const char* message, 468 const char* message,
472 Vector<Handle<String> > args); 469 Vector<Handle<String> > args);
473 470
474 private: 471 private:
475 static const int kMaxNumFunctionLocals = 131071; // 2^17-1 472 static const int kMaxNumFunctionLocals = 131071; // 2^17-1
476 473
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 558 }
562 ~ParsingModeScope() { 559 ~ParsingModeScope() {
563 parser_->mode_ = old_mode_; 560 parser_->mode_ = old_mode_;
564 } 561 }
565 562
566 private: 563 private:
567 Parser* parser_; 564 Parser* parser_;
568 Mode old_mode_; 565 Mode old_mode_;
569 }; 566 };
570 567
568 // Returns NULL if parsing failed.
569 FunctionLiteral* ParseProgram();
570
571 FunctionLiteral* ParseLazy(); 571 FunctionLiteral* ParseLazy();
572 FunctionLiteral* ParseLazy(Utf16CharacterStream* source); 572 FunctionLiteral* ParseLazy(Utf16CharacterStream* source);
573 573
574 Isolate* isolate() { return isolate_; } 574 Isolate* isolate() { return isolate_; }
575 Zone* zone() const { return zone_; } 575 Zone* zone() const { return zone_; }
576 CompilationInfo* info() const { return info_; } 576 CompilationInfo* info() const { return info_; }
577 577
578 // Called by ParseProgram after setting up the scanner. 578 // Called by ParseProgram after setting up the scanner.
579 FunctionLiteral* DoParseProgram(CompilationInfo* info, 579 FunctionLiteral* DoParseProgram(CompilationInfo* info,
580 Handle<String> source); 580 Handle<String> source);
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 private: 906 private:
907 static const int kLiteralTypeSlot = 0; 907 static const int kLiteralTypeSlot = 0;
908 static const int kElementsSlot = 1; 908 static const int kElementsSlot = 1;
909 909
910 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 910 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
911 }; 911 };
912 912
913 } } // namespace v8::internal 913 } } // namespace v8::internal
914 914
915 #endif // V8_PARSER_H_ 915 #endif // V8_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698