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

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

Issue 10440099: Adding unary op optimizations. missing assembly operations/ (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
« 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 M(LoadVMField, LoadVMFieldComp) \ 58 M(LoadVMField, LoadVMFieldComp) \
59 M(StoreVMField, StoreVMFieldComp) \ 59 M(StoreVMField, StoreVMFieldComp) \
60 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \ 60 M(InstantiateTypeArguments, InstantiateTypeArgumentsComp) \
61 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \ 61 M(ExtractConstructorTypeArguments, ExtractConstructorTypeArgumentsComp) \
62 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \ 62 M(ExtractConstructorInstantiator, ExtractConstructorInstantiatorComp) \
63 M(AllocateContext, AllocateContextComp) \ 63 M(AllocateContext, AllocateContextComp) \
64 M(ChainContext, ChainContextComp) \ 64 M(ChainContext, ChainContextComp) \
65 M(CloneContext, CloneContextComp) \ 65 M(CloneContext, CloneContextComp) \
66 M(CatchEntry, CatchEntryComp) \ 66 M(CatchEntry, CatchEntryComp) \
67 M(BinaryOp, BinaryOpComp) \ 67 M(BinaryOp, BinaryOpComp) \
68 M(UnarySmiOp, UnarySmiOpComp) \
69 M(NumberNegate, NumberNegateComp) \
68 70
69 71
70 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 72 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
71 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 73 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
72 #undef FORWARD_DECLARATION 74 #undef FORWARD_DECLARATION
73 75
74 // Forward declarations. 76 // Forward declarations.
75 class BufferFormatter; 77 class BufferFormatter;
76 class Instruction; 78 class Instruction;
77 class Value; 79 class Value;
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 }; 1277 };
1276 1278
1277 1279
1278 class BinaryOpComp : public TemplateComputation<2> { 1280 class BinaryOpComp : public TemplateComputation<2> {
1279 public: 1281 public:
1280 BinaryOpComp(Token::Kind op_kind, 1282 BinaryOpComp(Token::Kind op_kind,
1281 InstanceCallComp* instance_call, 1283 InstanceCallComp* instance_call,
1282 Value* left, 1284 Value* left,
1283 Value* right) 1285 Value* right)
1284 : op_kind_(op_kind), instance_call_(instance_call) { 1286 : op_kind_(op_kind), instance_call_(instance_call) {
1287 ASSERT(left != NULL);
1288 ASSERT(right != NULL);
1285 inputs_[0] = left; 1289 inputs_[0] = left;
1286 inputs_[1] = right; 1290 inputs_[1] = right;
1287 } 1291 }
1288 1292
1289 Value* left() const { return inputs_[0]; } 1293 Value* left() const { return inputs_[0]; }
1290 Value* right() const { return inputs_[1]; } 1294 Value* right() const { return inputs_[1]; }
1291 1295
1292 Token::Kind op_kind() const { return op_kind_; } 1296 Token::Kind op_kind() const { return op_kind_; }
1293 1297
1294 InstanceCallComp* instance_call() const { return instance_call_; } 1298 InstanceCallComp* instance_call() const { return instance_call_; }
1295 1299
1296 virtual void PrintOperandsTo(BufferFormatter* f) const; 1300 virtual void PrintOperandsTo(BufferFormatter* f) const;
1297 1301
1298 DECLARE_COMPUTATION(BinaryOp) 1302 DECLARE_COMPUTATION(BinaryOp)
1299 1303
1300 private: 1304 private:
1301 const Token::Kind op_kind_; 1305 const Token::Kind op_kind_;
1302 InstanceCallComp* instance_call_; 1306 InstanceCallComp* instance_call_;
1303 1307
1304 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); 1308 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp);
1305 }; 1309 };
1306 1310
1311
1312 // Handles both Smi operations: BIT_OR and NEGATE.
1313 class UnarySmiOpComp : public TemplateComputation<1> {
1314 public:
1315 UnarySmiOpComp(Token::Kind op_kind,
1316 InstanceCallComp* instance_call,
1317 Value* value)
1318 : op_kind_(op_kind), instance_call_(instance_call) {
1319 ASSERT(value != NULL);
1320 inputs_[0] = value;
1321 }
1322
1323 Value* value() const { return inputs_[0]; }
1324 Token::Kind op_kind() const { return op_kind_; }
1325
1326 InstanceCallComp* instance_call() const { return instance_call_; }
1327
1328 virtual void PrintOperandsTo(BufferFormatter* f) const;
1329
1330 DECLARE_COMPUTATION(UnarySmiOp)
1331
1332 private:
1333 const Token::Kind op_kind_;
1334 InstanceCallComp* instance_call_;
1335
1336 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpComp);
1337 };
1338
1339
1340 // Handles non-Smi NEGATE operations
1341 class NumberNegateComp : public TemplateComputation<1> {
1342 public:
1343 NumberNegateComp(InstanceCallComp* instance_call,
1344 Value* value) : instance_call_(instance_call) {
1345 ASSERT(value != NULL);
1346 inputs_[0] = value;
1347 }
1348
1349 Value* value() const { return inputs_[0]; }
1350
1351 InstanceCallComp* instance_call() const { return instance_call_; }
1352
1353 DECLARE_COMPUTATION(NumberNegate)
1354
1355 private:
1356 InstanceCallComp* instance_call_;
1357
1358 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp);
1359 };
1360
1307 #undef DECLARE_COMPUTATION 1361 #undef DECLARE_COMPUTATION
1308 1362
1309 1363
1310 // Instructions. 1364 // Instructions.
1311 // 1365 //
1312 // <Instruction> ::= JoinEntry <Instruction> 1366 // <Instruction> ::= JoinEntry <Instruction>
1313 // | TargetEntry <Instruction> 1367 // | TargetEntry <Instruction>
1314 // | Do <Computation> <Instruction> 1368 // | Do <Computation> <Instruction>
1315 // | Return <Value> 1369 // | Return <Value>
1316 // | Branch <Value> <Instruction> <Instruction> 1370 // | Branch <Value> <Instruction> <Instruction>
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 const GrowableArray<BlockEntryInstr*>& block_order_; 1982 const GrowableArray<BlockEntryInstr*>& block_order_;
1929 1983
1930 private: 1984 private:
1931 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1985 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1932 }; 1986 };
1933 1987
1934 1988
1935 } // namespace dart 1989 } // namespace dart
1936 1990
1937 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1991 #endif // 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