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

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

Issue 2658733002: VM: Remove unused optimization of merging of sin/cos. (Closed)
Patch Set: Remove now unused representation Created 3 years, 11 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
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language_arm.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 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 1617
1618 intptr_t ssa_temp_index() const { return ssa_temp_index_; } 1618 intptr_t ssa_temp_index() const { return ssa_temp_index_; }
1619 void set_ssa_temp_index(intptr_t index) { 1619 void set_ssa_temp_index(intptr_t index) {
1620 ASSERT(index >= 0); 1620 ASSERT(index >= 0);
1621 ssa_temp_index_ = index; 1621 ssa_temp_index_ = index;
1622 } 1622 }
1623 bool HasSSATemp() const { return ssa_temp_index_ >= 0; } 1623 bool HasSSATemp() const { return ssa_temp_index_ >= 0; }
1624 void ClearSSATempIndex() { ssa_temp_index_ = -1; } 1624 void ClearSSATempIndex() { ssa_temp_index_ = -1; }
1625 bool HasPairRepresentation() const { 1625 bool HasPairRepresentation() const {
1626 #if defined(TARGET_ARCH_X64) 1626 #if defined(TARGET_ARCH_X64)
1627 return (representation() == kPairOfTagged) || 1627 return representation() == kPairOfTagged;
1628 (representation() == kPairOfUnboxedDouble);
1629 #else 1628 #else
1630 return (representation() == kPairOfTagged) || 1629 return (representation() == kPairOfTagged) ||
1631 (representation() == kPairOfUnboxedDouble) ||
1632 (representation() == kUnboxedMint); 1630 (representation() == kUnboxedMint);
1633 #endif 1631 #endif
1634 } 1632 }
1635 1633
1636 // Compile time type of the definition, which may be requested before type 1634 // Compile time type of the definition, which may be requested before type
1637 // propagation during graph building. 1635 // propagation during graph building.
1638 CompileType* Type() { 1636 CompileType* Type() {
1639 if (type_ == NULL) { 1637 if (type_ == NULL) {
1640 type_ = ZoneCompileType::Wrap(ComputeType()); 1638 type_ = ZoneCompileType::Wrap(ComputeType());
1641 } 1639 }
(...skipping 5743 matching lines...) Expand 10 before | Expand all | Expand 10 after
7385 virtual bool CanDeoptimize() const { return false; } 7383 virtual bool CanDeoptimize() const { return false; }
7386 7384
7387 intptr_t index() const { return index_; } 7385 intptr_t index() const { return index_; }
7388 7386
7389 virtual Representation representation() const { return definition_rep_; } 7387 virtual Representation representation() const { return definition_rep_; }
7390 7388
7391 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7389 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7392 ASSERT(idx == 0); 7390 ASSERT(idx == 0);
7393 if (representation() == kTagged) { 7391 if (representation() == kTagged) {
7394 return kPairOfTagged; 7392 return kPairOfTagged;
7395 } else if (representation() == kUnboxedDouble) {
7396 return kPairOfUnboxedDouble;
7397 } 7393 }
7398 UNREACHABLE(); 7394 UNREACHABLE();
7399 return definition_rep_; 7395 return definition_rep_;
7400 } 7396 }
7401 7397
7402 virtual bool AttributesEqual(Instruction* other) const { 7398 virtual bool AttributesEqual(Instruction* other) const {
7403 ExtractNthOutputInstr* other_extract = other->AsExtractNthOutput(); 7399 ExtractNthOutputInstr* other_extract = other->AsExtractNthOutput();
7404 return (other_extract->representation() == representation()) && 7400 return (other_extract->representation() == representation()) &&
7405 (other_extract->index() == index()); 7401 (other_extract->index() == index());
7406 } 7402 }
7407 7403
7408 PRINT_OPERANDS_TO_SUPPORT 7404 PRINT_OPERANDS_TO_SUPPORT
7409 7405
7410 private: 7406 private:
7411 const intptr_t index_; 7407 const intptr_t index_;
7412 const Representation definition_rep_; 7408 const Representation definition_rep_;
7413 const intptr_t definition_cid_; 7409 const intptr_t definition_cid_;
7414 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr); 7410 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr);
7415 }; 7411 };
7416 7412
7417 7413
7418 class MergedMathInstr : public PureDefinition { 7414 class MergedMathInstr : public PureDefinition {
7419 public: 7415 public:
7420 enum Kind { 7416 enum Kind {
7421 kTruncDivMod, 7417 kTruncDivMod,
7422 kSinCos,
7423 }; 7418 };
7424 7419
7425 MergedMathInstr(ZoneGrowableArray<Value*>* inputs, 7420 MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
7426 intptr_t original_deopt_id, 7421 intptr_t original_deopt_id,
7427 MergedMathInstr::Kind kind); 7422 MergedMathInstr::Kind kind);
7428 7423
7429 static intptr_t InputCountFor(MergedMathInstr::Kind kind) { 7424 static intptr_t InputCountFor(MergedMathInstr::Kind kind) {
7430 if (kind == kTruncDivMod) { 7425 if (kind == kTruncDivMod) {
7431 return 2; 7426 return 2;
7432 } else if (kind == kSinCos) {
7433 return 1;
7434 } else { 7427 } else {
7435 UNIMPLEMENTED(); 7428 UNIMPLEMENTED();
7436 return -1; 7429 return -1;
7437 } 7430 }
7438 } 7431 }
7439 7432
7440 MergedMathInstr::Kind kind() const { return kind_; } 7433 MergedMathInstr::Kind kind() const { return kind_; }
7441 7434
7442 virtual intptr_t InputCount() const { return inputs_->length(); } 7435 virtual intptr_t InputCount() const { return inputs_->length(); }
7443 7436
7444 virtual Value* InputAt(intptr_t i) const { return (*inputs_)[i]; } 7437 virtual Value* InputAt(intptr_t i) const { return (*inputs_)[i]; }
7445 7438
7446 static intptr_t OutputIndexOf(MethodRecognizer::Kind kind); 7439 static intptr_t OutputIndexOf(MethodRecognizer::Kind kind);
7447 static intptr_t OutputIndexOf(Token::Kind token); 7440 static intptr_t OutputIndexOf(Token::Kind token);
7448 7441
7449 virtual CompileType ComputeType() const; 7442 virtual CompileType ComputeType() const;
7450 7443
7451 virtual bool CanDeoptimize() const { 7444 virtual bool CanDeoptimize() const {
7452 if (kind_ == kTruncDivMod) { 7445 if (kind_ == kTruncDivMod) {
7453 return true; 7446 return true;
7454 } else if (kind_ == kSinCos) {
7455 return false;
7456 } else { 7447 } else {
7457 UNIMPLEMENTED(); 7448 UNIMPLEMENTED();
7458 return false; 7449 return false;
7459 } 7450 }
7460 } 7451 }
7461 7452
7462 virtual Representation representation() const { 7453 virtual Representation representation() const {
7463 if (kind_ == kTruncDivMod) { 7454 if (kind_ == kTruncDivMod) {
7464 return kPairOfTagged; 7455 return kPairOfTagged;
7465 } else if (kind_ == kSinCos) {
7466 return kPairOfUnboxedDouble;
7467 } else { 7456 } else {
7468 UNIMPLEMENTED(); 7457 UNIMPLEMENTED();
7469 return kTagged; 7458 return kTagged;
7470 } 7459 }
7471 } 7460 }
7472 7461
7473 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7462 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7474 ASSERT((0 <= idx) && (idx < InputCount())); 7463 ASSERT((0 <= idx) && (idx < InputCount()));
7475 if (kind_ == kTruncDivMod) { 7464 if (kind_ == kTruncDivMod) {
7476 return kTagged; 7465 return kTagged;
7477 } else if (kind_ == kSinCos) {
7478 return kUnboxedDouble;
7479 } else { 7466 } else {
7480 UNIMPLEMENTED(); 7467 UNIMPLEMENTED();
7481 return kTagged; 7468 return kTagged;
7482 } 7469 }
7483 } 7470 }
7484 7471
7485 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 7472 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7486 7473
7487 DECLARE_INSTRUCTION(MergedMath) 7474 DECLARE_INSTRUCTION(MergedMath)
7488 7475
7489 virtual bool AttributesEqual(Instruction* other) const { 7476 virtual bool AttributesEqual(Instruction* other) const {
7490 MergedMathInstr* other_invoke = other->AsMergedMath(); 7477 MergedMathInstr* other_invoke = other->AsMergedMath();
7491 return other_invoke->kind() == kind(); 7478 return other_invoke->kind() == kind();
7492 } 7479 }
7493 7480
7494 virtual bool MayThrow() const { return false; } 7481 virtual bool MayThrow() const { return false; }
7495 7482
7496 static const char* KindToCString(MergedMathInstr::Kind kind) { 7483 static const char* KindToCString(MergedMathInstr::Kind kind) {
7497 if (kind == kTruncDivMod) return "TruncDivMod"; 7484 if (kind == kTruncDivMod) return "TruncDivMod";
7498 if (kind == kSinCos) return "SinCos";
7499 UNIMPLEMENTED(); 7485 UNIMPLEMENTED();
7500 return ""; 7486 return "";
7501 } 7487 }
7502 7488
7503 PRINT_OPERANDS_TO_SUPPORT 7489 PRINT_OPERANDS_TO_SUPPORT
7504 7490
7505 private: 7491 private:
7506 virtual void RawSetInputAt(intptr_t i, Value* value) { 7492 virtual void RawSetInputAt(intptr_t i, Value* value) {
7507 (*inputs_)[i] = value; 7493 (*inputs_)[i] = value;
7508 } 7494 }
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
8038 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ 8024 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \
8039 UNIMPLEMENTED(); \ 8025 UNIMPLEMENTED(); \
8040 return NULL; \ 8026 return NULL; \
8041 } \ 8027 } \
8042 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8028 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8043 8029
8044 8030
8045 } // namespace dart 8031 } // namespace dart
8046 8032
8047 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ 8033 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698