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

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

Issue 12212050: Fix allocation of array tables (use store barrier if needed, store values directly instead of via s… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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/compiler.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_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 const intptr_t formal_parameter_index_; 258 const intptr_t formal_parameter_index_;
259 const String& formal_parameter_name_; 259 const String& formal_parameter_name_;
260 const LocalVariable& saved_arguments_descriptor_; 260 const LocalVariable& saved_arguments_descriptor_;
261 261
262 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestNode); 262 DISALLOW_COPY_AND_ASSIGN(ArgumentDefinitionTestNode);
263 }; 263 };
264 264
265 265
266 class ArrayNode : public AstNode { 266 class ArrayNode : public AstNode {
267 public: 267 public:
268 ArrayNode(intptr_t token_pos, const AbstractType& type) 268 ArrayNode(intptr_t token_pos,
269 const AbstractType& type,
270 const LocalVariable& temp)
269 : AstNode(token_pos), 271 : AstNode(token_pos),
270 type_(type), 272 type_(type),
273 temp_local_(temp),
271 elements_() { 274 elements_() {
272 CheckFields(); 275 CheckFields();
273 } 276 }
274 ArrayNode(intptr_t token_pos, 277 ArrayNode(intptr_t token_pos,
275 const AbstractType& type, 278 const AbstractType& type,
279 const LocalVariable& temp,
276 const GrowableArray<AstNode*>& elements) 280 const GrowableArray<AstNode*>& elements)
277 : AstNode(token_pos), 281 : AstNode(token_pos),
278 type_(type), 282 type_(type),
283 temp_local_(temp),
279 elements_(elements.length()) { 284 elements_(elements.length()) {
280 CheckFields(); 285 CheckFields();
281 for (intptr_t i = 0; i < elements.length(); i++) { 286 for (intptr_t i = 0; i < elements.length(); i++) {
282 elements_.Add(elements[i]); 287 elements_.Add(elements[i]);
283 } 288 }
284 } 289 }
285 290
286 void VisitChildren(AstNodeVisitor* visitor) const; 291 void VisitChildren(AstNodeVisitor* visitor) const;
287 292
288 intptr_t length() const { return elements_.length(); } 293 intptr_t length() const { return elements_.length(); }
289 294
290 AstNode* ElementAt(intptr_t index) const { return elements_[index]; } 295 AstNode* ElementAt(intptr_t index) const { return elements_[index]; }
291 void SetElementAt(intptr_t index, AstNode* value) { 296 void SetElementAt(intptr_t index, AstNode* value) {
292 elements_[index] = value; 297 elements_[index] = value;
293 } 298 }
294 void AddElement(AstNode* expr) { elements_.Add(expr); } 299 void AddElement(AstNode* expr) { elements_.Add(expr); }
295 300
296 const AbstractType& type() const { return type_; } 301 const AbstractType& type() const { return type_; }
297 302
303 const LocalVariable& temp_local() const { return temp_local_; }
304
298 DECLARE_COMMON_NODE_FUNCTIONS(ArrayNode); 305 DECLARE_COMMON_NODE_FUNCTIONS(ArrayNode);
299 306
300 private: 307 private:
301 const AbstractType& type_; 308 const AbstractType& type_;
309 const LocalVariable& temp_local_; // Store allocated array while filling it.
302 GrowableArray<AstNode*> elements_; 310 GrowableArray<AstNode*> elements_;
303 311
304 void CheckFields() { 312 void CheckFields() {
305 ASSERT(type_.IsZoneHandle()); 313 ASSERT(type_.IsZoneHandle());
306 ASSERT(!type_.IsNull()); 314 ASSERT(!type_.IsNull());
307 ASSERT(type_.IsFinalized()); 315 ASSERT(type_.IsFinalized());
308 // Type may be uninstantiated when creating a generic list literal. 316 // Type may be uninstantiated when creating a generic list literal.
309 ASSERT((type_.arguments() == AbstractTypeArguments::null()) || 317 ASSERT((type_.arguments() == AbstractTypeArguments::null()) ||
310 ((AbstractTypeArguments::Handle(type_.arguments()).Length() == 1))); 318 ((AbstractTypeArguments::Handle(type_.arguments()).Length() == 1)));
311 } 319 }
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 const LocalVariable& context_var_; 1731 const LocalVariable& context_var_;
1724 1732
1725 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1733 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1726 }; 1734 };
1727 1735
1728 } // namespace dart 1736 } // namespace dart
1729 1737
1730 #undef DECLARE_COMMON_NODE_FUNCTIONS 1738 #undef DECLARE_COMMON_NODE_FUNCTIONS
1731 1739
1732 #endif // VM_AST_H_ 1740 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698