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

Side by Side Diff: runtime/vm/parser.h

Issue 1051713005: Avoid caching thread in parser. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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 | « no previous file | runtime/vm/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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_PARSER_H_ 5 #ifndef VM_PARSER_H_
6 #define VM_PARSER_H_ 6 #define VM_PARSER_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 23 matching lines...) Expand all
34 class ClassDesc; 34 class ClassDesc;
35 struct MemberDesc; 35 struct MemberDesc;
36 struct ParamList; 36 struct ParamList;
37 struct QualIdent; 37 struct QualIdent;
38 struct TopLevel; 38 struct TopLevel;
39 39
40 // The class ParsedFunction holds the result of parsing a function. 40 // The class ParsedFunction holds the result of parsing a function.
41 class ParsedFunction : public ZoneAllocated { 41 class ParsedFunction : public ZoneAllocated {
42 public: 42 public:
43 ParsedFunction(Thread* thread, const Function& function) 43 ParsedFunction(Thread* thread, const Function& function)
44 : thread_(thread), 44 : isolate_(thread->isolate()),
45 function_(function), 45 function_(function),
46 code_(Code::Handle(zone(), function.unoptimized_code())), 46 code_(Code::Handle(zone(), function.unoptimized_code())),
47 node_sequence_(NULL), 47 node_sequence_(NULL),
48 regexp_compile_data_(NULL), 48 regexp_compile_data_(NULL),
49 instantiator_(NULL), 49 instantiator_(NULL),
50 default_parameter_values_(Array::ZoneHandle(zone(), Array::null())), 50 default_parameter_values_(Array::ZoneHandle(zone(), Array::null())),
51 current_context_var_(NULL), 51 current_context_var_(NULL),
52 expression_temp_var_(NULL), 52 expression_temp_var_(NULL),
53 finally_return_temp_var_(NULL), 53 finally_return_temp_var_(NULL),
54 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()), 54 deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()),
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return (num_copied_params_ == 0) 143 return (num_copied_params_ == 0)
144 ? function().num_fixed_parameters() : 0; 144 ? function().num_fixed_parameters() : 0;
145 } 145 }
146 146
147 void AllocateVariables(); 147 void AllocateVariables();
148 void AllocateIrregexpVariables(intptr_t num_stack_locals); 148 void AllocateIrregexpVariables(intptr_t num_stack_locals);
149 149
150 void record_await() { have_seen_await_expr_ = true; } 150 void record_await() { have_seen_await_expr_ = true; }
151 bool have_seen_await() const { return have_seen_await_expr_; } 151 bool have_seen_await() const { return have_seen_await_expr_; }
152 152
153 Thread* thread() const { return thread_; } 153 Isolate* isolate() const { return isolate_; }
154 Isolate* isolate() const { return thread()->isolate(); } 154 Zone* zone() const { return isolate()->current_zone(); }
155 Zone* zone() const { return thread()->zone(); }
156 155
157 private: 156 private:
158 Thread* thread_; 157 Isolate* isolate_;
159 const Function& function_; 158 const Function& function_;
160 Code& code_; 159 Code& code_;
161 SequenceNode* node_sequence_; 160 SequenceNode* node_sequence_;
162 RegExpCompileData* regexp_compile_data_; 161 RegExpCompileData* regexp_compile_data_;
163 LocalVariable* instantiator_; 162 LocalVariable* instantiator_;
164 Array& default_parameter_values_; 163 Array& default_parameter_values_;
165 LocalVariable* current_context_var_; 164 LocalVariable* current_context_var_;
166 LocalVariable* expression_temp_var_; 165 LocalVariable* expression_temp_var_;
167 LocalVariable* finally_return_temp_var_; 166 LocalVariable* finally_return_temp_var_;
168 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_; 167 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_;
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 ArgumentListNode* arguments); 789 ArgumentListNode* arguments);
791 790
792 void AddEqualityNullCheck(); 791 void AddEqualityNullCheck();
793 792
794 AstNode* BuildClosureCall(intptr_t token_pos, 793 AstNode* BuildClosureCall(intptr_t token_pos,
795 AstNode* closure, 794 AstNode* closure,
796 ArgumentListNode* arguments); 795 ArgumentListNode* arguments);
797 796
798 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); 797 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos);
799 798
800 Thread* thread() const { return thread_; } 799 Isolate* isolate() const { return isolate_; }
801 Isolate* isolate() const { return thread()->isolate(); } 800 Zone* zone() const { return isolate()->current_zone(); }
802 Zone* zone() const { return thread()->zone(); }
803 801
804 Thread* thread_; // Cached current thread. 802 Isolate* isolate_; // Cached current isolate.
805 803
806 Script& script_; 804 Script& script_;
807 TokenStream::Iterator tokens_iterator_; 805 TokenStream::Iterator tokens_iterator_;
808 Token::Kind token_kind_; // Cached token kind for current token. 806 Token::Kind token_kind_; // Cached token kind for current token.
809 Block* current_block_; 807 Block* current_block_;
810 808
811 // is_top_level_ is true if parsing the "top level" of a compilation unit, 809 // is_top_level_ is true if parsing the "top level" of a compilation unit,
812 // that is class definitions, function type aliases, global functions, 810 // that is class definitions, function type aliases, global functions,
813 // global variables. 811 // global variables.
814 bool is_top_level_; 812 bool is_top_level_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 859
862 // Indentation of parser trace. 860 // Indentation of parser trace.
863 intptr_t trace_indent_; 861 intptr_t trace_indent_;
864 862
865 DISALLOW_COPY_AND_ASSIGN(Parser); 863 DISALLOW_COPY_AND_ASSIGN(Parser);
866 }; 864 };
867 865
868 } // namespace dart 866 } // namespace dart
869 867
870 #endif // VM_PARSER_H_ 868 #endif // VM_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698