Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index e35274d0aa72fee02ef44f2142943eeba45a7414..c941f536192ea8690cb7999ace08cb3ec6c4166f 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -85,7 +85,7 @@ MaybeObject* Object::ToObject(Context* global_context) { |
MaybeObject* Object::ToObject() { |
- if (IsJSObject()) { |
+ if (IsJSReceiver()) { |
return this; |
} else if (IsNumber()) { |
Isolate* isolate = Isolate::Current(); |
@@ -628,6 +628,7 @@ MaybeObject* Object::GetElementWithReceiver(Object* receiver, uint32_t index) { |
} else if (heap_object->IsBoolean()) { |
holder = global_context->boolean_function()->instance_prototype(); |
} else if (heap_object->IsJSProxy()) { |
+ // TODO(rossberg): do something |
return heap->undefined_value(); // For now... |
} else { |
// Undefined and null have no indexed properties. |
@@ -1173,6 +1174,12 @@ void HeapObject::HeapObjectShortPrint(StringStream* accumulator) { |
HeapNumber::cast(this)->HeapNumberPrint(accumulator); |
accumulator->Put('>'); |
break; |
+ case JS_PROXY_TYPE: |
+ accumulator->Add("<JSProxy>"); |
+ break; |
+ case JS_FUNCTION_PROXY_TYPE: |
+ accumulator->Add("<JSFunctionProxy>"); |
+ break; |
case FOREIGN_TYPE: |
accumulator->Add("<Foreign>"); |
break; |
@@ -1248,6 +1255,9 @@ void HeapObject::IterateBody(InstanceType type, int object_size, |
case JS_PROXY_TYPE: |
JSProxy::BodyDescriptor::IterateBody(this, v); |
break; |
+ case JS_FUNCTION_PROXY_TYPE: |
+ JSFunctionProxy::BodyDescriptor::IterateBody(this, v); |
+ break; |
case FOREIGN_TYPE: |
reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v); |
break; |
@@ -2369,9 +2379,13 @@ void JSProxy::Fix() { |
HandleScope scope(isolate); |
Handle<JSProxy> self(this); |
- isolate->factory()->BecomeJSObject(self); |
+ if (IsJSFunctionProxy()) { |
+ isolate->factory()->BecomeJSFunction(self); |
+ // Code will be set on the JavaScript side. |
+ } else { |
+ isolate->factory()->BecomeJSObject(self); |
+ } |
ASSERT(self->IsJSObject()); |
- // TODO(rossberg): recognize function proxies. |
} |