Revision: 16454
Author: [email protected]
Date: Fri Aug 30 13:42:16 2013 UTC
Log: Handlify JSObject::SetIdentityHash method.
[email protected]
Review URL: https://codereview.chromium.org/23495011
http://code.google.com/p/v8/source/detail?r=16454
Modified:
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/factory.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/test/cctest/test-dictionary.cc
/branches/bleeding_edge/test/cctest/test-heap.cc
=======================================
--- /branches/bleeding_edge/src/factory.cc Wed Aug 28 16:48:40 2013 UTC
+++ /branches/bleeding_edge/src/factory.cc Fri Aug 30 13:42:16 2013 UTC
@@ -1188,13 +1188,6 @@
isolate()->heap()->ReinitializeJSReceiver(
*object, JS_FUNCTION_TYPE, JSFunction::kSize));
}
-
-
-void Factory::SetIdentityHash(Handle<JSObject> object, Smi* hash) {
- CALL_HEAP_FUNCTION_VOID(
- isolate(),
- object->SetIdentityHash(hash, ALLOW_CREATION));
-}
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
=======================================
--- /branches/bleeding_edge/src/factory.h Wed Aug 28 16:48:40 2013 UTC
+++ /branches/bleeding_edge/src/factory.h Fri Aug 30 13:42:16 2013 UTC
@@ -346,8 +346,6 @@
void BecomeJSObject(Handle<JSReceiver> object);
void BecomeJSFunction(Handle<JSReceiver> object);
- void SetIdentityHash(Handle<JSObject> object, Smi* hash);
-
Handle<JSFunction> NewFunction(Handle<String> name,
Handle<Object> prototype);
=======================================
--- /branches/bleeding_edge/src/objects.cc Fri Aug 30 13:28:52 2013 UTC
+++ /branches/bleeding_edge/src/objects.cc Fri Aug 30 13:42:16 2013 UTC
@@ -3672,8 +3672,7 @@
// Inherit identity, if it was present.
if (hash->IsSmi()) {
- isolate->factory()->SetIdentityHash(
- Handle<JSObject>::cast(proxy), Smi::cast(*hash));
+ JSObject::SetIdentityHash(Handle<JSObject>::cast(proxy),
Smi::cast(*hash));
}
}
@@ -4716,17 +4715,16 @@
}
-MaybeObject* JSObject::SetIdentityHash(Smi* hash, CreationFlag flag) {
- MaybeObject* maybe = SetHiddenProperty(GetHeap()->identity_hash_string(),
- hash);
- if (maybe->IsFailure()) return maybe;
- return this;
+void JSObject::SetIdentityHash(Handle<JSObject> object, Smi* hash) {
+ CALL_HEAP_FUNCTION_VOID(object->GetIsolate(),
+ object->SetHiddenProperty(
+ object->GetHeap()->identity_hash_string(),
hash));
}
-int JSObject::GetIdentityHash(Handle<JSObject> obj) {
- CALL_AND_RETRY_OR_DIE(obj->GetIsolate(),
- obj->GetIdentityHash(ALLOW_CREATION),
+int JSObject::GetIdentityHash(Handle<JSObject> object) {
+ CALL_AND_RETRY_OR_DIE(object->GetIsolate(),
+ object->GetIdentityHash(ALLOW_CREATION),
return Smi::cast(__object__)->value(),
return 0);
}
=======================================
--- /branches/bleeding_edge/src/objects.h Fri Aug 30 13:28:52 2013 UTC
+++ /branches/bleeding_edge/src/objects.h Fri Aug 30 13:42:16 2013 UTC
@@ -2299,9 +2299,8 @@
// Returns true if the object has a property with the hidden string as
name.
bool HasHiddenProperties();
- static int GetIdentityHash(Handle<JSObject> obj);
- MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
- MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag
flag);
+ static int GetIdentityHash(Handle<JSObject> object);
+ static void SetIdentityHash(Handle<JSObject> object, Smi* hash);
inline void ValidateElements();
@@ -2848,6 +2847,8 @@
MUST_USE_RESULT MaybeObject* SetHiddenPropertiesHashTable(
Object* value);
+ MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
+
DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject);
};
@@ -9106,11 +9107,7 @@
JSReceiver* receiver,
uint32_t index);
- MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
- static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy,
- CreationFlag flag);
-
- // Turn this into an (empty) JSObject.
+ // Turn the proxy into an (empty) JSObject.
static void Fix(Handle<JSProxy> proxy);
// Initializes the body after the handler slot.
@@ -9159,6 +9156,10 @@
uint32_t index,
DeleteMode mode);
+ MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
+ static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy,
+ CreationFlag flag);
+
DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy);
};
=======================================
--- /branches/bleeding_edge/test/cctest/test-dictionary.cc Wed Jun 19
08:58:09 2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-dictionary.cc Fri Aug 30
13:42:16 2013 UTC
@@ -72,7 +72,7 @@
// Keys should map back to their respective values and also should get
// an identity hash code generated.
for (int i = 0; i < 100; i++) {
- Handle<JSObject> key = factory->NewJSArray(7);
+ Handle<JSReceiver> key = factory->NewJSArray(7);
Handle<JSObject> value = factory->NewJSArray(11);
table = PutIntoObjectHashTable(table, key, value);
CHECK_EQ(table->NumberOfElements(), i + 1);
@@ -84,7 +84,7 @@
// Keys never added to the map which already have an identity hash
// code should not be found.
for (int i = 0; i < 100; i++) {
- Handle<JSObject> key = factory->NewJSArray(7);
+ Handle<JSReceiver> key = factory->NewJSArray(7);
CHECK(key->GetIdentityHash(ALLOW_CREATION)->ToObjectChecked()->IsSmi());
CHECK_EQ(table->FindEntry(*key), ObjectHashTable::kNotFound);
CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value());
@@ -94,7 +94,7 @@
// Keys that don't have an identity hash should not be found and also
// should not get an identity hash code generated.
for (int i = 0; i < 100; i++) {
- Handle<JSObject> key = factory->NewJSArray(7);
+ Handle<JSReceiver> key = factory->NewJSArray(7);
CHECK_EQ(table->Lookup(*key), HEAP->the_hole_value());
CHECK_EQ(key->GetIdentityHash(OMIT_CREATION), HEAP->undefined_value());
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Tue Aug 27 07:42:23
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Fri Aug 30 13:42:16
2013 UTC
@@ -2691,9 +2691,7 @@
// In the first iteration, set hidden value first and identity hash
second.
// In the second iteration, reverse the order.
if (i == 0) obj->SetHiddenValue(v8_str("key string"), value);
- MaybeObject* maybe_obj = internal_obj->SetIdentityHash(hash,
- ALLOW_CREATION);
- CHECK(!maybe_obj->IsFailure());
+ JSObject::SetIdentityHash(internal_obj, hash);
if (i == 1) obj->SetHiddenValue(v8_str("key string"), value);
// Check values.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.