| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 const Array& args = Array::Handle(Object::empty_array()); | 550 const Object& result = Object::Handle( |
| 551 const Object& result = Object::Handle(DartEntry::InvokeStatic(function, | 551 DartEntry::InvokeStatic(function, Object::empty_array())); |
| 552 args)); | |
| 553 EXPECT(!result.IsError()); | 552 EXPECT(!result.IsError()); |
| 554 const GrowableObjectArray& libs = GrowableObjectArray::Handle( | 553 const GrowableObjectArray& libs = GrowableObjectArray::Handle( |
| 555 Isolate::Current()->object_store()->libraries()); | 554 Isolate::Current()->object_store()->libraries()); |
| 556 ASSERT(!libs.IsNull()); | 555 ASSERT(!libs.IsNull()); |
| 557 // App lib is the last one that was loaded. | 556 // App lib is the last one that was loaded. |
| 558 intptr_t num_libs = libs.Length(); | 557 intptr_t num_libs = libs.Length(); |
| 559 Library& app_lib = Library::Handle(); | 558 Library& app_lib = Library::Handle(); |
| 560 app_lib ^= libs.At(num_libs - 1); | 559 app_lib ^= libs.At(num_libs - 1); |
| 561 ASSERT(!app_lib.IsNull()); | 560 ASSERT(!app_lib.IsNull()); |
| 562 const Class& cls = Class::Handle( | 561 const Class& cls = Class::Handle( |
| 563 app_lib.LookupClass(String::Handle(Symbols::New("A")))); | 562 app_lib.LookupClass(String::Handle(Symbols::New("A")))); |
| 564 EXPECT_EQ(cls.raw(), result.clazz()); | 563 EXPECT_EQ(cls.raw(), result.clazz()); |
| 565 } | 564 } |
| 566 | 565 |
| 567 } // namespace dart | 566 } // namespace dart |
| 568 | 567 |
| 569 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 568 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
| OLD | NEW |