| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle(); | 538 const TypeArguments& no_type_arguments = TypeArguments::ZoneHandle(); |
| 539 ArgumentListNode* no_arguments = new ArgumentListNode(kPos); | 539 ArgumentListNode* no_arguments = new ArgumentListNode(kPos); |
| 540 const LocalVariable* allocated = test->CreateTempConstVariable("alloc"); | 540 const LocalVariable* allocated = test->CreateTempConstVariable("alloc"); |
| 541 test->node_sequence()->Add(new ReturnNode(kPos, new ConstructorCallNode( | 541 test->node_sequence()->Add(new ReturnNode(kPos, new ConstructorCallNode( |
| 542 kPos, no_type_arguments, constructor, no_arguments, allocated))); | 542 kPos, no_type_arguments, constructor, no_arguments, allocated))); |
| 543 } | 543 } |
| 544 | 544 |
| 545 | 545 |
| 546 CODEGEN_TEST_RAW_RUN(AllocateNewObjectCodegen, function) { | 546 CODEGEN_TEST_RAW_RUN(AllocateNewObjectCodegen, function) { |
| 547 const Object& result = Object::Handle( | 547 const Object& result = Object::Handle( |
| 548 DartEntry::InvokeStatic(function, Object::empty_array())); | 548 DartEntry::InvokeFunction(function, Object::empty_array())); |
| 549 EXPECT(!result.IsError()); | 549 EXPECT(!result.IsError()); |
| 550 const GrowableObjectArray& libs = GrowableObjectArray::Handle( | 550 const GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 551 Isolate::Current()->object_store()->libraries()); | 551 Isolate::Current()->object_store()->libraries()); |
| 552 ASSERT(!libs.IsNull()); | 552 ASSERT(!libs.IsNull()); |
| 553 // App lib is the last one that was loaded. | 553 // App lib is the last one that was loaded. |
| 554 intptr_t num_libs = libs.Length(); | 554 intptr_t num_libs = libs.Length(); |
| 555 Library& app_lib = Library::Handle(); | 555 Library& app_lib = Library::Handle(); |
| 556 app_lib ^= libs.At(num_libs - 1); | 556 app_lib ^= libs.At(num_libs - 1); |
| 557 ASSERT(!app_lib.IsNull()); | 557 ASSERT(!app_lib.IsNull()); |
| 558 const Class& cls = Class::Handle( | 558 const Class& cls = Class::Handle( |
| 559 app_lib.LookupClass(String::Handle(Symbols::New("A")))); | 559 app_lib.LookupClass(String::Handle(Symbols::New("A")))); |
| 560 EXPECT_EQ(cls.raw(), result.clazz()); | 560 EXPECT_EQ(cls.raw(), result.clazz()); |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace dart | 563 } // namespace dart |
| 564 | 564 |
| 565 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 565 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
| OLD | NEW |