Reviewers: Michael Starzinger,
Message:
PTAL
Description:
Handlify JSProxy::Fix
Please review this at https://chromiumcodereview.appspot.com/23707007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/objects.h
M src/objects.cc
M src/runtime.cc
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
452c1d62d5ec673f30d6e9cb4549c80ce80fba4e..9584954a8918b621bba05331119f77dabcdab1cd
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3652,15 +3652,13 @@ MUST_USE_RESULT PropertyAttributes
JSProxy::GetElementAttributeWithHandler(
}
-void JSProxy::Fix() {
- Isolate* isolate = GetIsolate();
- HandleScope scope(isolate);
- Handle<JSProxy> self(this);
+void JSProxy::Fix(Handle<JSProxy> self) {
+ Isolate* isolate = self->GetIsolate();
// Save identity hash.
- MaybeObject* maybe_hash = GetIdentityHash(OMIT_CREATION);
+ Handle<Object> hash = JSProxy::GetIdentityHash(self, OMIT_CREATION);
- if (IsJSFunctionProxy()) {
+ if (self->IsJSFunctionProxy()) {
isolate->factory()->BecomeJSFunction(self);
// Code will be set on the JavaScript side.
} else {
@@ -3669,10 +3667,9 @@ void JSProxy::Fix() {
ASSERT(self->IsJSObject());
// Inherit identity, if it was present.
- Object* hash;
- if (maybe_hash->To<Object>(&hash) && hash->IsSmi()) {
+ if (hash->IsSmi()) {
Handle<JSObject> new_self(JSObject::cast(*self));
- isolate->factory()->SetIdentityHash(new_self, Smi::cast(hash));
+ isolate->factory()->SetIdentityHash(new_self, Smi::cast(*hash));
}
}
@@ -4747,6 +4744,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) {
Object* hash = this->hash();
if (!hash->IsSmi() && flag == ALLOW_CREATION) {
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
040664dc06641f4df917320456564869c86e8242..3fee5fe970a1e43882d0a301cd4704c6d1243802
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -9156,9 +9156,11 @@ class JSProxy: public JSReceiver {
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.
- void Fix();
+ static void Fix(Handle<JSProxy> proxy);
// Initializes the body after the handler slot.
inline void InitializeBody(int object_size, Object* value);
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
576098271b2d00bd3ee380f76ba85cff194b4eed..376df5308b02ea4f352a1667a78540f86f8de9a4
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -685,10 +685,10 @@ RUNTIME_FUNCTION(MaybeObject*,
Runtime_GetConstructTrap) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_Fix) {
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
ASSERT(args.length() == 1);
- CONVERT_ARG_CHECKED(JSProxy, proxy, 0);
- proxy->Fix();
+ CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0);
+ JSProxy::Fix(proxy);
return isolate->heap()->undefined_value();
}
--
--
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.