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

Side by Side Diff: vm/intermediate_language.h

Issue 10407082: Reland: Migrate {Closure,Instance,Static}Call to use location-based code generation templates. (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/flow_graph_compiler_x64.cc ('k') | vm/intermediate_language_ia32.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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 private: 385 private:
386 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); 386 DISALLOW_COPY_AND_ASSIGN(StoreContextComp);
387 }; 387 };
388 388
389 389
390 class ClosureCallComp : public Computation { 390 class ClosureCallComp : public Computation {
391 public: 391 public:
392 ClosureCallComp(ClosureCallNode* node, 392 ClosureCallComp(ClosureCallNode* node,
393 intptr_t try_index, 393 intptr_t try_index,
394 ZoneGrowableArray<Value*>* arguments) 394 ZoneGrowableArray<Value*>* arguments)
395 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { } 395 : ast_node_(*node),
396 try_index_(try_index),
397 arguments_(arguments),
398 location_summary_(MakeLocationSummary()) { }
396 399
397 DECLARE_COMPUTATION(ClosureCall) 400 DECLARE_COMPUTATION(ClosureCall)
398 401
399 const Array& argument_names() const { return ast_node_.arguments()->names(); } 402 const Array& argument_names() const { return ast_node_.arguments()->names(); }
400 intptr_t token_index() const { return ast_node_.token_index(); } 403 intptr_t token_index() const { return ast_node_.token_index(); }
401 intptr_t try_index() const { return try_index_; } 404 intptr_t try_index() const { return try_index_; }
402 405
403 intptr_t ArgumentCount() const { return arguments_->length(); } 406 intptr_t ArgumentCount() const { return arguments_->length(); }
404 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 407 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
405 408
406 virtual intptr_t InputCount() const; 409 virtual intptr_t InputCount() const;
407 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 410 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
408 411
409 virtual void PrintOperandsTo(BufferFormatter* f) const; 412 virtual void PrintOperandsTo(BufferFormatter* f) const;
410 413
414 virtual LocationSummary* locs() const {
415 return location_summary_;
416 }
417
418 // Platform specific summary factory for this instruction.
419 LocationSummary* MakeLocationSummary();
420
421 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
422
411 private: 423 private:
412 const ClosureCallNode& ast_node_; 424 const ClosureCallNode& ast_node_;
413 const intptr_t try_index_; 425 const intptr_t try_index_;
414 ZoneGrowableArray<Value*>* arguments_; 426 ZoneGrowableArray<Value*>* arguments_;
427 LocationSummary* location_summary_;
415 428
416 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); 429 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp);
417 }; 430 };
418 431
419 432
420 class InstanceCallComp : public Computation { 433 class InstanceCallComp : public Computation {
421 public: 434 public:
422 InstanceCallComp(intptr_t token_index, 435 InstanceCallComp(intptr_t token_index,
423 intptr_t try_index, 436 intptr_t try_index,
424 const String& function_name, 437 const String& function_name,
425 ZoneGrowableArray<Value*>* arguments, 438 ZoneGrowableArray<Value*>* arguments,
426 const Array& argument_names, 439 const Array& argument_names,
427 intptr_t checked_argument_count) 440 intptr_t checked_argument_count)
428 : token_index_(token_index), 441 : token_index_(token_index),
429 try_index_(try_index), 442 try_index_(try_index),
430 function_name_(function_name), 443 function_name_(function_name),
431 arguments_(arguments), 444 arguments_(arguments),
432 argument_names_(argument_names), 445 argument_names_(argument_names),
433 checked_argument_count_(checked_argument_count) { 446 checked_argument_count_(checked_argument_count),
447 location_summary_(MakeLocationSummary()) {
434 ASSERT(function_name.IsZoneHandle()); 448 ASSERT(function_name.IsZoneHandle());
435 ASSERT(!arguments->is_empty()); 449 ASSERT(!arguments->is_empty());
436 ASSERT(argument_names.IsZoneHandle()); 450 ASSERT(argument_names.IsZoneHandle());
437 } 451 }
438 452
439 DECLARE_COMPUTATION(InstanceCall) 453 DECLARE_COMPUTATION(InstanceCall)
440 454
441 intptr_t token_index() const { return token_index_; } 455 intptr_t token_index() const { return token_index_; }
442 intptr_t try_index() const { return try_index_; } 456 intptr_t try_index() const { return try_index_; }
443 const String& function_name() const { return function_name_; } 457 const String& function_name() const { return function_name_; }
444 intptr_t ArgumentCount() const { return arguments_->length(); } 458 intptr_t ArgumentCount() const { return arguments_->length(); }
445 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 459 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
446 const Array& argument_names() const { return argument_names_; } 460 const Array& argument_names() const { return argument_names_; }
447 intptr_t checked_argument_count() const { return checked_argument_count_; } 461 intptr_t checked_argument_count() const { return checked_argument_count_; }
448 462
449 virtual intptr_t InputCount() const; 463 virtual intptr_t InputCount() const;
450 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 464 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
451 465
452 virtual void PrintOperandsTo(BufferFormatter* f) const; 466 virtual void PrintOperandsTo(BufferFormatter* f) const;
453 467
468 virtual LocationSummary* locs() const {
469 return location_summary_;
470 }
471
472 // Platform specific summary factory for this instruction.
473 LocationSummary* MakeLocationSummary();
474
475 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
476
454 private: 477 private:
455 const intptr_t token_index_; 478 const intptr_t token_index_;
456 const intptr_t try_index_; 479 const intptr_t try_index_;
457 const String& function_name_; 480 const String& function_name_;
458 ZoneGrowableArray<Value*>* const arguments_; 481 ZoneGrowableArray<Value*>* const arguments_;
459 const Array& argument_names_; 482 const Array& argument_names_;
460 const intptr_t checked_argument_count_; 483 const intptr_t checked_argument_count_;
484 LocationSummary* location_summary_;
461 485
462 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); 486 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp);
463 }; 487 };
464 488
465 489
466 class StrictCompareComp : public TemplateComputation<2> { 490 class StrictCompareComp : public TemplateComputation<2> {
467 public: 491 public:
468 StrictCompareComp(Token::Kind kind, Value* left, Value* right) 492 StrictCompareComp(Token::Kind kind, Value* left, Value* right)
469 : kind_(kind) { 493 : kind_(kind) {
470 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT)); 494 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 public: 558 public:
535 StaticCallComp(intptr_t token_index, 559 StaticCallComp(intptr_t token_index,
536 intptr_t try_index, 560 intptr_t try_index,
537 const Function& function, 561 const Function& function,
538 const Array& argument_names, 562 const Array& argument_names,
539 ZoneGrowableArray<Value*>* arguments) 563 ZoneGrowableArray<Value*>* arguments)
540 : token_index_(token_index), 564 : token_index_(token_index),
541 try_index_(try_index), 565 try_index_(try_index),
542 function_(function), 566 function_(function),
543 argument_names_(argument_names), 567 argument_names_(argument_names),
544 arguments_(arguments) { 568 arguments_(arguments),
569 location_summary_(MakeLocationSummary()) {
545 ASSERT(function.IsZoneHandle()); 570 ASSERT(function.IsZoneHandle());
546 ASSERT(argument_names.IsZoneHandle()); 571 ASSERT(argument_names.IsZoneHandle());
547 } 572 }
548 573
549 DECLARE_COMPUTATION(StaticCall) 574 DECLARE_COMPUTATION(StaticCall)
550 575
551 // Accessors forwarded to the AST node. 576 // Accessors forwarded to the AST node.
552 const Function& function() const { return function_; } 577 const Function& function() const { return function_; }
553 const Array& argument_names() const { return argument_names_; } 578 const Array& argument_names() const { return argument_names_; }
554 intptr_t token_index() const { return token_index_; } 579 intptr_t token_index() const { return token_index_; }
555 intptr_t try_index() const { return try_index_; } 580 intptr_t try_index() const { return try_index_; }
556 581
557 intptr_t ArgumentCount() const { return arguments_->length(); } 582 intptr_t ArgumentCount() const { return arguments_->length(); }
558 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; } 583 Value* ArgumentAt(intptr_t index) const { return (*arguments_)[index]; }
559 584
560 virtual intptr_t InputCount() const; 585 virtual intptr_t InputCount() const;
561 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); } 586 virtual Value* InputAt(intptr_t i) const { return ArgumentAt(i); }
562 587
563 virtual void PrintOperandsTo(BufferFormatter* f) const; 588 virtual void PrintOperandsTo(BufferFormatter* f) const;
564 589
590 virtual LocationSummary* locs() const {
591 return location_summary_;
592 }
593
594 // Platform specific summary factory for this instruction.
595 LocationSummary* MakeLocationSummary();
596
597 virtual void EmitNativeCode(FlowGraphCompiler* compiler);
598
565 private: 599 private:
566 const intptr_t token_index_; 600 const intptr_t token_index_;
567 const intptr_t try_index_; 601 const intptr_t try_index_;
568 const Function& function_; 602 const Function& function_;
569 const Array& argument_names_; 603 const Array& argument_names_;
570 ZoneGrowableArray<Value*>* arguments_; 604 ZoneGrowableArray<Value*>* arguments_;
605 LocationSummary* location_summary_;
571 606
572 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); 607 DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
573 }; 608 };
574 609
575 610
576 class LoadLocalComp : public TemplateComputation<0> { 611 class LoadLocalComp : public TemplateComputation<0> {
577 public: 612 public:
578 LoadLocalComp(const LocalVariable& local, intptr_t context_level) 613 LoadLocalComp(const LocalVariable& local, intptr_t context_level)
579 : local_(local), context_level_(context_level) { } 614 : local_(local), context_level_(context_level) { }
580 615
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 const GrowableArray<BlockEntryInstr*>& block_order_; 1899 const GrowableArray<BlockEntryInstr*>& block_order_;
1865 1900
1866 private: 1901 private:
1867 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1902 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1868 }; 1903 };
1869 1904
1870 1905
1871 } // namespace dart 1906 } // namespace dart
1872 1907
1873 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1908 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « vm/flow_graph_compiler_x64.cc ('k') | vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698