Index: runtime/lib/object.cc |
=================================================================== |
--- runtime/lib/object.cc (revision 24817) |
+++ runtime/lib/object.cc (working copy) |
@@ -5,6 +5,7 @@ |
#include "vm/bootstrap_natives.h" |
#include "vm/exceptions.h" |
+#include "vm/heap.h" |
#include "vm/native_entry.h" |
#include "vm/object.h" |
#include "vm/stack_frame.h" |
@@ -21,6 +22,22 @@ |
} |
+DEFINE_NATIVE_ENTRY(Object_getHash, 1) { |
+ const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
+ Heap* heap = isolate->heap(); |
+ return Smi::New(heap->GetHash(instance.raw())); |
+} |
+ |
+ |
+DEFINE_NATIVE_ENTRY(Object_setHash, 2) { |
+ const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
+ GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); |
+ Heap* heap = isolate->heap(); |
+ heap->SetHash(instance.raw(), hash.Value()); |
+ return Object::null(); |
+} |
+ |
+ |
DEFINE_NATIVE_ENTRY(Object_toString, 1) { |
const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
const char* c_str = instance.ToCString(); |