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

Side by Side Diff: vm/code_generator_test.cc

Issue 11613009: Changed the API in DartEntry for invoking dart code from C++ to make it more compatible with the re… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 540
541 const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle(); 541 const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle();
542 ArgumentListNode* no_arguments = new ArgumentListNode(kPos); 542 ArgumentListNode* no_arguments = new ArgumentListNode(kPos);
543 const LocalVariable* allocated = test->CreateTempConstVariable("alloc"); 543 const LocalVariable* allocated = test->CreateTempConstVariable("alloc");
544 test->node_sequence()->Add(new ReturnNode(kPos, new ConstructorCallNode( 544 test->node_sequence()->Add(new ReturnNode(kPos, new ConstructorCallNode(
545 kPos, no_type_arguments, constructor, no_arguments, allocated))); 545 kPos, no_type_arguments, constructor, no_arguments, allocated)));
546 } 546 }
547 547
548 548
549 CODEGEN_TEST_RAW_RUN(AllocateNewObjectCodegen, function) { 549 CODEGEN_TEST_RAW_RUN(AllocateNewObjectCodegen, function) {
550 GrowableArray<const Object*> arguments; 550 const Array& args = Array::Handle(Object::empty_array());
551 const Array& kNoArgumentNames = Array::Handle(); 551 const Object& result = Object::Handle(DartEntry::InvokeStatic(function,
552 Object& result = Object::Handle(); 552 args));
553 result = DartEntry::InvokeStatic(function, arguments, kNoArgumentNames);
554 EXPECT(!result.IsError()); 553 EXPECT(!result.IsError());
555 const GrowableObjectArray& libs = GrowableObjectArray::Handle( 554 const GrowableObjectArray& libs = GrowableObjectArray::Handle(
556 Isolate::Current()->object_store()->libraries()); 555 Isolate::Current()->object_store()->libraries());
557 ASSERT(!libs.IsNull()); 556 ASSERT(!libs.IsNull());
558 // App lib is the last one that was loaded. 557 // App lib is the last one that was loaded.
559 intptr_t num_libs = libs.Length(); 558 intptr_t num_libs = libs.Length();
560 Library& app_lib = Library::Handle(); 559 Library& app_lib = Library::Handle();
561 app_lib ^= libs.At(num_libs - 1); 560 app_lib ^= libs.At(num_libs - 1);
562 ASSERT(!app_lib.IsNull()); 561 ASSERT(!app_lib.IsNull());
563 const Class& cls = Class::Handle( 562 const Class& cls = Class::Handle(
564 app_lib.LookupClass(String::Handle(Symbols::New("A")))); 563 app_lib.LookupClass(String::Handle(Symbols::New("A"))));
565 EXPECT_EQ(cls.raw(), result.clazz()); 564 EXPECT_EQ(cls.raw(), result.clazz());
566 } 565 }
567 566
568 } // namespace dart 567 } // namespace dart
569 568
570 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) 569 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64)
OLDNEW
« no previous file with comments | « vm/code_generator.cc ('k') | vm/compiler.cc » ('j') | vm/dart_entry.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698