Commit 8b97a1c5 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Handlify JSProxy::Fix

R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/23707007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16452 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8292b68a
...@@ -3656,27 +3656,24 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetElementAttributeWithHandler( ...@@ -3656,27 +3656,24 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetElementAttributeWithHandler(
} }
void JSProxy::Fix() { void JSProxy::Fix(Handle<JSProxy> proxy) {
Isolate* isolate = GetIsolate(); Isolate* isolate = proxy->GetIsolate();
HandleScope scope(isolate);
Handle<JSProxy> self(this);
// Save identity hash. // Save identity hash.
MaybeObject* maybe_hash = GetIdentityHash(OMIT_CREATION); Handle<Object> hash = JSProxy::GetIdentityHash(proxy, OMIT_CREATION);
if (IsJSFunctionProxy()) { if (proxy->IsJSFunctionProxy()) {
isolate->factory()->BecomeJSFunction(self); isolate->factory()->BecomeJSFunction(proxy);
// Code will be set on the JavaScript side. // Code will be set on the JavaScript side.
} else { } else {
isolate->factory()->BecomeJSObject(self); isolate->factory()->BecomeJSObject(proxy);
} }
ASSERT(self->IsJSObject()); ASSERT(proxy->IsJSObject());
// Inherit identity, if it was present. // Inherit identity, if it was present.
Object* hash; if (hash->IsSmi()) {
if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) { isolate->factory()->SetIdentityHash(
Handle<JSObject> new_self(JSObject::cast(*self)); Handle<JSObject>::cast(proxy), Smi::cast(*hash));
isolate->factory()->SetIdentityHash(new_self, Smi::cast(hash));
} }
} }
...@@ -4754,6 +4751,12 @@ MaybeObject* JSObject::GetIdentityHash(CreationFlag flag) { ...@@ -4754,6 +4751,12 @@ MaybeObject* JSObject::GetIdentityHash(CreationFlag flag) {
} }
Handle<Object> JSProxy::GetIdentityHash(Handle<JSProxy> proxy,
CreationFlag flag) {
CALL_HEAP_FUNCTION(proxy->GetIsolate(), proxy->GetIdentityHash(flag), Object);
}
MaybeObject* JSProxy::GetIdentityHash(CreationFlag flag) { MaybeObject* JSProxy::GetIdentityHash(CreationFlag flag) {
Object* hash = this->hash(); Object* hash = this->hash();
if (!hash->IsSmi() && flag == ALLOW_CREATION) { if (!hash->IsSmi() && flag == ALLOW_CREATION) {
......
...@@ -9106,9 +9106,11 @@ class JSProxy: public JSReceiver { ...@@ -9106,9 +9106,11 @@ class JSProxy: public JSReceiver {
uint32_t index); uint32_t index);
MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag);
static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy,
CreationFlag flag);
// Turn this into an (empty) JSObject. // Turn this into an (empty) JSObject.
void Fix(); static void Fix(Handle<JSProxy> proxy);
// Initializes the body after the handler slot. // Initializes the body after the handler slot.
inline void InitializeBody(int object_size, Object* value); inline void InitializeBody(int object_size, Object* value);
......
...@@ -685,10 +685,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructTrap) { ...@@ -685,10 +685,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructTrap) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) { RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) {
SealHandleScope shs(isolate); HandleScope scope(isolate);
ASSERT(args.length() == 1); ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSProxy, proxy, 0); CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0);
proxy->Fix(); JSProxy::Fix(proxy);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment