Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 7c215c865ff02e140bdf1808258f6d0ecf061e77..f2dcc471fb085a3d30671c439fb7ac85f091b190 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1206,13 +1206,14 @@ Handle<JSFunction> Factory::NewFunction(Handle<Map> map, |
Handle<Context> context(isolate()->native_context()); |
Handle<SharedFunctionInfo> info = |
NewSharedFunctionInfo(name, code, map->is_constructor()); |
- DCHECK(is_sloppy(info->language_mode()) && |
- (map.is_identical_to(isolate()->sloppy_function_map()) || |
- map.is_identical_to( |
- isolate()->sloppy_function_without_prototype_map()) || |
- map.is_identical_to( |
- isolate()->sloppy_function_with_readonly_prototype_map()) || |
- map.is_identical_to(isolate()->strict_function_map()))); |
+ DCHECK(is_sloppy(info->language_mode())); |
+ DCHECK( |
+ map.is_identical_to(isolate()->sloppy_function_map()) || |
+ map.is_identical_to(isolate()->sloppy_function_without_prototype_map()) || |
+ map.is_identical_to( |
+ isolate()->sloppy_function_with_readonly_prototype_map()) || |
+ map.is_identical_to(isolate()->strict_function_map()) || |
+ map.is_identical_to(isolate()->proxy_function_map())); |
return NewFunction(map, info, context); |
} |
@@ -1941,7 +1942,16 @@ Handle<JSDataView> Factory::NewJSDataView(Handle<JSArrayBuffer> buffer, |
Handle<JSProxy> Factory::NewJSProxy(Handle<JSReceiver> target, |
Handle<JSReceiver> handler) { |
// Allocate the proxy object. |
- Handle<Map> map(isolate()->proxy_function()->initial_map()); |
+ Handle<Map> map; |
+ if (target->IsCallable()) { |
+ if (target->IsConstructor()) { |
+ map = Handle<Map>(isolate()->proxy_constructor_map()); |
+ } else { |
+ map = Handle<Map>(isolate()->proxy_callable_map()); |
+ } |
+ } else { |
+ map = Handle<Map>(isolate()->proxy_map()); |
+ } |
DCHECK(map->prototype()->IsNull()); |
Handle<JSProxy> result = New<JSProxy>(map, NEW_SPACE); |
result->set_target(*target); |