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

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

Issue 2466643002: AOT: Enable branch merging for checked smi comparisons (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 6 #define RUNTIME_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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 M(AllocateObject) \ 470 M(AllocateObject) \
471 M(LoadField) \ 471 M(LoadField) \
472 M(LoadUntagged) \ 472 M(LoadUntagged) \
473 M(LoadClassId) \ 473 M(LoadClassId) \
474 M(InstantiateType) \ 474 M(InstantiateType) \
475 M(InstantiateTypeArguments) \ 475 M(InstantiateTypeArguments) \
476 M(AllocateContext) \ 476 M(AllocateContext) \
477 M(AllocateUninitializedContext) \ 477 M(AllocateUninitializedContext) \
478 M(CloneContext) \ 478 M(CloneContext) \
479 M(BinarySmiOp) \ 479 M(BinarySmiOp) \
480 M(CheckedSmiComparison) \
480 M(CheckedSmiOp) \ 481 M(CheckedSmiOp) \
481 M(BinaryInt32Op) \ 482 M(BinaryInt32Op) \
482 M(UnarySmiOp) \ 483 M(UnarySmiOp) \
483 M(UnaryDoubleOp) \ 484 M(UnaryDoubleOp) \
484 M(CheckStackOverflow) \ 485 M(CheckStackOverflow) \
485 M(SmiToDouble) \ 486 M(SmiToDouble) \
486 M(Int32ToDouble) \ 487 M(Int32ToDouble) \
487 M(MintToDouble) \ 488 M(MintToDouble) \
488 M(DoubleToInteger) \ 489 M(DoubleToInteger) \
489 M(DoubleToSmi) \ 490 M(DoubleToSmi) \
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 BranchLabels labels) = 0; 2375 BranchLabels labels) = 0;
2375 2376
2376 void SetDeoptId(const Instruction& instr) { 2377 void SetDeoptId(const Instruction& instr) {
2377 CopyDeoptIdFrom(instr); 2378 CopyDeoptIdFrom(instr);
2378 } 2379 }
2379 2380
2380 // Operation class id is computed from collected ICData. 2381 // Operation class id is computed from collected ICData.
2381 void set_operation_cid(intptr_t value) { operation_cid_ = value; } 2382 void set_operation_cid(intptr_t value) { operation_cid_ = value; }
2382 intptr_t operation_cid() const { return operation_cid_; } 2383 intptr_t operation_cid() const { return operation_cid_; }
2383 2384
2384 void NegateComparison() { 2385 virtual void NegateComparison() {
2385 kind_ = Token::NegateComparison(kind_); 2386 kind_ = Token::NegateComparison(kind_);
2386 } 2387 }
2387 2388
2388 virtual bool CanBecomeDeoptimizationTarget() const { return true; } 2389 virtual bool CanBecomeDeoptimizationTarget() const { return true; }
2389 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 2390 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
2390 2391
2391 virtual bool AttributesEqual(Instruction* other) const { 2392 virtual bool AttributesEqual(Instruction* other) const {
2392 ComparisonInstr* other_comparison = other->AsComparison(); 2393 ComparisonInstr* other_comparison = other->AsComparison();
2393 return kind() == other_comparison->kind() && 2394 return kind() == other_comparison->kind() &&
2394 (operation_cid() == other_comparison->operation_cid()); 2395 (operation_cid() == other_comparison->operation_cid());
(...skipping 4595 matching lines...) Expand 10 before | Expand all | Expand 10 after
6990 op_kind_(op_kind) { 6991 op_kind_(op_kind) {
6991 SetInputAt(0, left); 6992 SetInputAt(0, left);
6992 SetInputAt(1, right); 6993 SetInputAt(1, right);
6993 } 6994 }
6994 6995
6995 InstanceCallInstr* call() const { return call_; } 6996 InstanceCallInstr* call() const { return call_; }
6996 Token::Kind op_kind() const { return op_kind_; } 6997 Token::Kind op_kind() const { return op_kind_; }
6997 Value* left() const { return inputs_[0]; } 6998 Value* left() const { return inputs_[0]; }
6998 Value* right() const { return inputs_[1]; } 6999 Value* right() const { return inputs_[1]; }
6999 7000
7000 virtual bool CanDeoptimize() const { return true; } 7001 virtual bool CanDeoptimize() const { return false; }
7001 7002
7002 virtual EffectSet Effects() const { return EffectSet::All(); } 7003 virtual EffectSet Effects() const { return EffectSet::All(); }
7003 7004
7004 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7005 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7005 7006
7006 PRINT_OPERANDS_TO_SUPPORT 7007 PRINT_OPERANDS_TO_SUPPORT
7007 7008
7008 DECLARE_INSTRUCTION(CheckedSmiOp) 7009 DECLARE_INSTRUCTION(CheckedSmiOp)
7009 7010
7010 private: 7011 private:
7011 InstanceCallInstr* call_; 7012 InstanceCallInstr* call_;
7012 const Token::Kind op_kind_; 7013 const Token::Kind op_kind_;
7013 DISALLOW_COPY_AND_ASSIGN(CheckedSmiOpInstr); 7014 DISALLOW_COPY_AND_ASSIGN(CheckedSmiOpInstr);
7014 }; 7015 };
7015 7016
7016 7017
7018 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> {
7019 public:
7020 CheckedSmiComparisonInstr(Token::Kind op_kind,
7021 Value* left,
7022 Value* right,
7023 InstanceCallInstr* call)
7024 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()),
7025 call_(call),
7026 is_negated_(false) {
7027 SetInputAt(0, left);
7028 SetInputAt(1, right);
7029 }
7030
7031 InstanceCallInstr* call() const { return call_; }
7032
7033 virtual bool CanDeoptimize() const { return false; }
7034
7035 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7036
7037 virtual void NegateComparison() {
7038 ComparisonInstr::NegateComparison();
7039 is_negated_ = !is_negated_;
7040 }
7041
7042 bool is_negated() const { return is_negated_; }
7043
7044 virtual EffectSet Effects() const { return EffectSet::All(); }
7045
7046 PRINT_OPERANDS_TO_SUPPORT
7047
7048 DECLARE_INSTRUCTION(CheckedSmiComparison)
7049
7050 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
7051 BranchInstr* branch);
7052
7053 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
7054 BranchLabels labels);
7055
7056 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
7057
7058 private:
7059 InstanceCallInstr* call_;
7060 bool is_negated_;
7061 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr);
7062 };
7063
7064
7017 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { 7065 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> {
7018 public: 7066 public:
7019 BinaryIntegerOpInstr(Token::Kind op_kind, 7067 BinaryIntegerOpInstr(Token::Kind op_kind,
7020 Value* left, 7068 Value* left,
7021 Value* right, 7069 Value* right,
7022 intptr_t deopt_id) 7070 intptr_t deopt_id)
7023 : TemplateDefinition(deopt_id), 7071 : TemplateDefinition(deopt_id),
7024 op_kind_(op_kind), 7072 op_kind_(op_kind),
7025 can_overflow_(true), 7073 can_overflow_(true),
7026 is_truncating_(false) { 7074 is_truncating_(false) {
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after
8415 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8463 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8416 UNIMPLEMENTED(); \ 8464 UNIMPLEMENTED(); \
8417 return NULL; \ 8465 return NULL; \
8418 } \ 8466 } \
8419 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8467 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8420 8468
8421 8469
8422 } // namespace dart 8470 } // namespace dart
8423 8471
8424 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8472 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698