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/globals.h" | 5 #include "platform/globals.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 word expected_length = static_cast<word>(strlen(kHello)); | 2762 word expected_length = static_cast<word>(strlen(kHello)); |
2763 Assembler _assembler_; | 2763 Assembler _assembler_; |
2764 GenerateEmbedStringInCode(&_assembler_, kHello); | 2764 GenerateEmbedStringInCode(&_assembler_, kHello); |
2765 Code& code = Code::Handle(Code::FinalizeCode( | 2765 Code& code = Code::Handle(Code::FinalizeCode( |
2766 *CreateFunction("Test_EmbedStringInCode"), &_assembler_)); | 2766 *CreateFunction("Test_EmbedStringInCode"), &_assembler_)); |
2767 Instructions& instructions = Instructions::Handle(code.instructions()); | 2767 Instructions& instructions = Instructions::Handle(code.instructions()); |
2768 uword retval = 0; | 2768 uword retval = 0; |
2769 #if defined(USING_SIMULATOR) | 2769 #if defined(USING_SIMULATOR) |
2770 retval = bit_copy<uword, int64_t>(Simulator::Current()->Call( | 2770 retval = bit_copy<uword, int64_t>(Simulator::Current()->Call( |
2771 static_cast<intptr_t>(instructions.EntryPoint()), 0, 0, 0, 0)); | 2771 static_cast<intptr_t>(instructions.EntryPoint()), 0, 0, 0, 0)); |
| 2772 #elif defined(TARGET_ARCH_X64) |
| 2773 typedef uword (*EmbedStringCode)(const Code&); |
| 2774 retval = reinterpret_cast<EmbedStringCode>(instructions.EntryPoint())(code); |
2772 #else | 2775 #else |
2773 typedef uword (*EmbedStringCode)(); | 2776 typedef uword (*EmbedStringCode)(); |
2774 retval = reinterpret_cast<EmbedStringCode>(instructions.EntryPoint())(); | 2777 retval = reinterpret_cast<EmbedStringCode>(instructions.EntryPoint())(); |
2775 #endif | 2778 #endif |
2776 EXPECT((retval & kSmiTagMask) == kHeapObjectTag); | 2779 EXPECT((retval & kSmiTagMask) == kHeapObjectTag); |
2777 String& string_object = String::Handle(); | 2780 String& string_object = String::Handle(); |
2778 string_object ^= reinterpret_cast<RawInstructions*>(retval); | 2781 string_object ^= reinterpret_cast<RawInstructions*>(retval); |
2779 EXPECT(string_object.Length() == expected_length); | 2782 EXPECT(string_object.Length() == expected_length); |
2780 for (int i = 0; i < expected_length; i ++) { | 2783 for (int i = 0; i < expected_length; i ++) { |
2781 EXPECT(string_object.CharAt(i) == kHello[i]); | 2784 EXPECT(string_object.CharAt(i) == kHello[i]); |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4743 EXPECT(iterator.MoveNext()); | 4746 EXPECT(iterator.MoveNext()); |
4744 object = iterator.CurrentKey(); | 4747 object = iterator.CurrentKey(); |
4745 EXPECT_STREQ("z", object.ToCString()); | 4748 EXPECT_STREQ("z", object.ToCString()); |
4746 object = iterator.CurrentValue(); | 4749 object = iterator.CurrentValue(); |
4747 EXPECT_STREQ("5", object.ToCString()); | 4750 EXPECT_STREQ("5", object.ToCString()); |
4748 | 4751 |
4749 EXPECT(!iterator.MoveNext()); | 4752 EXPECT(!iterator.MoveNext()); |
4750 } | 4753 } |
4751 | 4754 |
4752 } // namespace dart | 4755 } // namespace dart |
OLD | NEW |