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 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 // Transition to using hash table. | 2118 // Transition to using hash table. |
2119 SetFunctions(new_arr); | 2119 SetFunctions(new_arr); |
2120 } else if (new_len > kFunctionLookupHashTreshold) { | 2120 } else if (new_len > kFunctionLookupHashTreshold) { |
2121 ClassFunctionsSet set(raw_ptr()->functions_hash_table_); | 2121 ClassFunctionsSet set(raw_ptr()->functions_hash_table_); |
2122 set.Insert(function); | 2122 set.Insert(function); |
2123 StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw()); | 2123 StorePointer(&raw_ptr()->functions_hash_table_, set.Release().raw()); |
2124 } | 2124 } |
2125 } | 2125 } |
2126 | 2126 |
2127 | 2127 |
| 2128 void Class::RemoveFunction(const Function& function) const { |
| 2129 const Array& arr = Array::Handle(functions()); |
| 2130 StorePointer(&raw_ptr()->functions_, Object::empty_array().raw()); |
| 2131 Function& entry = Function::Handle(); |
| 2132 for (intptr_t i = 0; i < arr.Length(); i++) { |
| 2133 entry ^= arr.At(i); |
| 2134 if (function.raw() != entry.raw()) { |
| 2135 AddFunction(entry); |
| 2136 } |
| 2137 } |
| 2138 } |
| 2139 |
| 2140 |
2128 intptr_t Class::FindFunctionIndex(const Function& needle) const { | 2141 intptr_t Class::FindFunctionIndex(const Function& needle) const { |
2129 Isolate* isolate = Isolate::Current(); | 2142 Isolate* isolate = Isolate::Current(); |
2130 if (EnsureIsFinalized(isolate) != Error::null()) { | 2143 if (EnsureIsFinalized(isolate) != Error::null()) { |
2131 return -1; | 2144 return -1; |
2132 } | 2145 } |
2133 REUSABLE_ARRAY_HANDLESCOPE(isolate); | 2146 REUSABLE_ARRAY_HANDLESCOPE(isolate); |
2134 REUSABLE_FUNCTION_HANDLESCOPE(isolate); | 2147 REUSABLE_FUNCTION_HANDLESCOPE(isolate); |
2135 Array& funcs = isolate->ArrayHandle(); | 2148 Array& funcs = isolate->ArrayHandle(); |
2136 Function& function = isolate->FunctionHandle(); | 2149 Function& function = isolate->FunctionHandle(); |
2137 funcs ^= functions(); | 2150 funcs ^= functions(); |
(...skipping 18339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20477 return tag_label.ToCString(); | 20490 return tag_label.ToCString(); |
20478 } | 20491 } |
20479 | 20492 |
20480 | 20493 |
20481 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20494 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20482 Instance::PrintJSONImpl(stream, ref); | 20495 Instance::PrintJSONImpl(stream, ref); |
20483 } | 20496 } |
20484 | 20497 |
20485 | 20498 |
20486 } // namespace dart | 20499 } // namespace dart |
OLD | NEW |