OLD | NEW |
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" |
11 #include "vm/handles_impl.h" | 11 #include "vm/handles_impl.h" |
12 #include "vm/locations.h" | 12 #include "vm/locations.h" |
13 #include "vm/method_recognizer.h" | 13 #include "vm/method_recognizer.h" |
14 #include "vm/object.h" | 14 #include "vm/object.h" |
15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
16 #include "vm/token_position.h" | 16 #include "vm/token_position.h" |
17 | 17 |
18 namespace dart { | 18 namespace dart { |
19 | 19 |
20 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | |
21 | |
22 class BitVector; | 20 class BitVector; |
23 class BlockEntryInstr; | 21 class BlockEntryInstr; |
24 class BoxIntegerInstr; | 22 class BoxIntegerInstr; |
25 class BufferFormatter; | 23 class BufferFormatter; |
26 class CatchBlockEntryInstr; | 24 class CatchBlockEntryInstr; |
27 class ComparisonInstr; | 25 class ComparisonInstr; |
28 class Definition; | 26 class Definition; |
29 class Environment; | 27 class Environment; |
30 class FlowGraph; | 28 class FlowGraph; |
31 class FlowGraphBuilder; | 29 class FlowGraphBuilder; |
(...skipping 6790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6822 | 6820 |
6823 | 6821 |
6824 class UnaryMintOpInstr : public UnaryIntegerOpInstr { | 6822 class UnaryMintOpInstr : public UnaryIntegerOpInstr { |
6825 public: | 6823 public: |
6826 UnaryMintOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 6824 UnaryMintOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
6827 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { | 6825 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { |
6828 ASSERT(op_kind == Token::kBIT_NOT); | 6826 ASSERT(op_kind == Token::kBIT_NOT); |
6829 } | 6827 } |
6830 | 6828 |
6831 virtual bool CanDeoptimize() const { | 6829 virtual bool CanDeoptimize() const { |
6832 return FLAG_throw_on_javascript_int_overflow; | 6830 return false; |
6833 } | 6831 } |
6834 | 6832 |
6835 virtual CompileType ComputeType() const; | 6833 virtual CompileType ComputeType() const; |
6836 | 6834 |
6837 virtual Representation representation() const { | 6835 virtual Representation representation() const { |
6838 return kUnboxedMint; | 6836 return kUnboxedMint; |
6839 } | 6837 } |
6840 | 6838 |
6841 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 6839 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
6842 ASSERT(idx == 0); | 6840 ASSERT(idx == 0); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7082 class BinaryMintOpInstr : public BinaryIntegerOpInstr { | 7080 class BinaryMintOpInstr : public BinaryIntegerOpInstr { |
7083 public: | 7081 public: |
7084 BinaryMintOpInstr(Token::Kind op_kind, | 7082 BinaryMintOpInstr(Token::Kind op_kind, |
7085 Value* left, | 7083 Value* left, |
7086 Value* right, | 7084 Value* right, |
7087 intptr_t deopt_id) | 7085 intptr_t deopt_id) |
7088 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 7086 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
7089 } | 7087 } |
7090 | 7088 |
7091 virtual bool CanDeoptimize() const { | 7089 virtual bool CanDeoptimize() const { |
7092 return FLAG_throw_on_javascript_int_overflow | 7090 return (can_overflow() && ((op_kind() == Token::kADD) || |
7093 || (can_overflow() && ((op_kind() == Token::kADD) || | |
7094 (op_kind() == Token::kSUB))) | 7091 (op_kind() == Token::kSUB))) |
7095 || (op_kind() == Token::kMUL); // Deopt if inputs are not int32. | 7092 || (op_kind() == Token::kMUL); // Deopt if inputs are not int32. |
7096 } | 7093 } |
7097 | 7094 |
7098 virtual Representation representation() const { | 7095 virtual Representation representation() const { |
7099 return kUnboxedMint; | 7096 return kUnboxedMint; |
7100 } | 7097 } |
7101 | 7098 |
7102 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7099 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
7103 ASSERT((idx == 0) || (idx == 1)); | 7100 ASSERT((idx == 0) || (idx == 1)); |
(...skipping 14 matching lines...) Expand all Loading... |
7118 public: | 7115 public: |
7119 ShiftMintOpInstr(Token::Kind op_kind, | 7116 ShiftMintOpInstr(Token::Kind op_kind, |
7120 Value* left, | 7117 Value* left, |
7121 Value* right, | 7118 Value* right, |
7122 intptr_t deopt_id) | 7119 intptr_t deopt_id) |
7123 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 7120 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
7124 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); | 7121 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); |
7125 } | 7122 } |
7126 | 7123 |
7127 virtual bool CanDeoptimize() const { | 7124 virtual bool CanDeoptimize() const { |
7128 return FLAG_throw_on_javascript_int_overflow | 7125 return has_shift_count_check() |
7129 || has_shift_count_check() | |
7130 || (can_overflow() && (op_kind() == Token::kSHL)); | 7126 || (can_overflow() && (op_kind() == Token::kSHL)); |
7131 } | 7127 } |
7132 | 7128 |
7133 virtual Representation representation() const { | 7129 virtual Representation representation() const { |
7134 return kUnboxedMint; | 7130 return kUnboxedMint; |
7135 } | 7131 } |
7136 | 7132 |
7137 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7133 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
7138 ASSERT((idx == 0) || (idx == 1)); | 7134 ASSERT((idx == 0) || (idx == 1)); |
7139 return (idx == 0) ? kUnboxedMint : kTagged; | 7135 return (idx == 0) ? kUnboxedMint : kTagged; |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8211 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8207 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8212 UNIMPLEMENTED(); \ | 8208 UNIMPLEMENTED(); \ |
8213 return NULL; \ | 8209 return NULL; \ |
8214 } \ | 8210 } \ |
8215 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8211 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8216 | 8212 |
8217 | 8213 |
8218 } // namespace dart | 8214 } // namespace dart |
8219 | 8215 |
8220 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8216 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |