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

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

Issue 2955073005: VM-codegen: Add IL instruction to check if a Smi is in a constant range
Patch Set: Created 3 years, 5 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
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 M(LoadField) \ 408 M(LoadField) \
409 M(LoadUntagged) \ 409 M(LoadUntagged) \
410 M(LoadClassId) \ 410 M(LoadClassId) \
411 M(InstantiateType) \ 411 M(InstantiateType) \
412 M(InstantiateTypeArguments) \ 412 M(InstantiateTypeArguments) \
413 M(AllocateContext) \ 413 M(AllocateContext) \
414 M(AllocateUninitializedContext) \ 414 M(AllocateUninitializedContext) \
415 M(CloneContext) \ 415 M(CloneContext) \
416 M(BinarySmiOp) \ 416 M(BinarySmiOp) \
417 M(CheckedSmiComparison) \ 417 M(CheckedSmiComparison) \
418 M(SmiRangeComparison) \
418 M(CheckedSmiOp) \ 419 M(CheckedSmiOp) \
419 M(BinaryInt32Op) \ 420 M(BinaryInt32Op) \
420 M(UnarySmiOp) \ 421 M(UnarySmiOp) \
421 M(UnaryDoubleOp) \ 422 M(UnaryDoubleOp) \
422 M(CheckStackOverflow) \ 423 M(CheckStackOverflow) \
423 M(SmiToDouble) \ 424 M(SmiToDouble) \
424 M(Int32ToDouble) \ 425 M(Int32ToDouble) \
425 M(MintToDouble) \ 426 M(MintToDouble) \
426 M(DoubleToInteger) \ 427 M(DoubleToInteger) \
427 M(DoubleToSmi) \ 428 M(DoubleToSmi) \
(...skipping 6529 matching lines...) Expand 10 before | Expand all | Expand 10 after
6957 6958
6958 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 6959 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
6959 6960
6960 private: 6961 private:
6961 InstanceCallInstr* call_; 6962 InstanceCallInstr* call_;
6962 bool is_negated_; 6963 bool is_negated_;
6963 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); 6964 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr);
6964 }; 6965 };
6965 6966
6966 6967
6968 // Instruction that checks whether a Smi input is in a constant
6969 // inclusive range.
6970 class SmiRangeComparisonInstr : public TemplateComparison<1, NoThrow, Pure> {
6971 public:
6972 SmiRangeComparisonInstr(TokenPosition token_pos,
6973 Value* input,
6974 intptr_t from,
6975 intptr_t to)
6976 : TemplateComparison(token_pos, Token::kIS, Thread::kNoDeoptId),
Vyacheslav Egorov (Google) 2017/06/28 13:53:47 Please comment here why Token::kIS makes sense for
erikcorry 2017/07/03 08:59:55 Done.
6977 from_(from),
6978 to_(to),
6979 is_negated_(false) {
6980 SetInputAt(0, input);
6981 }
6982
6983 virtual bool ComputeCanDeoptimize() const { return false; }
6984
6985 virtual void NegateComparison() {
6986 ComparisonInstr::NegateComparison();
6987 is_negated_ = !is_negated_;
6988 }
6989
6990 Value* input() const { return inputs_[0]; }
6991
6992 intptr_t from() { return from_; }
6993 intptr_t to() { return to_; }
6994 bool is_negated() const { return is_negated_; }
Vyacheslav Egorov (Google) 2017/06/28 13:53:47 I think you don't need is_negated_ member: is_neg
erikcorry 2017/07/03 08:59:55 Done.
6995
6996 virtual EffectSet Effects() const { return EffectSet::None(); }
6997
6998 virtual CompileType ComputeType() const;
6999
7000 PRINT_OPERANDS_TO_SUPPORT
7001
7002 DECLARE_COMPARISON_INSTRUCTION(SmiRangeComparison)
7003
7004 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
7005
7006 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7007 return kTagged;
7008 }
7009
7010 private:
7011 intptr_t from_;
Vyacheslav Egorov (Google) 2017/06/28 13:53:47 const intptr_t from_; const intptr_t to_; Also y
erikcorry 2017/07/03 08:59:55 Done.
7012 intptr_t to_;
7013 bool is_negated_;
7014 DISALLOW_COPY_AND_ASSIGN(SmiRangeComparisonInstr);
7015 };
7016
7017
6967 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { 7018 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> {
6968 public: 7019 public:
6969 BinaryIntegerOpInstr(Token::Kind op_kind, 7020 BinaryIntegerOpInstr(Token::Kind op_kind,
6970 Value* left, 7021 Value* left,
6971 Value* right, 7022 Value* right,
6972 intptr_t deopt_id) 7023 intptr_t deopt_id)
6973 : TemplateDefinition(deopt_id), 7024 : TemplateDefinition(deopt_id),
6974 op_kind_(op_kind), 7025 op_kind_(op_kind),
6975 can_overflow_(true), 7026 can_overflow_(true),
6976 is_truncating_(false) { 7027 is_truncating_(false) {
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after
8256 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8307 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8257 UNIMPLEMENTED(); \ 8308 UNIMPLEMENTED(); \
8258 return NULL; \ 8309 return NULL; \
8259 } \ 8310 } \
8260 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8311 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8261 8312
8262 8313
8263 } // namespace dart 8314 } // namespace dart
8264 8315
8265 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8316 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698