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

Side by Side Diff: src/parser.h

Issue 8417035: Introduce extended mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased version. Created 9 years, 1 month 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 class FunctionEntry BASE_EMBEDDED { 70 class FunctionEntry BASE_EMBEDDED {
71 public: 71 public:
72 explicit FunctionEntry(Vector<unsigned> backing) : backing_(backing) { } 72 explicit FunctionEntry(Vector<unsigned> backing) : backing_(backing) { }
73 FunctionEntry() : backing_(Vector<unsigned>::empty()) { } 73 FunctionEntry() : backing_(Vector<unsigned>::empty()) { }
74 74
75 int start_pos() { return backing_[kStartPosOffset]; } 75 int start_pos() { return backing_[kStartPosOffset]; }
76 int end_pos() { return backing_[kEndPosOffset]; } 76 int end_pos() { return backing_[kEndPosOffset]; }
77 int literal_count() { return backing_[kLiteralCountOffset]; } 77 int literal_count() { return backing_[kLiteralCountOffset]; }
78 int property_count() { return backing_[kPropertyCountOffset]; } 78 int property_count() { return backing_[kPropertyCountOffset]; }
79 StrictModeFlag strict_mode_flag() { 79 LanguageMode language_mode() {
80 ASSERT(backing_[kStrictModeOffset] == kStrictMode || 80 ASSERT(backing_[kLanguageModeOffset] == CLASSIC_MODE ||
81 backing_[kStrictModeOffset] == kNonStrictMode); 81 backing_[kLanguageModeOffset] == STRICT_MODE ||
82 return static_cast<StrictModeFlag>(backing_[kStrictModeOffset]); 82 backing_[kLanguageModeOffset] == EXTENDED_MODE);
83 return static_cast<LanguageMode>(backing_[kLanguageModeOffset]);
83 } 84 }
84 85
85 bool is_valid() { return backing_.length() > 0; } 86 bool is_valid() { return backing_.length() > 0; }
86 87
87 static const int kSize = 5; 88 static const int kSize = 5;
88 89
89 private: 90 private:
90 Vector<unsigned> backing_; 91 Vector<unsigned> backing_;
91 static const int kStartPosOffset = 0; 92 static const int kStartPosOffset = 0;
92 static const int kEndPosOffset = 1; 93 static const int kEndPosOffset = 1;
93 static const int kLiteralCountOffset = 2; 94 static const int kLiteralCountOffset = 2;
94 static const int kPropertyCountOffset = 3; 95 static const int kPropertyCountOffset = 3;
95 static const int kStrictModeOffset = 4; 96 static const int kLanguageModeOffset = 4;
96 }; 97 };
97 98
98 99
99 class ScriptDataImpl : public ScriptData { 100 class ScriptDataImpl : public ScriptData {
100 public: 101 public:
101 explicit ScriptDataImpl(Vector<unsigned> store) 102 explicit ScriptDataImpl(Vector<unsigned> store)
102 : store_(store), 103 : store_(store),
103 owns_store_(true) { } 104 owns_store_(true) { }
104 105
105 // Create an empty ScriptDataImpl that is guaranteed to not satisfy 106 // Create an empty ScriptDataImpl that is guaranteed to not satisfy
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 public: 426 public:
426 Parser(Handle<Script> script, 427 Parser(Handle<Script> script,
427 bool allow_natives_syntax, 428 bool allow_natives_syntax,
428 v8::Extension* extension, 429 v8::Extension* extension,
429 ScriptDataImpl* pre_data); 430 ScriptDataImpl* pre_data);
430 virtual ~Parser() { } 431 virtual ~Parser() { }
431 432
432 // Returns NULL if parsing failed. 433 // Returns NULL if parsing failed.
433 FunctionLiteral* ParseProgram(Handle<String> source, 434 FunctionLiteral* ParseProgram(Handle<String> source,
434 bool in_global_context, 435 bool in_global_context,
435 StrictModeFlag strict_mode); 436 LanguageMode language_mode);
436 437
437 FunctionLiteral* ParseLazy(CompilationInfo* info); 438 FunctionLiteral* ParseLazy(CompilationInfo* info);
438 439
439 void ReportMessageAt(Scanner::Location loc, 440 void ReportMessageAt(Scanner::Location loc,
440 const char* message, 441 const char* message,
441 Vector<const char*> args); 442 Vector<const char*> args);
442 void ReportMessageAt(Scanner::Location loc, 443 void ReportMessageAt(Scanner::Location loc,
443 const char* message, 444 const char* message,
444 Vector<Handle<String> > args); 445 Vector<Handle<String> > args);
445 void SetHarmonyScoping(bool block_scoping); 446 void SetHarmonyScoping(bool block_scoping);
(...skipping 24 matching lines...) Expand all
470 kHasInitializers, 471 kHasInitializers,
471 kHasNoInitializers 472 kHasNoInitializers
472 }; 473 };
473 474
474 Isolate* isolate() { return isolate_; } 475 Isolate* isolate() { return isolate_; }
475 Zone* zone() { return isolate_->zone(); } 476 Zone* zone() { return isolate_->zone(); }
476 477
477 // Called by ParseProgram after setting up the scanner. 478 // Called by ParseProgram after setting up the scanner.
478 FunctionLiteral* DoParseProgram(Handle<String> source, 479 FunctionLiteral* DoParseProgram(Handle<String> source,
479 bool in_global_context, 480 bool in_global_context,
480 StrictModeFlag strict_mode, 481 LanguageMode language_mode,
481 ZoneScope* zone_scope); 482 ZoneScope* zone_scope);
482 483
483 // Report syntax error 484 // Report syntax error
484 void ReportUnexpectedToken(Token::Value token); 485 void ReportUnexpectedToken(Token::Value token);
485 void ReportInvalidPreparseData(Handle<String> name, bool* ok); 486 void ReportInvalidPreparseData(Handle<String> name, bool* ok);
486 void ReportMessage(const char* message, Vector<const char*> args); 487 void ReportMessage(const char* message, Vector<const char*> args);
487 488
488 bool inside_with() const { return top_scope_->inside_with(); } 489 bool inside_with() const { return top_scope_->inside_with(); }
489 Scanner& scanner() { return scanner_; } 490 Scanner& scanner() { return scanner_; }
490 Mode mode() const { return mode_; } 491 Mode mode() const { return mode_; }
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 private: 779 private:
779 static const int kTypeSlot = 0; 780 static const int kTypeSlot = 0;
780 static const int kElementsSlot = 1; 781 static const int kElementsSlot = 1;
781 782
782 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue); 783 DISALLOW_IMPLICIT_CONSTRUCTORS(CompileTimeValue);
783 }; 784 };
784 785
785 } } // namespace v8::internal 786 } } // namespace v8::internal
786 787
787 #endif // V8_PARSER_H_ 788 #endif // V8_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698