| OLD | NEW | 
|---|
| 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 #include "platform/assert.h" | 5 #include "platform/assert.h" | 
| 6 #include "vm/globals.h" | 6 #include "vm/globals.h" | 
| 7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 
| 8 | 8 | 
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" | 
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" | 
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 153       new BinaryOpNode(kPos, Token::kMUL, sub_node, c);  // 2 * 3 -> 6. | 153       new BinaryOpNode(kPos, Token::kMUL, sub_node, c);  // 2 * 3 -> 6. | 
| 154   BinaryOpNode* div_node = | 154   BinaryOpNode* div_node = | 
| 155       new BinaryOpNode(kPos, Token::kTRUNCDIV, mul_node, b);  // 6 ~/ 2 -> 3. | 155       new BinaryOpNode(kPos, Token::kTRUNCDIV, mul_node, b);  // 6 ~/ 2 -> 3. | 
| 156   node_seq->Add(new ReturnNode(kPos, div_node)); | 156   node_seq->Add(new ReturnNode(kPos, div_node)); | 
| 157 } | 157 } | 
| 158 CODEGEN_TEST_RUN(SmiBinaryOpCodegen, Smi::New(3)) | 158 CODEGEN_TEST_RUN(SmiBinaryOpCodegen, Smi::New(3)) | 
| 159 | 159 | 
| 160 | 160 | 
| 161 CODEGEN_TEST_GENERATE(BoolNotCodegen, test) { | 161 CODEGEN_TEST_GENERATE(BoolNotCodegen, test) { | 
| 162   SequenceNode* node_seq = test->node_sequence(); | 162   SequenceNode* node_seq = test->node_sequence(); | 
| 163   const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 163   LiteralNode* b = new LiteralNode(kPos, Bool::False()); | 
| 164   LiteralNode* b = new LiteralNode(kPos, bool_false); |  | 
| 165   UnaryOpNode* not_node = new UnaryOpNode(kPos, Token::kNOT, b); | 164   UnaryOpNode* not_node = new UnaryOpNode(kPos, Token::kNOT, b); | 
| 166   node_seq->Add(new ReturnNode(kPos, not_node)); | 165   node_seq->Add(new ReturnNode(kPos, not_node)); | 
| 167 } | 166 } | 
| 168 CODEGEN_TEST_RUN(BoolNotCodegen, Bool::True()) | 167 CODEGEN_TEST_RUN(BoolNotCodegen, Bool::True().raw()) | 
| 169 | 168 | 
| 170 | 169 | 
| 171 CODEGEN_TEST_GENERATE(BoolAndCodegen, test) { | 170 CODEGEN_TEST_GENERATE(BoolAndCodegen, test) { | 
| 172   SequenceNode* node_seq = test->node_sequence(); | 171   SequenceNode* node_seq = test->node_sequence(); | 
| 173   const Bool& bool_true = Bool::ZoneHandle(Bool::True()); | 172   LiteralNode* a = new LiteralNode(kPos, Bool::True()); | 
| 174   const Bool& bool_false = Bool::ZoneHandle(Bool::False()); | 173   LiteralNode* b = new LiteralNode(kPos, Bool::False()); | 
| 175   LiteralNode* a = new LiteralNode(kPos, bool_true); |  | 
| 176   LiteralNode* b = new LiteralNode(kPos, bool_false); |  | 
| 177   BinaryOpNode* and_node = new BinaryOpNode(kPos, Token::kAND, a, b); | 174   BinaryOpNode* and_node = new BinaryOpNode(kPos, Token::kAND, a, b); | 
| 178   node_seq->Add(new ReturnNode(kPos, and_node)); | 175   node_seq->Add(new ReturnNode(kPos, and_node)); | 
| 179 } | 176 } | 
| 180 CODEGEN_TEST_RUN(BoolAndCodegen, Bool::False()) | 177 CODEGEN_TEST_RUN(BoolAndCodegen, Bool::False().raw()) | 
| 181 | 178 | 
| 182 | 179 | 
| 183 CODEGEN_TEST_GENERATE(BinaryOpCodegen, test) { | 180 CODEGEN_TEST_GENERATE(BinaryOpCodegen, test) { | 
| 184   SequenceNode* node_seq = test->node_sequence(); | 181   SequenceNode* node_seq = test->node_sequence(); | 
| 185   LiteralNode* a = | 182   LiteralNode* a = | 
| 186       new LiteralNode(kPos, Double::ZoneHandle(Double::New(12, Heap::kOld))); | 183       new LiteralNode(kPos, Double::ZoneHandle(Double::New(12, Heap::kOld))); | 
| 187   LiteralNode* b = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(2))); | 184   LiteralNode* b = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(2))); | 
| 188   LiteralNode* c = | 185   LiteralNode* c = | 
| 189       new LiteralNode(kPos, Double::ZoneHandle(Double::New(0.5, Heap::kOld))); | 186       new LiteralNode(kPos, Double::ZoneHandle(Double::New(0.5, Heap::kOld))); | 
| 190   BinaryOpNode* sub_node = new BinaryOpNode(kPos, Token::kSUB, a, b); | 187   BinaryOpNode* sub_node = new BinaryOpNode(kPos, Token::kSUB, a, b); | 
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 559   app_lib ^= libs.At(num_libs - 1); | 556   app_lib ^= libs.At(num_libs - 1); | 
| 560   ASSERT(!app_lib.IsNull()); | 557   ASSERT(!app_lib.IsNull()); | 
| 561   const Class& cls = Class::Handle( | 558   const Class& cls = Class::Handle( | 
| 562       app_lib.LookupClass(String::Handle(Symbols::New("A")))); | 559       app_lib.LookupClass(String::Handle(Symbols::New("A")))); | 
| 563   EXPECT_EQ(cls.raw(), result.clazz()); | 560   EXPECT_EQ(cls.raw(), result.clazz()); | 
| 564 } | 561 } | 
| 565 | 562 | 
| 566 }  // namespace dart | 563 }  // namespace dart | 
| 567 | 564 | 
| 568 #endif  // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 565 #endif  // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 
| OLD | NEW | 
|---|