Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Unified Diff: runtime/lib/object.cc

Issue 18826007: Reland r24563 and r24564 with fixes cumbersome API leading to leaks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/expando_patch.dart ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « runtime/lib/expando_patch.dart ('k') | runtime/lib/object_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698