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

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

Issue 22839003: Polymorphic inlining for some recognized methods in the optimizing compiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 #include "vm/ast.h" 7 #include "vm/ast.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 const String& native_name = 217 const String& native_name =
218 String::ZoneHandle(Symbols::New("TestSmiSub")); 218 String::ZoneHandle(Symbols::New("TestSmiSub"));
219 NativeFunction native_function = 219 NativeFunction native_function =
220 reinterpret_cast<NativeFunction>(TestSmiSub); 220 reinterpret_cast<NativeFunction>(TestSmiSub);
221 node_seq->Add( 221 node_seq->Add(
222 new ReturnNode(kPos, 222 new ReturnNode(kPos,
223 new NativeBodyNode(kPos, 223 new NativeBodyNode(kPos,
224 function, 224 function,
225 native_name, 225 native_name,
226 native_function, 226 native_function,
227 local_scope,
227 false /* not bootstrap native */))); 228 false /* not bootstrap native */)));
228 } 229 }
229 230
230 231
231 // Tested Dart code: 232 // Tested Dart code:
232 // return dec(5); 233 // return dec(5);
233 CODEGEN_TEST2_GENERATE(StaticDecCallCodegen, function, test) { 234 CODEGEN_TEST2_GENERATE(StaticDecCallCodegen, function, test) {
234 SequenceNode* node_seq = test->node_sequence(); 235 SequenceNode* node_seq = test->node_sequence();
235 ArgumentListNode* arguments = new ArgumentListNode(kPos); 236 ArgumentListNode* arguments = new ArgumentListNode(kPos);
236 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(5)))); 237 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(5))));
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 const String& native_name = 400 const String& native_name =
400 String::ZoneHandle(Symbols::New("TestSmiSum")); 401 String::ZoneHandle(Symbols::New("TestSmiSum"));
401 NativeFunction native_function = 402 NativeFunction native_function =
402 reinterpret_cast<NativeFunction>(TestSmiSum); 403 reinterpret_cast<NativeFunction>(TestSmiSum);
403 node_seq->Add( 404 node_seq->Add(
404 new ReturnNode(kPos, 405 new ReturnNode(kPos,
405 new NativeBodyNode(kPos, 406 new NativeBodyNode(kPos,
406 function, 407 function,
407 native_name, 408 native_name,
408 native_function, 409 native_function,
410 local_scope,
409 false /* Not bootstrap native */))); 411 false /* Not bootstrap native */)));
410 } 412 }
411 413
412 414
413 // Tested Dart code, calling function sum declared above: 415 // Tested Dart code, calling function sum declared above:
414 // return sum(1, 3); 416 // return sum(1, 3);
415 // Optional arguments are not passed and hence are set to their default values. 417 // Optional arguments are not passed and hence are set to their default values.
416 CODEGEN_TEST2_GENERATE(StaticSumCallNoOptCodegen, function, test) { 418 CODEGEN_TEST2_GENERATE(StaticSumCallNoOptCodegen, function, test) {
417 SequenceNode* node_seq = test->node_sequence(); 419 SequenceNode* node_seq = test->node_sequence();
418 ArgumentListNode* arguments = new ArgumentListNode(kPos); 420 ArgumentListNode* arguments = new ArgumentListNode(kPos);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 const String& native_name = 490 const String& native_name =
489 String::ZoneHandle(Symbols::New("TestNonNullSmiSum")); 491 String::ZoneHandle(Symbols::New("TestNonNullSmiSum"));
490 NativeFunction native_function = 492 NativeFunction native_function =
491 reinterpret_cast<NativeFunction>(TestNonNullSmiSum); 493 reinterpret_cast<NativeFunction>(TestNonNullSmiSum);
492 node_seq->Add( 494 node_seq->Add(
493 new ReturnNode(kPos, 495 new ReturnNode(kPos,
494 new NativeBodyNode(kPos, 496 new NativeBodyNode(kPos,
495 function, 497 function,
496 native_name, 498 native_name,
497 native_function, 499 native_function,
500 local_scope,
498 false /* Not bootstrap native */))); 501 false /* Not bootstrap native */)));
499 } 502 }
500 503
501 504
502 // Tested Dart code, calling function sum declared above: 505 // Tested Dart code, calling function sum declared above:
503 // return sum(1, null, 3); 506 // return sum(1, null, 3);
504 CODEGEN_TEST2_GENERATE(StaticNonNullSumCallCodegen, function, test) { 507 CODEGEN_TEST2_GENERATE(StaticNonNullSumCallCodegen, function, test) {
505 SequenceNode* node_seq = test->node_sequence(); 508 SequenceNode* node_seq = test->node_sequence();
506 ArgumentListNode* arguments = new ArgumentListNode(kPos); 509 ArgumentListNode* arguments = new ArgumentListNode(kPos);
507 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1)))); 510 arguments->Add(new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1))));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 app_lib ^= libs.At(num_libs - 1); 562 app_lib ^= libs.At(num_libs - 1);
560 ASSERT(!app_lib.IsNull()); 563 ASSERT(!app_lib.IsNull());
561 String& ambiguity_error_msg = String::Handle(); 564 String& ambiguity_error_msg = String::Handle();
562 const Class& cls = Class::Handle( 565 const Class& cls = Class::Handle(
563 app_lib.LookupClass(String::Handle(Symbols::New("A")), 566 app_lib.LookupClass(String::Handle(Symbols::New("A")),
564 &ambiguity_error_msg)); 567 &ambiguity_error_msg));
565 EXPECT_EQ(cls.raw(), result.clazz()); // No ambiguity error expected. 568 EXPECT_EQ(cls.raw(), result.clazz()); // No ambiguity error expected.
566 } 569 }
567 570
568 } // namespace dart 571 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/compiler.cc » ('j') | runtime/vm/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698