Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 RUNTIME_VM_KERNEL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_H_ |
| 6 #define RUNTIME_VM_KERNEL_H_ | 6 #define RUNTIME_VM_KERNEL_H_ |
| 7 | 7 |
| 8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 // Returns element at [index]. | 222 // Returns element at [index]. |
| 223 T*& operator[](int index) { | 223 T*& operator[](int index) { |
| 224 ASSERT(index < length_); | 224 ASSERT(index < length_); |
| 225 return array_[index]; | 225 return array_[index]; |
| 226 } | 226 } |
| 227 | 227 |
| 228 int length() { return length_; } | 228 int length() { return length_; } |
| 229 | 229 |
| 230 T** raw_array() { return array_; } | 230 T** raw_array() { return array_; } |
| 231 | 231 |
| 232 bool cannot_stream() { | |
|
Kevin Millikin (Google)
2017/05/11 10:38:35
This should be CanStream. Capitalized because of
jensj
2017/05/11 12:59:25
Done.
| |
| 233 for (intptr_t i = 0; i < length_; ++i) { | |
| 234 if (array_[i]->cannot_stream()) return true; | |
| 235 } | |
| 236 return false; | |
| 237 } | |
| 238 | |
| 232 private: | 239 private: |
| 233 T** array_; | 240 T** array_; |
| 234 int length_; | 241 int length_; |
| 235 | 242 |
| 236 DISALLOW_COPY_AND_ASSIGN(List); | 243 DISALLOW_COPY_AND_ASSIGN(List); |
| 237 }; | 244 }; |
| 238 | 245 |
| 239 | 246 |
| 240 class TypeParameterList : public List<TypeParameter> { | 247 class TypeParameterList : public List<TypeParameter> { |
| 241 public: | 248 public: |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 | 386 |
| 380 class TreeNode : public Node { | 387 class TreeNode : public Node { |
| 381 public: | 388 public: |
| 382 virtual ~TreeNode(); | 389 virtual ~TreeNode(); |
| 383 | 390 |
| 384 DEFINE_CASTING_OPERATIONS(TreeNode); | 391 DEFINE_CASTING_OPERATIONS(TreeNode); |
| 385 | 392 |
| 386 virtual void AcceptVisitor(Visitor* visitor); | 393 virtual void AcceptVisitor(Visitor* visitor); |
| 387 virtual void AcceptTreeVisitor(TreeVisitor* visitor) = 0; | 394 virtual void AcceptTreeVisitor(TreeVisitor* visitor) = 0; |
| 388 intptr_t kernel_offset() const { return kernel_offset_; } | 395 intptr_t kernel_offset() const { return kernel_offset_; } |
| 396 bool cannot_stream() { return cannot_stream_; } | |
| 389 | 397 |
| 390 protected: | 398 protected: |
| 391 TreeNode() : kernel_offset_(-1) {} | 399 TreeNode() : kernel_offset_(-1), cannot_stream_(false) {} |
| 392 | 400 |
| 393 // Offset for this node in the kernel-binary. If this node has a tag the | 401 // Offset for this node in the kernel-binary. If this node has a tag the |
| 394 // offset includes the tag. Can be -1 to indicate "unknown" or invalid offset. | 402 // offset includes the tag. Can be -1 to indicate "unknown" or invalid offset. |
| 395 intptr_t kernel_offset_; | 403 intptr_t kernel_offset_; |
| 396 | 404 |
| 405 bool cannot_stream_; | |
| 406 | |
| 397 private: | 407 private: |
| 398 DISALLOW_COPY_AND_ASSIGN(TreeNode); | 408 DISALLOW_COPY_AND_ASSIGN(TreeNode); |
| 399 }; | 409 }; |
| 400 | 410 |
| 401 | 411 |
| 402 class LinkedNode : public TreeNode { | 412 class LinkedNode : public TreeNode { |
| 403 public: | 413 public: |
| 404 virtual ~LinkedNode(); | 414 virtual ~LinkedNode(); |
| 405 | 415 |
| 406 CanonicalName* canonical_name() { return canonical_name_; } | 416 CanonicalName* canonical_name() { return canonical_name_; } |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1012 | 1022 |
| 1013 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1023 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| 1014 virtual void VisitChildren(Visitor* visitor); | 1024 virtual void VisitChildren(Visitor* visitor); |
| 1015 | 1025 |
| 1016 VariableDeclaration* variable() { return variable_; } | 1026 VariableDeclaration* variable() { return variable_; } |
| 1017 | 1027 |
| 1018 private: | 1028 private: |
| 1019 VariableGet() {} | 1029 VariableGet() {} |
| 1020 | 1030 |
| 1021 Ref<VariableDeclaration> variable_; | 1031 Ref<VariableDeclaration> variable_; |
| 1032 intptr_t variable_kernel_offset_; | |
| 1022 | 1033 |
| 1023 DISALLOW_COPY_AND_ASSIGN(VariableGet); | 1034 DISALLOW_COPY_AND_ASSIGN(VariableGet); |
| 1024 }; | 1035 }; |
| 1025 | 1036 |
| 1026 | 1037 |
| 1027 class VariableSet : public Expression { | 1038 class VariableSet : public Expression { |
| 1028 public: | 1039 public: |
| 1029 static VariableSet* ReadFrom(Reader* reader); | 1040 static VariableSet* ReadFrom(Reader* reader); |
| 1030 static VariableSet* ReadFrom(Reader* reader, uint8_t payload); | 1041 static VariableSet* ReadFrom(Reader* reader, uint8_t payload); |
| 1031 | 1042 |
| 1032 virtual ~VariableSet(); | 1043 virtual ~VariableSet(); |
| 1033 | 1044 |
| 1034 DEFINE_CASTING_OPERATIONS(VariableSet); | 1045 DEFINE_CASTING_OPERATIONS(VariableSet); |
| 1035 | 1046 |
| 1036 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1047 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| 1037 virtual void VisitChildren(Visitor* visitor); | 1048 virtual void VisitChildren(Visitor* visitor); |
| 1038 | 1049 |
| 1039 VariableDeclaration* variable() { return variable_; } | 1050 VariableDeclaration* variable() { return variable_; } |
| 1040 Expression* expression() { return expression_; } | 1051 Expression* expression() { return expression_; } |
| 1041 | 1052 |
| 1042 private: | 1053 private: |
| 1043 VariableSet() {} | 1054 VariableSet() {} |
| 1044 | 1055 |
| 1045 Ref<VariableDeclaration> variable_; | 1056 Ref<VariableDeclaration> variable_; |
| 1057 intptr_t variable_kernel_offset_; | |
| 1046 Child<Expression> expression_; | 1058 Child<Expression> expression_; |
| 1047 | 1059 |
| 1048 DISALLOW_COPY_AND_ASSIGN(VariableSet); | 1060 DISALLOW_COPY_AND_ASSIGN(VariableSet); |
| 1049 }; | 1061 }; |
| 1050 | 1062 |
| 1051 | 1063 |
| 1052 class PropertyGet : public Expression { | 1064 class PropertyGet : public Expression { |
| 1053 public: | 1065 public: |
| 1054 static PropertyGet* ReadFrom(Reader* reader); | 1066 static PropertyGet* ReadFrom(Reader* reader); |
| 1055 | 1067 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1146 Child<Expression> receiver_; | 1158 Child<Expression> receiver_; |
| 1147 Ref<CanonicalName> target_reference_; // Member. | 1159 Ref<CanonicalName> target_reference_; // Member. |
| 1148 Child<Expression> value_; | 1160 Child<Expression> value_; |
| 1149 | 1161 |
| 1150 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); | 1162 DISALLOW_COPY_AND_ASSIGN(DirectPropertySet); |
| 1151 }; | 1163 }; |
| 1152 | 1164 |
| 1153 | 1165 |
| 1154 class StaticGet : public Expression { | 1166 class StaticGet : public Expression { |
| 1155 public: | 1167 public: |
| 1156 explicit StaticGet(CanonicalName* target) : target_reference_(target) {} | 1168 StaticGet(CanonicalName* target, bool cannot_stream) |
| 1169 : target_reference_(target) { | |
| 1170 cannot_stream_ = cannot_stream; | |
| 1171 } | |
| 1157 | 1172 |
| 1158 static StaticGet* ReadFrom(Reader* reader); | 1173 static StaticGet* ReadFrom(Reader* reader); |
| 1159 | 1174 |
| 1160 virtual ~StaticGet(); | 1175 virtual ~StaticGet(); |
| 1161 | 1176 |
| 1162 DEFINE_CASTING_OPERATIONS(StaticGet); | 1177 DEFINE_CASTING_OPERATIONS(StaticGet); |
| 1163 | 1178 |
| 1164 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); | 1179 virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor); |
| 1165 virtual void VisitChildren(Visitor* visitor); | 1180 virtual void VisitChildren(Visitor* visitor); |
| 1166 | 1181 |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2166 public: | 2181 public: |
| 2167 static BreakStatement* ReadFrom(Reader* reader); | 2182 static BreakStatement* ReadFrom(Reader* reader); |
| 2168 | 2183 |
| 2169 virtual ~BreakStatement(); | 2184 virtual ~BreakStatement(); |
| 2170 | 2185 |
| 2171 DEFINE_CASTING_OPERATIONS(BreakStatement); | 2186 DEFINE_CASTING_OPERATIONS(BreakStatement); |
| 2172 | 2187 |
| 2173 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | 2188 virtual void AcceptStatementVisitor(StatementVisitor* visitor); |
| 2174 virtual void VisitChildren(Visitor* visitor); | 2189 virtual void VisitChildren(Visitor* visitor); |
| 2175 | 2190 |
| 2176 LabeledStatement* target() { return target_; } | 2191 intptr_t target_index() { return target_index_; } |
| 2177 | 2192 |
| 2178 private: | 2193 private: |
| 2179 BreakStatement() {} | 2194 BreakStatement() {} |
| 2180 | 2195 |
| 2181 Ref<LabeledStatement> target_; | 2196 intptr_t target_index_; |
| 2182 | 2197 |
| 2183 DISALLOW_COPY_AND_ASSIGN(BreakStatement); | 2198 DISALLOW_COPY_AND_ASSIGN(BreakStatement); |
| 2184 }; | 2199 }; |
| 2185 | 2200 |
| 2186 | 2201 |
| 2187 class WhileStatement : public Statement { | 2202 class WhileStatement : public Statement { |
| 2188 public: | 2203 public: |
| 2189 static WhileStatement* ReadFrom(Reader* reader); | 2204 static WhileStatement* ReadFrom(Reader* reader); |
| 2190 | 2205 |
| 2191 virtual ~WhileStatement(); | 2206 virtual ~WhileStatement(); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2357 public: | 2372 public: |
| 2358 static ContinueSwitchStatement* ReadFrom(Reader* reader); | 2373 static ContinueSwitchStatement* ReadFrom(Reader* reader); |
| 2359 | 2374 |
| 2360 virtual ~ContinueSwitchStatement(); | 2375 virtual ~ContinueSwitchStatement(); |
| 2361 | 2376 |
| 2362 DEFINE_CASTING_OPERATIONS(ContinueSwitchStatement); | 2377 DEFINE_CASTING_OPERATIONS(ContinueSwitchStatement); |
| 2363 | 2378 |
| 2364 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | 2379 virtual void AcceptStatementVisitor(StatementVisitor* visitor); |
| 2365 virtual void VisitChildren(Visitor* visitor); | 2380 virtual void VisitChildren(Visitor* visitor); |
| 2366 | 2381 |
| 2367 SwitchCase* target() { return target_; } | 2382 intptr_t target_index() { return target_index_; } |
| 2368 | 2383 |
| 2369 private: | 2384 private: |
| 2370 ContinueSwitchStatement() {} | 2385 ContinueSwitchStatement() {} |
| 2371 | 2386 |
| 2372 Ref<SwitchCase> target_; | 2387 intptr_t target_index_; |
| 2373 | 2388 |
| 2374 DISALLOW_COPY_AND_ASSIGN(ContinueSwitchStatement); | 2389 DISALLOW_COPY_AND_ASSIGN(ContinueSwitchStatement); |
| 2375 }; | 2390 }; |
| 2376 | 2391 |
| 2377 | 2392 |
| 2378 class IfStatement : public Statement { | 2393 class IfStatement : public Statement { |
| 2379 public: | 2394 public: |
| 2380 static IfStatement* ReadFrom(Reader* reader); | 2395 static IfStatement* ReadFrom(Reader* reader); |
| 2381 | 2396 |
| 2382 virtual ~IfStatement(); | 2397 virtual ~IfStatement(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 2396 Child<Expression> condition_; | 2411 Child<Expression> condition_; |
| 2397 Child<Statement> then_; | 2412 Child<Statement> then_; |
| 2398 Child<Statement> otherwise_; | 2413 Child<Statement> otherwise_; |
| 2399 | 2414 |
| 2400 DISALLOW_COPY_AND_ASSIGN(IfStatement); | 2415 DISALLOW_COPY_AND_ASSIGN(IfStatement); |
| 2401 }; | 2416 }; |
| 2402 | 2417 |
| 2403 | 2418 |
| 2404 class ReturnStatement : public Statement { | 2419 class ReturnStatement : public Statement { |
| 2405 public: | 2420 public: |
| 2406 explicit ReturnStatement(Expression* expression) : expression_(expression) {} | 2421 explicit ReturnStatement(Expression* expression, bool cannot_stream) |
|
Kevin Millikin (Google)
2017/05/11 10:38:35
No need for explicit unless it takes only one argu
jensj
2017/05/11 12:59:25
Done.
| |
| 2422 : expression_(expression) { | |
| 2423 cannot_stream_ = cannot_stream; | |
| 2424 } | |
| 2407 | 2425 |
| 2408 static ReturnStatement* ReadFrom(Reader* reader); | 2426 static ReturnStatement* ReadFrom(Reader* reader); |
| 2409 | 2427 |
| 2410 virtual ~ReturnStatement(); | 2428 virtual ~ReturnStatement(); |
| 2411 | 2429 |
| 2412 DEFINE_CASTING_OPERATIONS(ReturnStatement); | 2430 DEFINE_CASTING_OPERATIONS(ReturnStatement); |
| 2413 | 2431 |
| 2414 virtual void AcceptStatementVisitor(StatementVisitor* visitor); | 2432 virtual void AcceptStatementVisitor(StatementVisitor* visitor); |
| 2415 virtual void VisitChildren(Visitor* visitor); | 2433 virtual void VisitChildren(Visitor* visitor); |
| 2416 | 2434 |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3315 } // namespace kernel | 3333 } // namespace kernel |
| 3316 | 3334 |
| 3317 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, | 3335 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, |
| 3318 intptr_t buffer_length); | 3336 intptr_t buffer_length); |
| 3319 | 3337 |
| 3320 | 3338 |
| 3321 } // namespace dart | 3339 } // namespace dart |
| 3322 | 3340 |
| 3323 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3341 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 3324 #endif // RUNTIME_VM_KERNEL_H_ | 3342 #endif // RUNTIME_VM_KERNEL_H_ |
| OLD | NEW |