Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: src/factory.cc

Issue 1499593003: [runtime] [proxy] Implementing [[Call]] (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updating comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698