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

Side by Side Diff: runtime/vm/code_generator_test.cc

Issue 11199002: Remove built-in identifier 'negate' from VM (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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 #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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(5)))); 241 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(5))));
242 node_seq->Add(new ReturnNode(kPos, 242 node_seq->Add(new ReturnNode(kPos,
243 new StaticCallNode(kPos, function, arguments))); 243 new StaticCallNode(kPos, function, arguments)));
244 } 244 }
245 CODEGEN_TEST2_RUN(StaticDecCallCodegen, NativeDecCodegen, Smi::New(4)) 245 CODEGEN_TEST2_RUN(StaticDecCallCodegen, NativeDecCodegen, Smi::New(4))
246 246
247 247
248 CODEGEN_TEST_GENERATE(SmiUnaryOpCodegen, test) { 248 CODEGEN_TEST_GENERATE(SmiUnaryOpCodegen, test) {
249 SequenceNode* node_seq = test->node_sequence(); 249 SequenceNode* node_seq = test->node_sequence();
250 LiteralNode* a = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(12))); 250 LiteralNode* a = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(12)));
251 UnaryOpNode* neg_node = new UnaryOpNode(kPos, Token::kSUB, a); 251 UnaryOpNode* neg_node = new UnaryOpNode(kPos, Token::kNEGATE, a);
252 node_seq->Add(new ReturnNode(kPos, neg_node)); 252 node_seq->Add(new ReturnNode(kPos, neg_node));
253 } 253 }
254 CODEGEN_TEST_RUN(SmiUnaryOpCodegen, Smi::New(-12)) 254 CODEGEN_TEST_RUN(SmiUnaryOpCodegen, Smi::New(-12))
255 255
256 256
257 CODEGEN_TEST_GENERATE(DoubleUnaryOpCodegen, test) { 257 CODEGEN_TEST_GENERATE(DoubleUnaryOpCodegen, test) {
258 SequenceNode* node_seq = test->node_sequence(); 258 SequenceNode* node_seq = test->node_sequence();
259 LiteralNode* a = 259 LiteralNode* a =
260 new LiteralNode(kPos, Double::ZoneHandle(Double::New(12.0, Heap::kOld))); 260 new LiteralNode(kPos, Double::ZoneHandle(Double::New(12.0, Heap::kOld)));
261 UnaryOpNode* neg_node = new UnaryOpNode(kPos, Token::kSUB, a); 261 UnaryOpNode* neg_node = new UnaryOpNode(kPos, Token::kNEGATE, a);
262 node_seq->Add(new ReturnNode(kPos, neg_node)); 262 node_seq->Add(new ReturnNode(kPos, neg_node));
263 } 263 }
264 CODEGEN_TEST_RUN(DoubleUnaryOpCodegen, Double::New(-12.0)) 264 CODEGEN_TEST_RUN(DoubleUnaryOpCodegen, Double::New(-12.0))
265 265
266 266
267 static Library& MakeTestLibrary(const char* url) { 267 static Library& MakeTestLibrary(const char* url) {
268 const String& lib_url = String::ZoneHandle(Symbols::New(url)); 268 const String& lib_url = String::ZoneHandle(Symbols::New(url));
269 Library& lib = Library::ZoneHandle(Library::New(lib_url)); 269 Library& lib = Library::ZoneHandle(Library::New(lib_url));
270 lib.Register(); 270 lib.Register();
271 Library& core_lib = Library::Handle(Library::CoreLibrary()); 271 Library& core_lib = Library::Handle(Library::CoreLibrary());
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 app_lib ^= libs.At(num_libs - 1); 516 app_lib ^= libs.At(num_libs - 1);
517 ASSERT(!app_lib.IsNull()); 517 ASSERT(!app_lib.IsNull());
518 const Class& cls = Class::Handle( 518 const Class& cls = Class::Handle(
519 app_lib.LookupClass(String::Handle(Symbols::New("A")))); 519 app_lib.LookupClass(String::Handle(Symbols::New("A"))));
520 EXPECT_EQ(cls.raw(), result.clazz()); 520 EXPECT_EQ(cls.raw(), result.clazz());
521 } 521 }
522 522
523 } // namespace dart 523 } // namespace dart
524 524
525 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) 525 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64)
OLDNEW
« no previous file with comments | « runtime/vm/ast_test.cc ('k') | runtime/vm/flow_graph_builder.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698