| 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 "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 Function& entry = Function::Handle(); | 2211 Function& entry = Function::Handle(); |
| 2212 for (intptr_t i = 0; i < arr.Length(); i++) { | 2212 for (intptr_t i = 0; i < arr.Length(); i++) { |
| 2213 entry ^= arr.At(i); | 2213 entry ^= arr.At(i); |
| 2214 if (function.raw() != entry.raw()) { | 2214 if (function.raw() != entry.raw()) { |
| 2215 AddFunction(entry); | 2215 AddFunction(entry); |
| 2216 } | 2216 } |
| 2217 } | 2217 } |
| 2218 } | 2218 } |
| 2219 | 2219 |
| 2220 | 2220 |
| 2221 intptr_t Class::FindFunctionIndex(const Function& needle) const { | |
| 2222 Thread* thread = Thread::Current(); | |
| 2223 if (EnsureIsFinalized(thread) != Error::null()) { | |
| 2224 return -1; | |
| 2225 } | |
| 2226 REUSABLE_ARRAY_HANDLESCOPE(thread); | |
| 2227 REUSABLE_FUNCTION_HANDLESCOPE(thread); | |
| 2228 Array& funcs = thread->ArrayHandle(); | |
| 2229 Function& function = thread->FunctionHandle(); | |
| 2230 funcs ^= functions(); | |
| 2231 ASSERT(!funcs.IsNull()); | |
| 2232 const intptr_t len = funcs.Length(); | |
| 2233 for (intptr_t i = 0; i < len; i++) { | |
| 2234 function ^= funcs.At(i); | |
| 2235 if (function.raw() == needle.raw()) { | |
| 2236 return i; | |
| 2237 } | |
| 2238 } | |
| 2239 // No function found. | |
| 2240 return -1; | |
| 2241 } | |
| 2242 | |
| 2243 | |
| 2244 RawFunction* Class::FunctionFromIndex(intptr_t idx) const { | 2221 RawFunction* Class::FunctionFromIndex(intptr_t idx) const { |
| 2245 const Array& funcs = Array::Handle(functions()); | 2222 const Array& funcs = Array::Handle(functions()); |
| 2246 if ((idx < 0) || (idx >= funcs.Length())) { | 2223 if ((idx < 0) || (idx >= funcs.Length())) { |
| 2247 return Function::null(); | 2224 return Function::null(); |
| 2248 } | 2225 } |
| 2249 Function& func = Function::Handle(); | 2226 Function& func = Function::Handle(); |
| 2250 func ^= funcs.At(idx); | 2227 func ^= funcs.At(idx); |
| 2251 ASSERT(!func.IsNull()); | 2228 ASSERT(!func.IsNull()); |
| 2252 return func.raw(); | 2229 return func.raw(); |
| 2253 } | 2230 } |
| (...skipping 19676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21930 return tag_label.ToCString(); | 21907 return tag_label.ToCString(); |
| 21931 } | 21908 } |
| 21932 | 21909 |
| 21933 | 21910 |
| 21934 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21911 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 21935 Instance::PrintJSONImpl(stream, ref); | 21912 Instance::PrintJSONImpl(stream, ref); |
| 21936 } | 21913 } |
| 21937 | 21914 |
| 21938 | 21915 |
| 21939 } // namespace dart | 21916 } // namespace dart |
| OLD | NEW |