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

Side by Side Diff: vm/intermediate_language.h

Issue 10409043: Make saving and restoring of the context around closure calls explicit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | « vm/il_printer.cc ('k') | vm/intermediate_language.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_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 357
358 private: 358 private:
359 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); 359 DISALLOW_COPY_AND_ASSIGN(StoreContextComp);
360 }; 360 };
361 361
362 362
363 class ClosureCallComp : public Computation { 363 class ClosureCallComp : public Computation {
364 public: 364 public:
365 ClosureCallComp(ClosureCallNode* node, 365 ClosureCallComp(ClosureCallNode* node,
366 intptr_t try_index, 366 intptr_t try_index,
367 Value* context,
368 ZoneGrowableArray<Value*>* arguments) 367 ZoneGrowableArray<Value*>* arguments)
369 : ast_node_(*node), 368 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { }
370 try_index_(try_index),
371 context_(context),
372 arguments_(arguments) {
373 ASSERT(context->IsUse());
374 }
375 369
376 DECLARE_COMPUTATION(ClosureCall) 370 DECLARE_COMPUTATION(ClosureCall)
377 371
378 const Array& argument_names() const { return ast_node_.arguments()->names(); } 372 const Array& argument_names() const { return ast_node_.arguments()->names(); }
379 intptr_t token_index() const { return ast_node_.token_index(); } 373 intptr_t token_index() const { return ast_node_.token_index(); }
380 intptr_t try_index() const { return try_index_; } 374 intptr_t try_index() const { return try_index_; }
381 375
382 Value* context() const { return context_; }
383 intptr_t ArgumentCount() const { return arguments_->length(); } 376 intptr_t ArgumentCount() const { return arguments_->length(); }
384 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 377 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
385 378
386 virtual intptr_t InputCount() const; 379 virtual intptr_t InputCount() const;
387 virtual Value* InputAt(intptr_t i) const { 380 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
388 return i == 0 ? context() : ArgumentAt(i - 1);
389 }
390 381
391 virtual void PrintOperandsTo(BufferFormatter* f) const; 382 virtual void PrintOperandsTo(BufferFormatter* f) const;
392 383
393 private: 384 private:
394 const ClosureCallNode& ast_node_; 385 const ClosureCallNode& ast_node_;
395 const intptr_t try_index_; 386 const intptr_t try_index_;
396 Value* context_;
397 ZoneGrowableArray<Value*>* arguments_; 387 ZoneGrowableArray<Value*>* arguments_;
398 388
399 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); 389 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp);
400 }; 390 };
401 391
402 392
403 class InstanceCallComp : public Computation { 393 class InstanceCallComp : public Computation {
404 public: 394 public:
405 InstanceCallComp(intptr_t token_index, 395 InstanceCallComp(intptr_t token_index,
406 intptr_t try_index, 396 intptr_t try_index,
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 const GrowableArray<BlockEntryInstr*>& block_order_; 1796 const GrowableArray<BlockEntryInstr*>& block_order_;
1807 1797
1808 private: 1798 private:
1809 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1799 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1810 }; 1800 };
1811 1801
1812 1802
1813 } // namespace dart 1803 } // namespace dart
1814 1804
1815 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1805 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « vm/il_printer.cc ('k') | vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698