Chromium Code Reviews| 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 3634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3645 uint32_t index) { | 3645 uint32_t index) { |
| 3646 Isolate* isolate = GetIsolate(); | 3646 Isolate* isolate = GetIsolate(); |
| 3647 HandleScope scope(isolate); | 3647 HandleScope scope(isolate); |
| 3648 Handle<JSProxy> proxy(this); | 3648 Handle<JSProxy> proxy(this); |
| 3649 Handle<JSReceiver> receiver(receiver_raw); | 3649 Handle<JSReceiver> receiver(receiver_raw); |
| 3650 Handle<String> name = isolate->factory()->Uint32ToString(index); | 3650 Handle<String> name = isolate->factory()->Uint32ToString(index); |
| 3651 return proxy->GetPropertyAttributeWithHandler(*receiver, *name); | 3651 return proxy->GetPropertyAttributeWithHandler(*receiver, *name); |
| 3652 } | 3652 } |
| 3653 | 3653 |
| 3654 | 3654 |
| 3655 void JSProxy::Fix() { | 3655 void JSProxy::Fix(Handle<JSProxy> self) { |
|
Michael Starzinger
2013/08/30 10:56:31
nit: s/self/proxy here for consistency.
| |
| 3656 Isolate* isolate = GetIsolate(); | 3656 Isolate* isolate = self->GetIsolate(); |
| 3657 HandleScope scope(isolate); | |
| 3658 Handle<JSProxy> self(this); | |
| 3659 | 3657 |
| 3660 // Save identity hash. | 3658 // Save identity hash. |
| 3661 MaybeObject* maybe_hash = GetIdentityHash(OMIT_CREATION); | 3659 Handle<Object> hash = JSProxy::GetIdentityHash(self, OMIT_CREATION); |
| 3662 | 3660 |
| 3663 if (IsJSFunctionProxy()) { | 3661 if (self->IsJSFunctionProxy()) { |
| 3664 isolate->factory()->BecomeJSFunction(self); | 3662 isolate->factory()->BecomeJSFunction(self); |
| 3665 // Code will be set on the JavaScript side. | 3663 // Code will be set on the JavaScript side. |
| 3666 } else { | 3664 } else { |
| 3667 isolate->factory()->BecomeJSObject(self); | 3665 isolate->factory()->BecomeJSObject(self); |
| 3668 } | 3666 } |
| 3669 ASSERT(self->IsJSObject()); | 3667 ASSERT(self->IsJSObject()); |
| 3670 | 3668 |
| 3671 // Inherit identity, if it was present. | 3669 // Inherit identity, if it was present. |
| 3672 Object* hash; | 3670 if (hash->IsSmi()) { |
| 3673 if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) { | |
| 3674 Handle<JSObject> new_self(JSObject::cast(*self)); | 3671 Handle<JSObject> new_self(JSObject::cast(*self)); |
|
Michael Starzinger
2013/08/30 10:56:31
This re-handlification of "self" makes no sense to
| |
| 3675 isolate->factory()->SetIdentityHash(new_self, Smi::cast(hash)); | 3672 isolate->factory()->SetIdentityHash(new_self, Smi::cast(*hash)); |
| 3676 } | 3673 } |
| 3677 } | 3674 } |
| 3678 | 3675 |
| 3679 | 3676 |
| 3680 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, | 3677 MUST_USE_RESULT Handle<Object> JSProxy::CallTrap(const char* name, |
| 3681 Handle<Object> derived, | 3678 Handle<Object> derived, |
| 3682 int argc, | 3679 int argc, |
| 3683 Handle<Object> argv[]) { | 3680 Handle<Object> argv[]) { |
| 3684 Isolate* isolate = GetIsolate(); | 3681 Isolate* isolate = GetIsolate(); |
| 3685 Handle<Object> handler(this->handler(), isolate); | 3682 Handle<Object> handler(this->handler(), isolate); |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4740 hash); | 4737 hash); |
| 4741 if (result->IsFailure()) return result; | 4738 if (result->IsFailure()) return result; |
| 4742 if (result->ToObjectUnchecked()->IsUndefined()) { | 4739 if (result->ToObjectUnchecked()->IsUndefined()) { |
| 4743 // Trying to get hash of detached proxy. | 4740 // Trying to get hash of detached proxy. |
| 4744 return Smi::FromInt(0); | 4741 return Smi::FromInt(0); |
| 4745 } | 4742 } |
| 4746 return hash; | 4743 return hash; |
| 4747 } | 4744 } |
| 4748 | 4745 |
| 4749 | 4746 |
| 4747 Handle<Object> JSProxy::GetIdentityHash(Handle<JSProxy> proxy, | |
| 4748 CreationFlag flag) { | |
| 4749 CALL_HEAP_FUNCTION(proxy->GetIsolate(), proxy->GetIdentityHash(flag), Object); | |
| 4750 } | |
| 4751 | |
| 4752 | |
| 4750 MaybeObject* JSProxy::GetIdentityHash(CreationFlag flag) { | 4753 MaybeObject* JSProxy::GetIdentityHash(CreationFlag flag) { |
| 4751 Object* hash = this->hash(); | 4754 Object* hash = this->hash(); |
| 4752 if (!hash->IsSmi() && flag == ALLOW_CREATION) { | 4755 if (!hash->IsSmi() && flag == ALLOW_CREATION) { |
| 4753 hash = GenerateIdentityHash(); | 4756 hash = GenerateIdentityHash(); |
| 4754 set_hash(hash); | 4757 set_hash(hash); |
| 4755 } | 4758 } |
| 4756 return hash; | 4759 return hash; |
| 4757 } | 4760 } |
| 4758 | 4761 |
| 4759 | 4762 |
| (...skipping 11225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15985 #define ERROR_MESSAGES_TEXTS(C, T) T, | 15988 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 15986 static const char* error_messages_[] = { | 15989 static const char* error_messages_[] = { |
| 15987 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 15990 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 15988 }; | 15991 }; |
| 15989 #undef ERROR_MESSAGES_TEXTS | 15992 #undef ERROR_MESSAGES_TEXTS |
| 15990 return error_messages_[reason]; | 15993 return error_messages_[reason]; |
| 15991 } | 15994 } |
| 15992 | 15995 |
| 15993 | 15996 |
| 15994 } } // namespace v8::internal | 15997 } } // namespace v8::internal |
| OLD | NEW |