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

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

Issue 10832277: Eliminate condition type check when possible. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « runtime/vm/il_printer.cc ('k') | runtime/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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 intptr_t try_index, 396 intptr_t try_index,
397 Value* value, 397 Value* value,
398 Value* instantiator, 398 Value* instantiator,
399 Value* instantiator_type_arguments, 399 Value* instantiator_type_arguments,
400 const AbstractType& dst_type, 400 const AbstractType& dst_type,
401 const String& dst_name) 401 const String& dst_name)
402 : token_pos_(token_pos), 402 : token_pos_(token_pos),
403 try_index_(try_index), 403 try_index_(try_index),
404 dst_type_(dst_type), 404 dst_type_(dst_type),
405 dst_name_(dst_name), 405 dst_name_(dst_name),
406 eliminated_(false) { 406 is_eliminated_(false) {
407 ASSERT(value != NULL); 407 ASSERT(value != NULL);
408 ASSERT(instantiator != NULL); 408 ASSERT(instantiator != NULL);
409 ASSERT(instantiator_type_arguments != NULL); 409 ASSERT(instantiator_type_arguments != NULL);
410 ASSERT(!dst_type.IsNull()); 410 ASSERT(!dst_type.IsNull());
411 ASSERT(!dst_name.IsNull()); 411 ASSERT(!dst_name.IsNull());
412 inputs_[0] = value; 412 inputs_[0] = value;
413 inputs_[1] = instantiator; 413 inputs_[1] = instantiator;
414 inputs_[2] = instantiator_type_arguments; 414 inputs_[2] = instantiator_type_arguments;
415 } 415 }
416 416
417 DECLARE_COMPUTATION(AssertAssignable) 417 DECLARE_COMPUTATION(AssertAssignable)
418 418
419 Value* value() const { return inputs_[0]; } 419 Value* value() const { return inputs_[0]; }
420 Value* instantiator() const { return inputs_[1]; } 420 Value* instantiator() const { return inputs_[1]; }
421 Value* instantiator_type_arguments() const { return inputs_[2]; } 421 Value* instantiator_type_arguments() const { return inputs_[2]; }
422 422
423 intptr_t token_pos() const { return token_pos_; } 423 intptr_t token_pos() const { return token_pos_; }
424 intptr_t try_index() const { return try_index_; } 424 intptr_t try_index() const { return try_index_; }
425 const AbstractType& dst_type() const { return dst_type_; } 425 const AbstractType& dst_type() const { return dst_type_; }
426 const String& dst_name() const { return dst_name_; } 426 const String& dst_name() const { return dst_name_; }
427 427
428 bool IsEliminated() const { 428 bool is_eliminated() const {
429 return eliminated_; 429 return is_eliminated_;
430 } 430 }
431 void Eliminate() { 431 void eliminate() {
432 ASSERT(!eliminated_); 432 ASSERT(!is_eliminated_);
433 eliminated_ = true; 433 is_eliminated_ = true;
434 } 434 }
435 435
436 virtual void PrintOperandsTo(BufferFormatter* f) const; 436 virtual void PrintOperandsTo(BufferFormatter* f) const;
437 437
438 virtual bool CanDeoptimize() const { return false; } 438 virtual bool CanDeoptimize() const { return false; }
439 439
440 private: 440 private:
441 const intptr_t token_pos_; 441 const intptr_t token_pos_;
442 const intptr_t try_index_; 442 const intptr_t try_index_;
443 const AbstractType& dst_type_; 443 const AbstractType& dst_type_;
444 const String& dst_name_; 444 const String& dst_name_;
445 bool eliminated_; 445 bool is_eliminated_;
446 446
447 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); 447 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp);
448 }; 448 };
449 449
450 450
451 class AssertBooleanComp : public TemplateComputation<1> { 451 class AssertBooleanComp : public TemplateComputation<1> {
452 public: 452 public:
453 AssertBooleanComp(intptr_t token_pos, 453 AssertBooleanComp(intptr_t token_pos,
454 intptr_t try_index, 454 intptr_t try_index,
455 Value* value) 455 Value* value)
456 : token_pos_(token_pos), 456 : token_pos_(token_pos),
457 try_index_(try_index) { 457 try_index_(try_index),
458 is_eliminated_(false) {
458 ASSERT(value != NULL); 459 ASSERT(value != NULL);
459 inputs_[0] = value; 460 inputs_[0] = value;
460 } 461 }
461 462
462 DECLARE_COMPUTATION(AssertBoolean) 463 DECLARE_COMPUTATION(AssertBoolean)
463 464
464 intptr_t token_pos() const { return token_pos_; } 465 intptr_t token_pos() const { return token_pos_; }
465 intptr_t try_index() const { return try_index_; } 466 intptr_t try_index() const { return try_index_; }
466 Value* value() const { return inputs_[0]; } 467 Value* value() const { return inputs_[0]; }
467 468
469 bool is_eliminated() const {
470 return is_eliminated_;
471 }
472 void eliminate() {
473 ASSERT(!is_eliminated_);
474 is_eliminated_ = true;
475 }
476
477 virtual void PrintOperandsTo(BufferFormatter* f) const;
478
468 virtual bool CanDeoptimize() const { return false; } 479 virtual bool CanDeoptimize() const { return false; }
469 480
470 private: 481 private:
471 const intptr_t token_pos_; 482 const intptr_t token_pos_;
472 const intptr_t try_index_; 483 const intptr_t try_index_;
484 bool is_eliminated_;
473 485
474 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); 486 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp);
475 }; 487 };
476 488
477 489
478 // Denotes the current context, normally held in a register. This is 490 // Denotes the current context, normally held in a register. This is
479 // a computation, not a value, because it's mutable. 491 // a computation, not a value, because it's mutable.
480 class CurrentContextComp : public TemplateComputation<0> { 492 class CurrentContextComp : public TemplateComputation<0> {
481 public: 493 public:
482 CurrentContextComp() { } 494 CurrentContextComp() { }
(...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after
2893 const GrowableArray<BlockEntryInstr*>& block_order_; 2905 const GrowableArray<BlockEntryInstr*>& block_order_;
2894 2906
2895 private: 2907 private:
2896 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2908 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2897 }; 2909 };
2898 2910
2899 2911
2900 } // namespace dart 2912 } // namespace dart
2901 2913
2902 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2914 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698