From 58deea0ad05147ff6a5789b55a6f29315d0630d6 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Feb 2015 06:38:54 -0800 Subject: [PATCH] Make it possible to define arguments for CompileFunctionInContext Also make sure that the function body really produces only one function literal. LOG=y BUG=none R=yangguo@chromium.org Review URL: https://codereview.chromium.org/925433002 Cr-Commit-Position: refs/heads/master@{#26617} --- include/v8.h | 3 +- src/api.cc | 108 +++++++++++++++++++++++++++++++++++++++++-- test/cctest/test-compiler.cc | 59 ++++++++++++++++++++++- 3 files changed, 162 insertions(+), 8 deletions(-) diff --git a/include/v8.h b/include/v8.h index 4fcbbc7..fa32ba3 100644 --- a/include/v8.h +++ b/include/v8.h @@ -1325,7 +1325,7 @@ class V8_EXPORT ScriptCompiler { * Compile a function for a given context. This is equivalent to running * * with (obj) { - * return function() { ... } + * return function(args) { ... } * } * * It is possible to specify multiple context extensions (obj in the above @@ -1333,6 +1333,7 @@ class V8_EXPORT ScriptCompiler { */ static Local CompileFunctionInContext( Isolate* isolate, Source* source, Local context, + size_t arguments_count, Local arguments[], size_t context_extension_count, Local context_extensions[]); private: diff --git a/src/api.cc b/src/api.cc index ec9978e..da1c0e7 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1651,14 +1651,104 @@ Local