Chromium Code Reviews| Index: runtime/vm/class_table.cc |
| diff --git a/runtime/vm/class_table.cc b/runtime/vm/class_table.cc |
| index 7129cf8f0ab3393ac35f09d913277797b0376e2c..8cb9fa192a50850752d0ab7c706c4aa1eadfcf4e 100644 |
| --- a/runtime/vm/class_table.cc |
| +++ b/runtime/vm/class_table.cc |
| @@ -2,6 +2,7 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| +#include "vm/atomic.h" |
| #include "vm/class_table.h" |
| #include "vm/flags.h" |
| #include "vm/freelist.h" |
| @@ -106,11 +107,9 @@ void ClassTable::Register(const Class& cls) { |
| // Add the vtable for this predefined class into the static vtable registry |
| // if it has not been setup yet. |
| cpp_vtable cls_vtable = cls.handle_vtable(); |
| - cpp_vtable table_entry = Object::builtin_vtables_[index]; |
| - ASSERT((table_entry == 0) || (table_entry == cls_vtable)); |
| - if (table_entry == 0) { |
| - Object::builtin_vtables_[index] = cls_vtable; |
| - } |
| + AtomicOperations::CompareAndSwapWord( |
| + &(Object::builtin_vtables_[index]), 0, cls_vtable); |
| + ASSERT(Object::builtin_vtables_[index] == cls_vtable); |
|
zra
2016/03/03 23:50:02
Is this asserting that the compare and swap was su
siva
2016/03/04 20:53:29
The ASSERT is to make sure the value of builtin_vt
|
| } else { |
| if (top_ == capacity_) { |
| // Grow the capacity of the class table. |