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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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
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 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 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 Representation representation_; 1902 Representation representation_;
1903 1903
1904 BitVector* reaching_defs_; 1904 BitVector* reaching_defs_;
1905 1905
1906 DISALLOW_COPY_AND_ASSIGN(PhiInstr); 1906 DISALLOW_COPY_AND_ASSIGN(PhiInstr);
1907 }; 1907 };
1908 1908
1909 1909
1910 class ParameterInstr : public Definition { 1910 class ParameterInstr : public Definition {
1911 public: 1911 public:
1912 ParameterInstr(intptr_t index, BlockEntryInstr* block) 1912 ParameterInstr(intptr_t index,
1913 : index_(index), block_(block) { } 1913 BlockEntryInstr* block,
1914 Register base_reg = FPREG)
1915 : index_(index), base_reg_(base_reg), block_(block) { }
1914 1916
1915 DECLARE_INSTRUCTION(Parameter) 1917 DECLARE_INSTRUCTION(Parameter)
1916 1918
1917 intptr_t index() const { return index_; } 1919 intptr_t index() const { return index_; }
1920 Register base_reg() const { return base_reg_; }
1918 1921
1919 // Get the block entry for that instruction. 1922 // Get the block entry for that instruction.
1920 virtual BlockEntryInstr* GetBlock() const { return block_; } 1923 virtual BlockEntryInstr* GetBlock() const { return block_; }
1921 1924
1922 virtual intptr_t ArgumentCount() const { return 0; } 1925 virtual intptr_t ArgumentCount() const { return 0; }
1923 1926
1924 intptr_t InputCount() const { return 0; } 1927 intptr_t InputCount() const { return 0; }
1925 Value* InputAt(intptr_t i) const { 1928 Value* InputAt(intptr_t i) const {
1926 UNREACHABLE(); 1929 UNREACHABLE();
1927 return NULL; 1930 return NULL;
(...skipping 12 matching lines...) Expand all
1940 virtual void PrintOperandsTo(BufferFormatter* f) const; 1943 virtual void PrintOperandsTo(BufferFormatter* f) const;
1941 1944
1942 virtual CompileType ComputeType() const; 1945 virtual CompileType ComputeType() const;
1943 1946
1944 virtual bool MayThrow() const { return false; } 1947 virtual bool MayThrow() const { return false; }
1945 1948
1946 private: 1949 private:
1947 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 1950 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1948 1951
1949 const intptr_t index_; 1952 const intptr_t index_;
1953 const Register base_reg_;
1950 BlockEntryInstr* block_; 1954 BlockEntryInstr* block_;
1951 1955
1952 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 1956 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
1953 }; 1957 };
1954 1958
1955 1959
1956 class PushArgumentInstr : public TemplateDefinition<1> { 1960 class PushArgumentInstr : public TemplateDefinition<1> {
1957 public: 1961 public:
1958 explicit PushArgumentInstr(Value* value) { 1962 explicit PushArgumentInstr(Value* value) {
1959 SetInputAt(0, value); 1963 SetInputAt(0, value);
(...skipping 20 matching lines...) Expand all
1980 }; 1984 };
1981 1985
1982 1986
1983 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 1987 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
1984 return PushArgumentAt(index)->value()->definition(); 1988 return PushArgumentAt(index)->value()->definition();
1985 } 1989 }
1986 1990
1987 1991
1988 class ReturnInstr : public TemplateInstruction<1> { 1992 class ReturnInstr : public TemplateInstruction<1> {
1989 public: 1993 public:
1990 ReturnInstr(intptr_t token_pos, Value* value) 1994 ReturnInstr(intptr_t token_pos, Value* value, bool is_intrinsic = false)
1991 : token_pos_(token_pos) { 1995 : token_pos_(token_pos), is_intrinsic_(is_intrinsic) {
1992 SetInputAt(0, value); 1996 SetInputAt(0, value);
1993 } 1997 }
1994 1998
1995 DECLARE_INSTRUCTION(Return) 1999 DECLARE_INSTRUCTION(Return)
1996 2000
1997 virtual intptr_t ArgumentCount() const { return 0; } 2001 virtual intptr_t ArgumentCount() const { return 0; }
1998 2002
1999 virtual intptr_t token_pos() const { return token_pos_; } 2003 virtual intptr_t token_pos() const { return token_pos_; }
2000 Value* value() const { return inputs_[0]; } 2004 Value* value() const { return inputs_[0]; }
2001 2005
2002 virtual bool CanBecomeDeoptimizationTarget() const { 2006 virtual bool CanBecomeDeoptimizationTarget() const {
2003 // Return instruction might turn into a Goto instruction after inlining. 2007 // Return instruction might turn into a Goto instruction after inlining.
2004 // Every Goto must have an environment. 2008 // Every Goto must have an environment.
2005 return true; 2009 return true;
2006 } 2010 }
2007 2011
2008 virtual bool CanDeoptimize() const { return false; } 2012 virtual bool CanDeoptimize() const { return false; }
2009 2013
2010 virtual EffectSet Effects() const { return EffectSet::None(); } 2014 virtual EffectSet Effects() const { return EffectSet::None(); }
2011 2015
2012 virtual bool MayThrow() const { return false; } 2016 virtual bool MayThrow() const { return false; }
2013 2017
2014 private: 2018 private:
2015 const intptr_t token_pos_; 2019 const intptr_t token_pos_;
2020 bool is_intrinsic_;
2016 2021
2017 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2022 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2018 }; 2023 };
2019 2024
2020 2025
2021 class ThrowInstr : public TemplateInstruction<0> { 2026 class ThrowInstr : public TemplateInstruction<0> {
2022 public: 2027 public:
2023 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { } 2028 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { }
2024 2029
2025 DECLARE_INSTRUCTION(Throw) 2030 DECLARE_INSTRUCTION(Throw)
(...skipping 5642 matching lines...) Expand 10 before | Expand all | Expand 10 after
7668 const intptr_t token_pos_; 7673 const intptr_t token_pos_;
7669 7674
7670 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); 7675 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
7671 }; 7676 };
7672 7677
7673 7678
7674 class CheckSmiInstr : public TemplateInstruction<1> { 7679 class CheckSmiInstr : public TemplateInstruction<1> {
7675 public: 7680 public:
7676 CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos) 7681 CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos)
7677 : token_pos_(token_pos) { 7682 : token_pos_(token_pos) {
7678 ASSERT(original_deopt_id != Isolate::kNoDeoptId);
7679 SetInputAt(0, value); 7683 SetInputAt(0, value);
7680 deopt_id_ = original_deopt_id; 7684 deopt_id_ = original_deopt_id;
7681 } 7685 }
7682 7686
7683 Value* value() const { return inputs_[0]; } 7687 Value* value() const { return inputs_[0]; }
7684 virtual intptr_t token_pos() const { return token_pos_; } 7688 virtual intptr_t token_pos() const { return token_pos_; }
7685 7689
7686 DECLARE_INSTRUCTION(CheckSmi) 7690 DECLARE_INSTRUCTION(CheckSmi)
7687 7691
7688 virtual intptr_t ArgumentCount() const { return 0; } 7692 virtual intptr_t ArgumentCount() const { return 0; }
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
8399 Isolate* isolate, bool opt) const { \ 8403 Isolate* isolate, bool opt) const { \
8400 UNIMPLEMENTED(); \ 8404 UNIMPLEMENTED(); \
8401 return NULL; \ 8405 return NULL; \
8402 } \ 8406 } \
8403 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8407 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8404 8408
8405 8409
8406 } // namespace dart 8410 } // namespace dart
8407 8411
8408 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8412 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698