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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 is_const, is_abstract, is_external, is_native, cls, | 3013 is_const, is_abstract, is_external, is_native, cls, |
3014 TokenPosition::kMinSource); | 3014 TokenPosition::kMinSource); |
3015 } | 3015 } |
3016 | 3016 |
3017 | 3017 |
3018 ISOLATE_UNIT_TEST_CASE(ICData) { | 3018 ISOLATE_UNIT_TEST_CASE(ICData) { |
3019 Function& function = Function::Handle(GetDummyTarget("Bern")); | 3019 Function& function = Function::Handle(GetDummyTarget("Bern")); |
3020 const intptr_t id = 12; | 3020 const intptr_t id = 12; |
3021 const intptr_t num_args_tested = 1; | 3021 const intptr_t num_args_tested = 1; |
3022 const String& target_name = String::Handle(Symbols::New(thread, "Thun")); | 3022 const String& target_name = String::Handle(Symbols::New(thread, "Thun")); |
3023 const Array& args_descriptor = | 3023 const intptr_t kTypeArgsLen = 0; |
3024 Array::Handle(ArgumentsDescriptor::New(1, Object::null_array())); | 3024 const intptr_t kNumArgs = 1; |
| 3025 const Array& args_descriptor = Array::Handle( |
| 3026 ArgumentsDescriptor::New(kTypeArgsLen, kNumArgs, Object::null_array())); |
3025 ICData& o1 = ICData::Handle(); | 3027 ICData& o1 = ICData::Handle(); |
3026 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested, | 3028 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested, |
3027 false); | 3029 false); |
3028 EXPECT_EQ(1, o1.NumArgsTested()); | 3030 EXPECT_EQ(1, o1.NumArgsTested()); |
3029 EXPECT_EQ(id, o1.deopt_id()); | 3031 EXPECT_EQ(id, o1.deopt_id()); |
3030 EXPECT_EQ(function.raw(), o1.Owner()); | 3032 EXPECT_EQ(function.raw(), o1.Owner()); |
3031 EXPECT_EQ(0, o1.NumberOfChecks()); | 3033 EXPECT_EQ(0, o1.NumberOfChecks()); |
3032 EXPECT_EQ(target_name.raw(), o1.target_name()); | 3034 EXPECT_EQ(target_name.raw(), o1.target_name()); |
3033 EXPECT_EQ(args_descriptor.raw(), o1.arguments_descriptor()); | 3035 EXPECT_EQ(args_descriptor.raw(), o1.arguments_descriptor()); |
3034 | 3036 |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3835 parent = | 3837 parent = |
3836 Function::New(parent_name, RawFunction::kRegularFunction, false, false, | 3838 Function::New(parent_name, RawFunction::kRegularFunction, false, false, |
3837 false, false, false, cls, TokenPosition::kMinSource); | 3839 false, false, false, cls, TokenPosition::kMinSource); |
3838 functions.SetAt(0, parent); | 3840 functions.SetAt(0, parent); |
3839 cls.SetFunctions(functions); | 3841 cls.SetFunctions(functions); |
3840 cls.Finalize(); | 3842 cls.Finalize(); |
3841 | 3843 |
3842 // Add invocation dispatcher. | 3844 // Add invocation dispatcher. |
3843 const String& invocation_dispatcher_name = | 3845 const String& invocation_dispatcher_name = |
3844 String::Handle(Symbols::New(thread, "myMethod")); | 3846 String::Handle(Symbols::New(thread, "myMethod")); |
3845 const Array& args_desc = Array::Handle(ArgumentsDescriptor::New(1)); | 3847 const Array& args_desc = Array::Handle(ArgumentsDescriptor::New(0, 1)); |
3846 Function& invocation_dispatcher = Function::Handle(); | 3848 Function& invocation_dispatcher = Function::Handle(); |
3847 invocation_dispatcher ^= cls.GetInvocationDispatcher( | 3849 invocation_dispatcher ^= cls.GetInvocationDispatcher( |
3848 invocation_dispatcher_name, args_desc, | 3850 invocation_dispatcher_name, args_desc, |
3849 RawFunction::kNoSuchMethodDispatcher, true /* create_if_absent */); | 3851 RawFunction::kNoSuchMethodDispatcher, true /* create_if_absent */); |
3850 EXPECT(!invocation_dispatcher.IsNull()); | 3852 EXPECT(!invocation_dispatcher.IsNull()); |
3851 // Get index to function. | 3853 // Get index to function. |
3852 intptr_t invocation_dispatcher_index = | 3854 intptr_t invocation_dispatcher_index = |
3853 cls.FindInvocationDispatcherFunctionIndex(invocation_dispatcher); | 3855 cls.FindInvocationDispatcherFunctionIndex(invocation_dispatcher); |
3854 // Expect a valid index. | 3856 // Expect a valid index. |
3855 EXPECT_GE(invocation_dispatcher_index, 0); | 3857 EXPECT_GE(invocation_dispatcher_index, 0); |
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4720 // utf32->utf16 conversion. | 4722 // utf32->utf16 conversion. |
4721 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, | 4723 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, |
4722 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; | 4724 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; |
4723 | 4725 |
4724 const String& str = | 4726 const String& str = |
4725 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); | 4727 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); |
4726 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); | 4728 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); |
4727 } | 4729 } |
4728 | 4730 |
4729 } // namespace dart | 4731 } // namespace dart |
OLD | NEW |