| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 3658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3669 // Code will be set on the JavaScript side. | 3669 // Code will be set on the JavaScript side. |
| 3670 } else { | 3670 } else { |
| 3671 isolate->factory()->BecomeJSObject(self); | 3671 isolate->factory()->BecomeJSObject(self); |
| 3672 } | 3672 } |
| 3673 ASSERT(self->IsJSObject()); | 3673 ASSERT(self->IsJSObject()); |
| 3674 | 3674 |
| 3675 // Inherit identity, if it was present. | 3675 // Inherit identity, if it was present. |
| 3676 Object* hash; | 3676 Object* hash; |
| 3677 if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) { | 3677 if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) { |
| 3678 Handle<JSObject> new_self(JSObject::cast(*self)); | 3678 Handle<JSObject> new_self(JSObject::cast(*self)); |
| 3679 isolate->factory()->SetIdentityHash(new_self, Smi::cast(hash)); | 3679 JSObject::SetIdentityHash(new_self, Smi::cast(hash)); |
| 3680 } | 3680 } |
| 3681 } | 3681 } |
| 3682 | 3682 |
| 3683 | 3683 |
| 3684 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, | 3684 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, |
| 3685 Handle<Object> derived, | 3685 Handle<Object> derived, |
| 3686 int argc, | 3686 int argc, |
| 3687 Handle<Object> argv[]) { | 3687 Handle<Object> argv[]) { |
| 3688 Isolate* isolate = GetIsolate(); | 3688 Isolate* isolate = GetIsolate(); |
| 3689 Handle<Object> handler(this->handler(), isolate); | 3689 Handle<Object> handler(this->handler(), isolate); |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4712 // within a smi. | 4712 // within a smi. |
| 4713 hash_value = V8::RandomPrivate(isolate) & Smi::kMaxValue; | 4713 hash_value = V8::RandomPrivate(isolate) & Smi::kMaxValue; |
| 4714 attempts++; | 4714 attempts++; |
| 4715 } while (hash_value == 0 && attempts < 30); | 4715 } while (hash_value == 0 && attempts < 30); |
| 4716 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 | 4716 hash_value = hash_value != 0 ? hash_value : 1; // never return 0 |
| 4717 | 4717 |
| 4718 return Smi::FromInt(hash_value); | 4718 return Smi::FromInt(hash_value); |
| 4719 } | 4719 } |
| 4720 | 4720 |
| 4721 | 4721 |
| 4722 MaybeObject* JSObject::SetIdentityHash(Smi* hash, CreationFlag flag) { | 4722 void JSObject::SetIdentityHash(Handle<JSObject> object, Smi* hash) { |
| 4723 MaybeObject* maybe = SetHiddenProperty(GetHeap()->identity_hash_string(), | 4723 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), |
| 4724 hash); | 4724 object->SetHiddenProperty( |
| 4725 if (maybe->IsFailure()) return maybe; | 4725 object->GetHeap()->identity_hash_string(), hash)); |
| 4726 return this; | |
| 4727 } | 4726 } |
| 4728 | 4727 |
| 4729 | 4728 |
| 4730 int JSObject::GetIdentityHash(Handle<JSObject> obj) { | 4729 int JSObject::GetIdentityHash(Handle<JSObject> object) { |
| 4731 CALL_AND_RETRY_OR_DIE(obj->GetIsolate(), | 4730 CALL_AND_RETRY_OR_DIE(object->GetIsolate(), |
| 4732 obj->GetIdentityHash(ALLOW_CREATION), | 4731 object->GetIdentityHash(ALLOW_CREATION), |
| 4733 return Smi::cast(__object__)->value(), | 4732 return Smi::cast(__object__)->value(), |
| 4734 return 0); | 4733 return 0); |
| 4735 } | 4734 } |
| 4736 | 4735 |
| 4737 | 4736 |
| 4738 MaybeObject* JSObject::GetIdentityHash(CreationFlag flag) { | 4737 MaybeObject* JSObject::GetIdentityHash(CreationFlag flag) { |
| 4739 Object* stored_value = GetHiddenProperty(GetHeap()->identity_hash_string()); | 4738 Object* stored_value = GetHiddenProperty(GetHeap()->identity_hash_string()); |
| 4740 if (stored_value->IsSmi()) return stored_value; | 4739 if (stored_value->IsSmi()) return stored_value; |
| 4741 | 4740 |
| 4742 // Do not generate permanent identity hash code if not requested. | 4741 // Do not generate permanent identity hash code if not requested. |
| (...skipping 11251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15994 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15993 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 15995 static const char* error_messages_[] = { | 15994 static const char* error_messages_[] = { |
| 15996 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15995 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 15997 }; | 15996 }; |
| 15998 #undef ERROR_MESSAGES_TEXTS | 15997 #undef ERROR_MESSAGES_TEXTS |
| 15999 return error_messages_[reason]; | 15998 return error_messages_[reason]; |
| 16000 } | 15999 } |
| 16001 | 16000 |
| 16002 | 16001 |
| 16003 } } // namespace v8::internal | 16002 } } // namespace v8::internal |
| OLD | NEW |