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

Unified Diff: runtime/vm/assembler.h

Issue 1846063002: - Fix the hash code for raw objects that are added into the object pool (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix Created 4 years, 9 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 | « no previous file | runtime/vm/assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler.h
diff --git a/runtime/vm/assembler.h b/runtime/vm/assembler.h
index 5d20c01b691cb3731f7ee60819f8bc36d21cf31c..65820fe916f17157282ee8b96758cecf777e8622 100644
--- a/runtime/vm/assembler.h
+++ b/runtime/vm/assembler.h
@@ -247,16 +247,8 @@ class ObjIndexPair {
ObjIndexPair(Key key, Value value) : value_(value) {
key_.type_ = key.type_;
if (key.type_ == ObjectPool::kTaggedObject) {
- if (key.obj_->IsNotTemporaryScopedHandle()) {
- key_.obj_ = key.obj_;
- } else {
- key_.obj_ = &Object::ZoneHandle(key.obj_->raw());
- }
- if (key.equivalence_->IsNotTemporaryScopedHandle()) {
- key_.equivalence_ = key.equivalence_;
- } else {
- key_.equivalence_ = &Object::ZoneHandle(key.equivalence_->raw());
- }
+ key_.obj_ = key.obj_;
+ key_.equivalence_ = key.equivalence_;
} else {
key_.raw_value_ = key.raw_value_;
}
@@ -273,20 +265,12 @@ class ObjIndexPair {
if (key.obj_->IsSmi()) {
return Smi::Cast(*key.obj_).Value();
}
- if (key.obj_->IsDouble()) {
- return static_cast<intptr_t>(
- bit_cast<int32_t, float>(
- static_cast<float>(Double::Cast(*key.obj_).value())));
- }
- if (key.obj_->IsMint()) {
- return static_cast<intptr_t>(Mint::Cast(*key.obj_).value());
- }
- if (key.obj_->IsString()) {
- return String::Cast(*key.obj_).Hash();
- }
- // TODO(fschneider): Add hash function for other classes commonly used as
- // compile-time constants.
- return key.obj_->GetClassId();
+ // TODO(asiva) For now we assert that the object is from Old space
+ // and use the address of the raw object, once the weak_entry_table code
+ // in heap allows for multiple thread access we should switch this code
+ // to create a temporary raw obj => id mapping and use that.
+ ASSERT(key.obj_->IsOld());
+ return reinterpret_cast<intptr_t>(key.obj_->raw());
}
static inline bool IsKeyEqual(Pair kv, Key key) {
« no previous file with comments | « no previous file | runtime/vm/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698