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

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

Issue 10533053: Implement inlined version of binary arithmetic operations for doubles. (Closed) Base URL: https://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
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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 private: 1287 private:
1288 const LocalVariable& exception_var_; 1288 const LocalVariable& exception_var_;
1289 const LocalVariable& stacktrace_var_; 1289 const LocalVariable& stacktrace_var_;
1290 1290
1291 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp); 1291 DISALLOW_COPY_AND_ASSIGN(CatchEntryComp);
1292 }; 1292 };
1293 1293
1294 1294
1295 class BinaryOpComp : public TemplateComputation<2> { 1295 class BinaryOpComp : public TemplateComputation<2> {
1296 public: 1296 public:
1297 enum OperandsType {
1298 kSmiOperands,
1299 kDoubleOperands
1300 };
1301
1297 BinaryOpComp(Token::Kind op_kind, 1302 BinaryOpComp(Token::Kind op_kind,
1303 OperandsType operands_type,
1298 InstanceCallComp* instance_call, 1304 InstanceCallComp* instance_call,
1299 Value* left, 1305 Value* left,
1300 Value* right) 1306 Value* right)
1301 : op_kind_(op_kind), instance_call_(instance_call) { 1307 : op_kind_(op_kind),
1308 operands_type_(operands_type),
1309 instance_call_(instance_call) {
1302 ASSERT(left != NULL); 1310 ASSERT(left != NULL);
1303 ASSERT(right != NULL); 1311 ASSERT(right != NULL);
1304 inputs_[0] = left; 1312 inputs_[0] = left;
1305 inputs_[1] = right; 1313 inputs_[1] = right;
1306 } 1314 }
1307 1315
1308 Value* left() const { return inputs_[0]; } 1316 Value* left() const { return inputs_[0]; }
1309 Value* right() const { return inputs_[1]; } 1317 Value* right() const { return inputs_[1]; }
1310 1318
1311 Token::Kind op_kind() const { return op_kind_; } 1319 Token::Kind op_kind() const { return op_kind_; }
1312 1320
1321 OperandsType operands_type() const { return operands_type_; }
1322
1313 InstanceCallComp* instance_call() const { return instance_call_; } 1323 InstanceCallComp* instance_call() const { return instance_call_; }
1314 1324
1315 virtual void PrintOperandsTo(BufferFormatter* f) const; 1325 virtual void PrintOperandsTo(BufferFormatter* f) const;
1316 1326
1317 DECLARE_COMPUTATION(BinaryOp) 1327 DECLARE_COMPUTATION(BinaryOp)
1318 1328
1319 private: 1329 private:
1320 const Token::Kind op_kind_; 1330 const Token::Kind op_kind_;
1331 const OperandsType operands_type_;
srdjan 2012/06/08 05:18:22 This works for now, but in Dart it is quite freque
Vyacheslav Egorov (Google) 2012/06/08 11:11:13 We will have to decide how we want to implement th
srdjan 2012/06/08 16:05:55 Sounds good.
1321 InstanceCallComp* instance_call_; 1332 InstanceCallComp* instance_call_;
1322 1333
1323 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp); 1334 DISALLOW_COPY_AND_ASSIGN(BinaryOpComp);
1324 }; 1335 };
1325 1336
1326 1337
1327 // Handles both Smi operations: BIT_OR and NEGATE. 1338 // Handles both Smi operations: BIT_OR and NEGATE.
1328 class UnarySmiOpComp : public TemplateComputation<1> { 1339 class UnarySmiOpComp : public TemplateComputation<1> {
1329 public: 1340 public:
1330 UnarySmiOpComp(Token::Kind op_kind, 1341 UnarySmiOpComp(Token::Kind op_kind,
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 const GrowableArray<BlockEntryInstr*>& block_order_; 2036 const GrowableArray<BlockEntryInstr*>& block_order_;
2026 2037
2027 private: 2038 private:
2028 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 2039 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
2029 }; 2040 };
2030 2041
2031 2042
2032 } // namespace dart 2043 } // namespace dart
2033 2044
2034 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 2045 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698