| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 cache = Array::Grow(cache, cache.Length() + (8 * kNumEntries)); | 909 cache = Array::Grow(cache, cache.Length() + (8 * kNumEntries)); |
| 910 class_.set_functions_cache(cache); | 910 class_.set_functions_cache(cache); |
| 911 EnterFunctionAt(ix, | 911 EnterFunctionAt(ix, |
| 912 cache, | 912 cache, |
| 913 function, | 913 function, |
| 914 num_arguments, | 914 num_arguments, |
| 915 num_named_arguments); | 915 num_named_arguments); |
| 916 } | 916 } |
| 917 | 917 |
| 918 | 918 |
| 919 // TODO(regis): The actual names of named arguments must match as well. | 919 // Only the number of named arguments is checked, but not the actual names. |
| 920 RawCode* FunctionsCache::LookupCode(const String& function_name, | 920 RawCode* FunctionsCache::LookupCode(const String& function_name, |
| 921 int num_arguments, | 921 int num_arguments, |
| 922 int num_named_arguments) { | 922 int num_named_arguments) { |
| 923 const Array& cache = Array::Handle(class_.functions_cache()); | 923 const Array& cache = Array::Handle(class_.functions_cache()); |
| 924 String& test_name = String::Handle(); | 924 String& test_name = String::Handle(); |
| 925 for (intptr_t i = 0; i < cache.Length(); i += kNumEntries) { | 925 for (intptr_t i = 0; i < cache.Length(); i += kNumEntries) { |
| 926 test_name ^= cache.At(i + FunctionsCache::kFunctionName); | 926 test_name ^= cache.At(i + FunctionsCache::kFunctionName); |
| 927 if (test_name.IsNull()) { | 927 if (test_name.IsNull()) { |
| 928 // Found NULL, no more entries to check, abort lookup. | 928 // Found NULL, no more entries to check, abort lookup. |
| 929 return Code::null(); | 929 return Code::null(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 943 } | 943 } |
| 944 } | 944 } |
| 945 } | 945 } |
| 946 // The cache is null terminated, therefore the loop above should never | 946 // The cache is null terminated, therefore the loop above should never |
| 947 // terminate by itself. | 947 // terminate by itself. |
| 948 UNREACHABLE(); | 948 UNREACHABLE(); |
| 949 return Code::null(); | 949 return Code::null(); |
| 950 } | 950 } |
| 951 | 951 |
| 952 } // namespace dart | 952 } // namespace dart |
| OLD | NEW |