JSObject::GetHiddenProperty() handlified.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/255153002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21052 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ishell@chromium.org 2014-04-29 13:51:14 +00:00
parent e025457443
commit c8e95c411c
6 changed files with 20 additions and 14 deletions

View File

@ -3631,7 +3631,7 @@ v8::Local<v8::Value> v8::Object::GetHiddenValue(v8::Handle<v8::String> key) {
i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
i::Handle<i::String> key_string =
isolate->factory()->InternalizeString(key_obj);
i::Handle<i::Object> result(self->GetHiddenProperty(*key_string), isolate);
i::Handle<i::Object> result(self->GetHiddenProperty(key_string), isolate);
if (result->IsTheHole()) return v8::Local<v8::Value>();
return Utils::ToLocal(result);
}

View File

@ -1051,7 +1051,7 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
if (capture_stack_trace_for_uncaught_exceptions_) {
if (IsErrorObject(exception_handle)) {
// We fetch the stack trace that corresponds to this error object.
String* key = heap()->hidden_stack_trace_string();
Handle<String> key = factory()->hidden_stack_trace_string();
Object* stack_property =
JSObject::cast(*exception_handle)->GetHiddenProperty(key);
// Property lookup may have failed. In this case it's probably not

View File

@ -5113,8 +5113,13 @@ void JSObject::SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash) {
Object* JSObject::GetIdentityHash() {
Object* stored_value = GetHiddenProperty(GetHeap()->identity_hash_string());
return stored_value->IsSmi() ? stored_value : GetHeap()->undefined_value();
DisallowHeapAllocation no_gc;
Isolate* isolate = GetIsolate();
Object* stored_value =
GetHiddenProperty(isolate->factory()->identity_hash_string());
return stored_value->IsSmi()
? stored_value
: isolate->heap()->undefined_value();
}
@ -5156,7 +5161,8 @@ Handle<Object> JSProxy::GetOrCreateIdentityHash(Handle<JSProxy> proxy) {
}
Object* JSObject::GetHiddenProperty(Name* key) {
Object* JSObject::GetHiddenProperty(Handle<Name> key) {
DisallowHeapAllocation no_gc;
ASSERT(key->IsUniqueName());
if (IsJSGlobalProxy()) {
// For a proxy, use the prototype as target object.
@ -5171,7 +5177,7 @@ Object* JSObject::GetHiddenProperty(Name* key) {
if (inline_value->IsSmi()) {
// Handle inline-stored identity hash.
if (key == GetHeap()->identity_hash_string()) {
if (*key == GetHeap()->identity_hash_string()) {
return inline_value;
} else {
return GetHeap()->the_hole_value();
@ -5181,7 +5187,7 @@ Object* JSObject::GetHiddenProperty(Name* key) {
if (inline_value->IsUndefined()) return GetHeap()->the_hole_value();
ObjectHashTable* hashtable = ObjectHashTable::cast(inline_value);
Object* entry = hashtable->Lookup(key);
Object* entry = hashtable->Lookup(*key);
return entry;
}

View File

@ -2372,7 +2372,7 @@ class JSObject: public JSReceiver {
// Gets the value of a hidden property with the given key. Returns the hole
// if the property doesn't exist (or if called on a detached proxy),
// otherwise returns the value set for the key.
Object* GetHiddenProperty(Name* key);
Object* GetHiddenProperty(Handle<Name> key);
// Deletes a hidden property. Deleting a non-existing property is
// considered successful.
static void DeleteHiddenProperty(Handle<JSObject> object,

View File

@ -13880,7 +13880,7 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObject) {
Handle<JSObject> obj = Handle<JSObject>::cast(input);
Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate);
Handle<Object> tag(obj->GetHiddenProperty(marker), isolate);
return isolate->heap()->ToBoolean(!tag->IsTheHole());
}
@ -13897,7 +13897,7 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObjectOfType) {
Handle<JSObject> obj = Handle<JSObject>::cast(input);
Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
Handle<Object> tag(obj->GetHiddenProperty(*marker), isolate);
Handle<Object> tag(obj->GetHiddenProperty(marker), isolate);
return isolate->heap()->ToBoolean(
tag->IsString() && String::cast(*tag)->Equals(*expected_type));
}
@ -13939,7 +13939,7 @@ RUNTIME_FUNCTION(Runtime_GetImplFromInitializedIntlObject) {
Handle<JSObject> obj = Handle<JSObject>::cast(input);
Handle<String> marker = isolate->factory()->intl_impl_object_string();
Handle<Object> impl(obj->GetHiddenProperty(*marker), isolate);
Handle<Object> impl(obj->GetHiddenProperty(marker), isolate);
if (impl->IsTheHole()) {
Vector< Handle<Object> > arguments = HandleVector(&obj, 1);
Handle<Object> type_error =
@ -14486,7 +14486,7 @@ RUNTIME_FUNCTION(Runtime_GetAndClearOverflowedStackTrace) {
ASSERT(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0);
Handle<String> key = isolate->factory()->hidden_stack_trace_string();
Handle<Object> result(error_object->GetHiddenProperty(*key), isolate);
Handle<Object> result(error_object->GetHiddenProperty(key), isolate);
if (result->IsTheHole()) return isolate->heap()->undefined_value();
RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined());
JSObject::DeleteHiddenProperty(error_object, key);

View File

@ -2999,7 +2999,7 @@ TEST(Regress2211) {
v8::Handle<v8::String> value = v8_str("val string");
Smi* hash = Smi::FromInt(321);
Heap* heap = CcTest::heap();
Factory* factory = CcTest::i_isolate()->factory();
for (int i = 0; i < 2; i++) {
// Store identity hash first and common hidden property second.
@ -3015,7 +3015,7 @@ TEST(Regress2211) {
// Check values.
CHECK_EQ(hash,
internal_obj->GetHiddenProperty(heap->identity_hash_string()));
internal_obj->GetHiddenProperty(factory->identity_hash_string()));
CHECK(value->Equals(obj->GetHiddenValue(v8_str("key string"))));
// Check size.