Revert "New Compilation API, part 1"

This reverts revision 19881.

Reason: WebKit build failure (will commit a fixed version shortly).

BUG=

Review URL: https://codereview.chromium.org/196793013

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19882 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
marja@chromium.org 2014-03-13 09:14:16 +00:00
parent 52c0098f0d
commit ee6b885d25
14 changed files with 294 additions and 435 deletions

View File

@ -108,7 +108,6 @@ class ObjectTemplate;
class Platform; class Platform;
class Primitive; class Primitive;
class RawOperationDescriptor; class RawOperationDescriptor;
class Script;
class Signature; class Signature;
class StackFrame; class StackFrame;
class StackTrace; class StackTrace;
@ -1147,16 +1146,86 @@ class ScriptOrigin {
/** /**
* A compiled JavaScript script, not yet tied to a Context. * A compiled JavaScript script.
*/ */
class V8_EXPORT UnboundScript { class V8_EXPORT Script {
public: public:
/** /**
* Binds the script to the currently entered context. * Compiles the specified script (context-independent).
*
* \param source Script source code.
* \param origin Script origin, owned by caller, no references are kept
* when New() returns
* \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
* using pre_data speeds compilation if it's done multiple times.
* Owned by caller, no references are kept when New() returns.
* \return Compiled script object (context independent; when run it
* will use the currently entered context).
*/ */
Local<Script> BindToCurrentContext(); static Local<Script> New(Handle<String> source,
ScriptOrigin* origin = NULL,
ScriptData* pre_data = NULL);
/**
* Compiles the specified script using the specified file name
* object (typically a string) as the script's origin.
*
* \param source Script source code.
* \param file_name file name object (typically a string) to be used
* as the script's origin.
* \return Compiled script object (context independent; when run it
* will use the currently entered context).
*/
static Local<Script> New(Handle<String> source,
Handle<Value> file_name);
/**
* Compiles the specified script (bound to current context).
*
* \param source Script source code.
* \param origin Script origin, owned by caller, no references are kept
* when Compile() returns
* \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
* using pre_data speeds compilation if it's done multiple times.
* Owned by caller, no references are kept when Compile() returns.
* \return Compiled script object, bound to the context that was active
* when this function was called. When run it will always use this
* context.
*/
static Local<Script> Compile(Handle<String> source,
ScriptOrigin* origin = NULL,
ScriptData* pre_data = NULL);
/**
* Compiles the specified script using the specified file name
* object (typically a string) as the script's origin.
*
* \param source Script source code.
* \param file_name File name to use as script's origin
* \return Compiled script object, bound to the context that was active
* when this function was called. When run it will always use this
* context.
*/
static Local<Script> Compile(Handle<String> source,
Handle<Value> file_name);
/**
* Runs the script returning the resulting value. If the script is
* context independent (created using ::New) it will be run in the
* currently entered context. If it is context specific (created
* using ::Compile) it will be run in the context in which it was
* compiled.
*/
Local<Value> Run();
/**
* Returns the script id.
*/
int GetId(); int GetId();
/**
* Returns the name value of one Script.
*/
Handle<Value> GetScriptName(); Handle<Value> GetScriptName();
/** /**
@ -1169,134 +1238,6 @@ class V8_EXPORT UnboundScript {
}; };
/**
* A compiled JavaScript script, tied to a Context which was active when the
* script was compiled.
*/
class V8_EXPORT Script {
public:
/**
* A shorthand for ScriptCompiler::CompileBound().
*/
static Local<Script> Compile(Handle<String> source,
ScriptOrigin* origin = NULL);
// To be decprecated, use the Compile above.
static Local<Script> Compile(Handle<String> source,
Handle<String> file_name);
/**
* Runs the script returning the resulting value. It will be run in the
* context in which it was created (ScriptCompiler::CompileBound or
* UnboundScript::BindToGlobalContext()).
*/
Local<Value> Run();
/**
* Returns the corresponding context-unbound script.
*/
Local<UnboundScript> GetUnboundScript();
// To be deprecated; use GetUnboundScript()->GetId();
int GetId() {
return GetUnboundScript()->GetId();
}
// Use GetUnboundScript()->GetId();
V8_DEPRECATED("Use GetUnboundScript()->GetId()",
Handle<Value> GetScriptName()) {
return GetUnboundScript()->GetScriptName();
}
/**
* Returns zero based line number of the code_pos location in the script.
* -1 will be returned if no information available.
*/
V8_DEPRECATED("Use GetUnboundScript()->GetLineNumber()",
int GetLineNumber(int code_pos)) {
return GetUnboundScript()->GetLineNumber(code_pos);
}
};
/**
* For compiling scripts.
*/
class V8_EXPORT ScriptCompiler {
public:
/**
* Compilation data that the embedder can cache and pass back to speed up
* future compilations. The data is produced if the CompilerOptions passed to
* the compilation functions in ScriptCompiler contains produce_data_to_cache
* = true. The data to cache can then can be retrieved from
* UnboundScript.
*/
struct V8_EXPORT CachedData {
CachedData() : data(NULL), length(0) {}
// Caller keeps the ownership of data and guarantees that the data stays
// alive long enough.
CachedData(const uint8_t* data, int length) : data(data), length(length) {}
// TODO(marja): Async compilation; add constructors which take a callback
// which will be called when V8 no longer needs the data.
const uint8_t* data;
int length;
};
/**
* Source code which can be then compiled to a UnboundScript or
* BoundScript.
*/
struct V8_EXPORT Source {
Source(Local<String> source_string, const ScriptOrigin& origin,
const CachedData& cached_data = CachedData());
Source(Local<String> source_string,
const CachedData& cached_data = CachedData());
Local<String> source_string;
// Origin information
Handle<Value> resource_name;
Handle<Integer> resource_line_offset;
Handle<Integer> resource_column_offset;
Handle<Boolean> resource_is_shared_cross_origin;
// Cached data from previous compilation (if any).
CachedData cached_data;
};
enum CompileOptions {
kNoCompileOptions,
kProduceDataToCache = 1 << 0
};
/**
* Compiles the specified script (context-independent).
*
* \param source Script source code.
* \return Compiled script object (context independent; for running it must be
* bound to a context).
*/
static Local<UnboundScript> CompileUnbound(
Isolate* isolate, const Source& source,
CompileOptions options = kNoCompileOptions);
/**
* Compiles the specified script (bound to current context).
*
* \param source Script source code.
* \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
* using pre_data speeds compilation if it's done multiple times.
* Owned by caller, no references are kept when this function returns.
* \return Compiled script object, bound to the context that was active
* when this function was called. When run it will always use this
* context.
*/
static Local<Script> Compile(
Isolate* isolate, const Source& source,
CompileOptions options = kNoCompileOptions);
};
/** /**
* An error message. * An error message.
*/ */

View File

@ -238,8 +238,7 @@ int RunMain(int argc, char* argv[]) {
{ {
// Compile script in try/catch context. // Compile script in try/catch context.
v8::TryCatch try_catch; v8::TryCatch try_catch;
v8::ScriptOrigin origin(script_name); script = v8::Script::Compile(script_source, script_name);
script = v8::Script::Compile(script_source, &origin);
if (script.IsEmpty()) { if (script.IsEmpty()) {
// Print errors that happened during compilation. // Print errors that happened during compilation.
if (report_exceptions) if (report_exceptions)

View File

@ -304,8 +304,7 @@ bool ExecuteString(v8::Isolate* isolate,
bool report_exceptions) { bool report_exceptions) {
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::TryCatch try_catch; v8::TryCatch try_catch;
v8::ScriptOrigin origin(name); v8::Handle<v8::Script> script = v8::Script::Compile(source, name);
v8::Handle<v8::Script> script = v8::Script::Compile(source, &origin);
if (script.IsEmpty()) { if (script.IsEmpty()) {
// Print errors that happened during compilation. // Print errors that happened during compilation.
if (report_exceptions) if (report_exceptions)

View File

@ -1611,135 +1611,16 @@ ScriptData* ScriptData::New(const char* data, int length) {
} }
// --- S c r i p t s --- // --- S c r i p t ---
// Internally, UnboundScript is a SharedFunctionInfo, and Script is a Local<Script> Script::New(v8::Handle<String> source,
// JSFunction. v8::ScriptOrigin* origin,
v8::ScriptData* pre_data) {
ScriptCompiler::Source::Source(Local<String> string, const ScriptOrigin& origin, i::Handle<i::String> str = Utils::OpenHandle(*source);
const CachedData& data) i::Isolate* isolate = str->GetIsolate();
: source_string(string), ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>());
resource_name(origin.ResourceName()), LOG_API(isolate, "Script::New");
resource_line_offset(origin.ResourceLineOffset()),
resource_column_offset(origin.ResourceColumnOffset()),
resource_is_shared_cross_origin(origin.ResourceIsSharedCrossOrigin()),
cached_data(data) {}
ScriptCompiler::Source::Source(Local<String> string,
const CachedData& data)
: source_string(string), cached_data(data) {}
Local<Script> UnboundScript::BindToCurrentContext() {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Handle<i::SharedFunctionInfo>
function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate());
i::Handle<i::JSFunction> function =
obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo(
function_info, obj->GetIsolate()->global_context());
return ToApiHandle<Script>(function);
}
int UnboundScript::GetId() {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::UnboundScript::GetId()", return -1);
LOG_API(isolate, "v8::UnboundScript::GetId");
{
i::HandleScope scope(isolate);
i::Handle<i::SharedFunctionInfo> function_info(
i::SharedFunctionInfo::cast(*obj));
i::Handle<i::Script> script(i::Script::cast(function_info->script()));
return script->id()->value();
}
}
int UnboundScript::GetLineNumber(int code_pos) {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::UnboundScript::GetLineNumber()", return -1);
LOG_API(isolate, "UnboundScript::GetLineNumber");
if (obj->IsScript()) {
i::Handle<i::Script> script(i::Script::cast(*obj));
return i::GetScriptLineNumber(script, code_pos);
} else {
return -1;
}
}
Handle<Value> UnboundScript::GetScriptName() {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::UnboundScript::GetName()",
return Handle<String>());
LOG_API(isolate, "UnboundScript::GetName");
if (obj->IsScript()) {
i::Object* name = i::Script::cast(*obj)->name();
return Utils::ToLocal(i::Handle<i::Object>(name, isolate));
} else {
return Handle<String>();
}
}
Local<Value> Script::Run() {
// If execution is terminating, Compile(..)->Run() requires this
// check.
if (this == NULL) return Local<Value>();
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
LOG_API(isolate, "Script::Run");
ENTER_V8(isolate);
i::Logger::TimerEventScope timer_scope(
isolate, i::Logger::TimerEventScope::v8_execute);
i::Object* raw_result = NULL;
{
i::HandleScope scope(isolate);
i::Handle<i::JSFunction> fun =
i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> receiver(
isolate->context()->global_proxy(), isolate);
i::Handle<i::Object> result = i::Execution::Call(
isolate, fun, receiver, 0, NULL, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>());
raw_result = *result;
}
i::Handle<i::Object> result(raw_result, isolate);
return Utils::ToLocal(result);
}
Local<UnboundScript> Script::GetUnboundScript() {
i::Handle<i::Object> obj = Utils::OpenHandle(this);
return ToApiHandle<UnboundScript>(
i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared()));
}
Local<UnboundScript> ScriptCompiler::CompileUnbound(
Isolate* v8_isolate,
const Source& source,
CompileOptions options) {
// FIXME(marja): This function cannot yet create cached data (if options |
// produce_data_to_cache is true), but the PreCompile function is still there
// for doing it.
i::Handle<i::String> str = Utils::OpenHandle(*(source.source_string));
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ON_BAILOUT(isolate, "v8::ScriptCompiler::CompileUnbound()",
return Local<UnboundScript>());
LOG_API(isolate, "ScriptCompiler::CompileUnbound");
ENTER_V8(isolate); ENTER_V8(isolate);
i::SharedFunctionInfo* raw_result = NULL; i::SharedFunctionInfo* raw_result = NULL;
{ i::HandleScope scope(isolate); { i::HandleScope scope(isolate);
@ -1747,35 +1628,31 @@ Local<UnboundScript> ScriptCompiler::CompileUnbound(
int line_offset = 0; int line_offset = 0;
int column_offset = 0; int column_offset = 0;
bool is_shared_cross_origin = false; bool is_shared_cross_origin = false;
if (!source.resource_name.IsEmpty()) { if (origin != NULL) {
name_obj = Utils::OpenHandle(*source.resource_name); if (!origin->ResourceName().IsEmpty()) {
} name_obj = Utils::OpenHandle(*origin->ResourceName());
if (!source.resource_line_offset.IsEmpty()) { }
line_offset = static_cast<int>(source.resource_line_offset->Value()); if (!origin->ResourceLineOffset().IsEmpty()) {
} line_offset = static_cast<int>(origin->ResourceLineOffset()->Value());
if (!source.resource_column_offset.IsEmpty()) { }
column_offset = if (!origin->ResourceColumnOffset().IsEmpty()) {
static_cast<int>(source.resource_column_offset->Value()); column_offset =
} static_cast<int>(origin->ResourceColumnOffset()->Value());
if (!source.resource_is_shared_cross_origin.IsEmpty()) { }
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); if (!origin->ResourceIsSharedCrossOrigin().IsEmpty()) {
is_shared_cross_origin = v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
source.resource_is_shared_cross_origin == v8::True(v8_isolate); is_shared_cross_origin =
origin->ResourceIsSharedCrossOrigin() == v8::True(v8_isolate);
}
} }
EXCEPTION_PREAMBLE(isolate); EXCEPTION_PREAMBLE(isolate);
i::ScriptDataImpl* pre_data_impl = NULL; i::ScriptDataImpl* pre_data_impl =
if (source.cached_data.data) { static_cast<i::ScriptDataImpl*>(pre_data);
// FIXME(marja): Make compiler use CachedData directly.
pre_data_impl = static_cast<i::ScriptDataImpl*>(ScriptData::New(
reinterpret_cast<const char*>(source.cached_data.data),
source.cached_data.length));
}
// We assert that the pre-data is sane, even though we can actually // We assert that the pre-data is sane, even though we can actually
// handle it if it turns out not to be in release mode. // handle it if it turns out not to be in release mode.
ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck()); ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck());
// If the pre-data isn't sane we simply ignore it // If the pre-data isn't sane we simply ignore it
if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) { if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) {
delete pre_data_impl;
pre_data_impl = NULL; pre_data_impl = NULL;
} }
i::Handle<i::SharedFunctionInfo> result = i::Handle<i::SharedFunctionInfo> result =
@ -1789,52 +1666,145 @@ Local<UnboundScript> ScriptCompiler::CompileUnbound(
pre_data_impl, pre_data_impl,
i::NOT_NATIVES_CODE); i::NOT_NATIVES_CODE);
has_pending_exception = result.is_null(); has_pending_exception = result.is_null();
EXCEPTION_BAILOUT_CHECK(isolate, Local<UnboundScript>()); EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>());
raw_result = *result; raw_result = *result;
delete pre_data_impl;
} }
i::Handle<i::SharedFunctionInfo> result(raw_result, isolate); i::Handle<i::SharedFunctionInfo> result(raw_result, isolate);
return ToApiHandle<UnboundScript>(result); return ToApiHandle<Script>(result);
} }
Local<Script> ScriptCompiler::Compile( Local<Script> Script::New(v8::Handle<String> source,
Isolate* v8_isolate, v8::Handle<Value> file_name) {
const Source& source, ScriptOrigin origin(file_name);
CompileOptions options) { return New(source, &origin);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ON_BAILOUT(isolate, "v8::ScriptCompiler::Compile()",
return Local<Script>());
LOG_API(isolate, "ScriptCompiler::CompiletBound()");
ENTER_V8(isolate);
Local<UnboundScript> generic =
CompileUnbound(v8_isolate, source, options);
if (generic.IsEmpty()) return Local<Script>();
return generic->BindToCurrentContext();
} }
Local<Script> Script::Compile(v8::Handle<String> source, Local<Script> Script::Compile(v8::Handle<String> source,
v8::ScriptOrigin* origin) { v8::ScriptOrigin* origin,
v8::ScriptData* pre_data) {
i::Handle<i::String> str = Utils::OpenHandle(*source); i::Handle<i::String> str = Utils::OpenHandle(*source);
if (origin) { i::Isolate* isolate = str->GetIsolate();
return ScriptCompiler::Compile( ON_BAILOUT(isolate, "v8::Script::Compile()", return Local<Script>());
reinterpret_cast<v8::Isolate*>(str->GetIsolate()), LOG_API(isolate, "Script::Compile");
ScriptCompiler::Source(source, *origin)); ENTER_V8(isolate);
} Local<Script> generic = New(source, origin, pre_data);
return ScriptCompiler::Compile( if (generic.IsEmpty())
reinterpret_cast<v8::Isolate*>(str->GetIsolate()), return generic;
ScriptCompiler::Source(source)); i::Handle<i::Object> obj = Utils::OpenHandle(*generic);
i::Handle<i::SharedFunctionInfo> function =
i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj));
i::Handle<i::JSFunction> result =
isolate->factory()->NewFunctionFromSharedFunctionInfo(
function,
isolate->global_context());
return ToApiHandle<Script>(result);
} }
Local<Script> Script::Compile(v8::Handle<String> source, Local<Script> Script::Compile(v8::Handle<String> source,
v8::Handle<String> file_name) { v8::Handle<Value> file_name) {
ScriptOrigin origin(file_name); ScriptOrigin origin(file_name);
return Compile(source, &origin); return Compile(source, &origin);
} }
Local<Value> Script::Run() {
// If execution is terminating, Compile(script)->Run() requires this check.
if (this == NULL) return Local<Value>();
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::Script::Run()", return Local<Value>());
LOG_API(isolate, "Script::Run");
ENTER_V8(isolate);
i::Logger::TimerEventScope timer_scope(
isolate, i::Logger::TimerEventScope::v8_execute);
i::Object* raw_result = NULL;
{
i::HandleScope scope(isolate);
i::Handle<i::JSFunction> fun;
if (obj->IsSharedFunctionInfo()) {
i::Handle<i::SharedFunctionInfo>
function_info(i::SharedFunctionInfo::cast(*obj), isolate);
fun = isolate->factory()->NewFunctionFromSharedFunctionInfo(
function_info, isolate->global_context());
} else {
fun = i::Handle<i::JSFunction>(i::JSFunction::cast(*obj), isolate);
}
EXCEPTION_PREAMBLE(isolate);
i::Handle<i::Object> receiver(
isolate->context()->global_proxy(), isolate);
i::Handle<i::Object> result = i::Execution::Call(
isolate, fun, receiver, 0, NULL, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local<Value>());
raw_result = *result;
}
i::Handle<i::Object> result(raw_result, isolate);
return Utils::ToLocal(result);
}
static i::Handle<i::SharedFunctionInfo> OpenScript(Script* script) {
i::Handle<i::Object> obj = Utils::OpenHandle(script);
i::Handle<i::SharedFunctionInfo> result;
if (obj->IsSharedFunctionInfo()) {
result =
i::Handle<i::SharedFunctionInfo>(i::SharedFunctionInfo::cast(*obj));
} else {
result =
i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared());
}
return result;
}
int Script::GetId() {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::Script::Id()", return -1);
LOG_API(isolate, "Script::Id");
{
i::HandleScope scope(isolate);
i::Handle<i::SharedFunctionInfo> function_info = OpenScript(this);
i::Handle<i::Script> script(i::Script::cast(function_info->script()));
return script->id()->value();
}
}
int Script::GetLineNumber(int code_pos) {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::Script::GetLineNumber()", return -1);
LOG_API(isolate, "Script::GetLineNumber");
if (obj->IsScript()) {
i::Handle<i::Script> script = i::Handle<i::Script>(i::Script::cast(*obj));
return i::GetScriptLineNumber(script, code_pos);
} else {
return -1;
}
}
Handle<Value> Script::GetScriptName() {
i::Handle<i::HeapObject> obj =
i::Handle<i::HeapObject>::cast(Utils::OpenHandle(this));
i::Isolate* isolate = obj->GetIsolate();
ON_BAILOUT(isolate, "v8::Script::GetName()", return Handle<String>());
LOG_API(isolate, "Script::GetName");
if (obj->IsScript()) {
i::Object* name = i::Script::cast(*obj)->name();
return Utils::ToLocal(i::Handle<i::Object>(name, isolate));
} else {
return Handle<String>();
}
}
// --- E x c e p t i o n s --- // --- E x c e p t i o n s ---
@ -4058,9 +4028,7 @@ bool Function::IsBuiltin() const {
int Function::ScriptId() const { int Function::ScriptId() const {
i::Handle<i::JSFunction> func = Utils::OpenHandle(this); i::Handle<i::JSFunction> func = Utils::OpenHandle(this);
if (!func->shared()->script()->IsScript()) { if (!func->shared()->script()->IsScript()) return v8::Script::kNoScriptId;
return v8::UnboundScript::kNoScriptId;
}
i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); i::Handle<i::Script> script(i::Script::cast(func->shared()->script()));
return script->id()->value(); return script->id()->value();
} }

View File

@ -183,8 +183,7 @@ class RegisteredExtension {
V(DataView, JSDataView) \ V(DataView, JSDataView) \
V(String, String) \ V(String, String) \
V(Symbol, Symbol) \ V(Symbol, Symbol) \
V(Script, JSFunction) \ V(Script, Object) \
V(UnboundScript, SharedFunctionInfo) \
V(Function, JSFunction) \ V(Function, JSFunction) \
V(Message, JSObject) \ V(Message, JSObject) \
V(Context, Context) \ V(Context, Context) \

View File

@ -205,9 +205,7 @@ bool Shell::ExecuteString(Isolate* isolate,
// When debugging make exceptions appear to be uncaught. // When debugging make exceptions appear to be uncaught.
try_catch.SetVerbose(true); try_catch.SetVerbose(true);
} }
ScriptOrigin origin(name); Handle<Script> script = Script::New(source, name);
Handle<UnboundScript> script = ScriptCompiler::CompileUnbound(
isolate, ScriptCompiler::Source(source, origin));
if (script.IsEmpty()) { if (script.IsEmpty()) {
// Print errors that happened during compilation. // Print errors that happened during compilation.
if (report_exceptions && !FLAG_debugger) if (report_exceptions && !FLAG_debugger)
@ -218,7 +216,7 @@ bool Shell::ExecuteString(Isolate* isolate,
Local<Context> realm = Local<Context> realm =
Local<Context>::New(isolate, data->realms_[data->realm_current_]); Local<Context>::New(isolate, data->realms_[data->realm_current_]);
realm->Enter(); realm->Enter();
Handle<Value> result = script->BindToCurrentContext()->Run(); Handle<Value> result = script->Run();
realm->Exit(); realm->Exit();
data->realm_current_ = data->realm_switch_; data->realm_current_ = data->realm_switch_;
if (result.IsEmpty()) { if (result.IsEmpty()) {
@ -407,12 +405,11 @@ void Shell::RealmEval(const v8::FunctionCallbackInfo<v8::Value>& args) {
Throw(args.GetIsolate(), "Invalid argument"); Throw(args.GetIsolate(), "Invalid argument");
return; return;
} }
Handle<UnboundScript> script = ScriptCompiler::CompileUnbound( Handle<Script> script = Script::New(args[1]->ToString());
isolate, ScriptCompiler::Source(args[1]->ToString()));
if (script.IsEmpty()) return; if (script.IsEmpty()) return;
Local<Context> realm = Local<Context>::New(isolate, data->realms_[index]); Local<Context> realm = Local<Context>::New(isolate, data->realms_[index]);
realm->Enter(); realm->Enter();
Handle<Value> result = script->BindToCurrentContext()->Run(); Handle<Value> result = script->Run();
realm->Exit(); realm->Exit();
args.GetReturnValue().Set(result); args.GetReturnValue().Set(result);
} }
@ -809,8 +806,7 @@ void Shell::InstallUtilityScript(Isolate* isolate) {
Handle<String> name = Handle<String> name =
String::NewFromUtf8(isolate, shell_source_name.start(), String::NewFromUtf8(isolate, shell_source_name.start(),
String::kNormalString, shell_source_name.length()); String::kNormalString, shell_source_name.length());
ScriptOrigin origin(name); Handle<Script> script = Script::Compile(source, name);
Handle<Script> script = Script::Compile(source, &origin);
script->Run(); script->Run();
// Mark the d8 shell script as native to avoid it showing up as normal source // Mark the d8 shell script as native to avoid it showing up as normal source
// in the debugger. // in the debugger.

View File

@ -3347,7 +3347,7 @@ bool Heap::CreateInitialObjects() {
set_materialized_objects(FixedArray::cast(obj)); set_materialized_objects(FixedArray::cast(obj));
// Handling of script id generation is in Factory::NewScript. // Handling of script id generation is in Factory::NewScript.
set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); set_last_script_id(Smi::FromInt(v8::Script::kNoScriptId));
{ MaybeObject* maybe_obj = AllocateAllocationSitesScratchpad(); { MaybeObject* maybe_obj = AllocateAllocationSitesScratchpad();
if (!maybe_obj->ToObject(&obj)) return false; if (!maybe_obj->ToObject(&obj)) return false;

View File

@ -47,7 +47,7 @@ CodeEntry::CodeEntry(Logger::LogEventsAndTags tag,
line_number_(line_number), line_number_(line_number),
column_number_(column_number), column_number_(column_number),
shared_id_(0), shared_id_(0),
script_id_(v8::UnboundScript::kNoScriptId), script_id_(v8::Script::kNoScriptId),
no_frame_ranges_(NULL), no_frame_ranges_(NULL),
bailout_reason_(kEmptyBailoutReason) { } bailout_reason_(kEmptyBailoutReason) { }

View File

@ -313,23 +313,17 @@ static inline v8::Local<v8::Script> v8_compile(v8::Local<v8::String> x) {
} }
static inline v8::Local<v8::Script> CompileWithOrigin( static inline v8::Local<v8::Script> CompileWithOrigin(const char* source,
v8::Local<v8::String> source, v8::Local<v8::String> origin_url) { const char* origin_url) {
v8::ScriptOrigin origin(origin_url); v8::ScriptOrigin origin(v8_str(origin_url));
return v8::ScriptCompiler::Compile( return v8::Script::Compile(v8_str(source), &origin);
v8::Isolate::GetCurrent(), v8::ScriptCompiler::Source(source, origin));
} }
static inline v8::Local<v8::Script> CompileWithOrigin( static inline v8::Local<v8::Script> CompileWithOrigin(
v8::Local<v8::String> source, const char* origin_url) { v8::Local<v8::String> source, const char* origin_url) {
return CompileWithOrigin(source, v8_str(origin_url)); v8::ScriptOrigin origin(v8_str(origin_url));
} return v8::Script::Compile(source, &origin);
static inline v8::Local<v8::Script> CompileWithOrigin(const char* source,
const char* origin_url) {
return CompileWithOrigin(v8_str(source), v8_str(origin_url));
} }
@ -345,16 +339,11 @@ static inline v8::Local<v8::Value> CompileRun(v8::Local<v8::String> source) {
static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) { static inline v8::Local<v8::Value> PreCompileCompileRun(const char* source) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Local<v8::String> script_source =
v8::Local<v8::String> source_string = v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), source);
v8::String::NewFromUtf8(isolate, source); v8::ScriptData* preparse = v8::ScriptData::PreCompile(script_source);
v8::ScriptData* preparse = v8::ScriptData::PreCompile(source_string); v8::Local<v8::Script> script =
v8::ScriptCompiler::Source script_source( v8::Script::Compile(script_source, NULL, preparse);
source_string, v8::ScriptCompiler::CachedData(
reinterpret_cast<const uint8_t*>(preparse->Data()),
preparse->Length()));
v8::Local<v8::Script> script = v8::ScriptCompiler::Compile(
isolate, v8::ScriptCompiler::Source(script_source));
v8::Local<v8::Value> result = script->Run(); v8::Local<v8::Value> result = script->Run();
delete preparse; delete preparse;
return result; return result;
@ -370,24 +359,14 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(const char* source,
v8::ScriptOrigin origin(v8_str(origin_url), v8::ScriptOrigin origin(v8_str(origin_url),
v8::Integer::New(isolate, line_number), v8::Integer::New(isolate, line_number),
v8::Integer::New(isolate, column_number)); v8::Integer::New(isolate, column_number));
return v8::ScriptCompiler::Compile( return v8::Script::Compile(v8_str(source), &origin)->Run();
isolate, v8::ScriptCompiler::Source(v8_str(source), origin))
->Run();
}
static inline v8::Local<v8::Value> CompileRunWithOrigin(
v8::Local<v8::String> source, const char* origin_url) {
v8::ScriptOrigin origin(v8_str(origin_url));
return v8::ScriptCompiler::Compile(
v8::Isolate::GetCurrent(),
v8::ScriptCompiler::Source(source, origin))->Run();
} }
static inline v8::Local<v8::Value> CompileRunWithOrigin( static inline v8::Local<v8::Value> CompileRunWithOrigin(
const char* source, const char* origin_url) { const char* source, const char* origin_url) {
return CompileRunWithOrigin(v8_str(source), origin_url); v8::ScriptOrigin origin(v8_str(origin_url));
return v8::Script::Compile(v8_str(source), &origin)->Run();
} }

View File

@ -14952,13 +14952,8 @@ TEST(PreCompileInvalidPreparseDataError) {
sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0; sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0;
v8::TryCatch try_catch; v8::TryCatch try_catch;
v8::ScriptCompiler::Source script_source( Local<String> source = String::NewFromUtf8(isolate, script);
String::NewFromUtf8(isolate, script), Local<Script> compiled_script = Script::New(source, NULL, sd);
v8::ScriptCompiler::CachedData(
reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
Local<v8::UnboundScript> compiled_script =
v8::ScriptCompiler::CompileUnbound(isolate, script_source);
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Message()->Get()); String::Utf8Value exception_value(try_catch.Message()->Get());
CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar", CHECK_EQ("Uncaught SyntaxError: Invalid preparser data for function bar",
@ -14975,12 +14970,7 @@ TEST(PreCompileInvalidPreparseDataError) {
sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data())); sd_data = reinterpret_cast<unsigned*>(const_cast<char*>(sd->Data()));
sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] = sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryStartOffset] =
200; 200;
v8::ScriptCompiler::Source script_source2( compiled_script = Script::New(source, NULL, sd);
String::NewFromUtf8(isolate, script),
v8::ScriptCompiler::CachedData(
reinterpret_cast<const uint8_t*>(sd->Data()), sd->Length()));
compiled_script =
v8::ScriptCompiler::CompileUnbound(isolate, script_source2);
CHECK(!try_catch.HasCaught()); CHECK(!try_catch.HasCaught());
delete sd; delete sd;
@ -17091,19 +17081,17 @@ THREADED_TEST(ScriptContextDependence) {
const char *source = "foo"; const char *source = "foo";
v8::Handle<v8::Script> dep = v8::Handle<v8::Script> dep =
v8_compile(source); v8_compile(source);
v8::Handle<v8::UnboundScript> indep = v8::Handle<v8::Script> indep =
v8::ScriptCompiler::CompileUnbound( v8::Script::New(v8::String::NewFromUtf8(c1->GetIsolate(), source));
c1->GetIsolate(), v8::ScriptCompiler::Source(v8::String::NewFromUtf8(
c1->GetIsolate(), source)));
c1->Global()->Set(v8::String::NewFromUtf8(c1->GetIsolate(), "foo"), c1->Global()->Set(v8::String::NewFromUtf8(c1->GetIsolate(), "foo"),
v8::Integer::New(c1->GetIsolate(), 100)); v8::Integer::New(c1->GetIsolate(), 100));
CHECK_EQ(dep->Run()->Int32Value(), 100); CHECK_EQ(dep->Run()->Int32Value(), 100);
CHECK_EQ(indep->BindToCurrentContext()->Run()->Int32Value(), 100); CHECK_EQ(indep->Run()->Int32Value(), 100);
LocalContext c2; LocalContext c2;
c2->Global()->Set(v8::String::NewFromUtf8(c2->GetIsolate(), "foo"), c2->Global()->Set(v8::String::NewFromUtf8(c2->GetIsolate(), "foo"),
v8::Integer::New(c2->GetIsolate(), 101)); v8::Integer::New(c2->GetIsolate(), 101));
CHECK_EQ(dep->Run()->Int32Value(), 100); CHECK_EQ(dep->Run()->Int32Value(), 100);
CHECK_EQ(indep->BindToCurrentContext()->Run()->Int32Value(), 101); CHECK_EQ(indep->Run()->Int32Value(), 101);
} }
@ -17116,11 +17104,7 @@ THREADED_TEST(StackTrace) {
v8::String::NewFromUtf8(context->GetIsolate(), source); v8::String::NewFromUtf8(context->GetIsolate(), source);
v8::Handle<v8::String> origin = v8::Handle<v8::String> origin =
v8::String::NewFromUtf8(context->GetIsolate(), "stack-trace-test"); v8::String::NewFromUtf8(context->GetIsolate(), "stack-trace-test");
v8::ScriptCompiler::CompileUnbound( v8::Script::New(src, origin)->Run();
context->GetIsolate(),
v8::ScriptCompiler::Source(src, v8::ScriptOrigin(origin)))
->BindToCurrentContext()
->Run();
CHECK(try_catch.HasCaught()); CHECK(try_catch.HasCaught());
v8::String::Utf8Value stack(try_catch.StackTrace()); v8::String::Utf8Value stack(try_catch.StackTrace());
CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL); CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL);
@ -17227,11 +17211,7 @@ TEST(CaptureStackTrace) {
v8::Handle<v8::String> overview_src = v8::Handle<v8::String> overview_src =
v8::String::NewFromUtf8(isolate, overview_source); v8::String::NewFromUtf8(isolate, overview_source);
v8::Handle<Value> overview_result( v8::Handle<Value> overview_result(
v8::ScriptCompiler::CompileUnbound( v8::Script::New(overview_src, origin)->Run());
isolate,
v8::ScriptCompiler::Source(overview_src, v8::ScriptOrigin(origin)))
->BindToCurrentContext()
->Run());
CHECK(!overview_result.IsEmpty()); CHECK(!overview_result.IsEmpty());
CHECK(overview_result->IsObject()); CHECK(overview_result->IsObject());
@ -17250,11 +17230,9 @@ TEST(CaptureStackTrace) {
v8::Handle<v8::Integer> line_offset = v8::Integer::New(isolate, 3); v8::Handle<v8::Integer> line_offset = v8::Integer::New(isolate, 3);
v8::Handle<v8::Integer> column_offset = v8::Integer::New(isolate, 5); v8::Handle<v8::Integer> column_offset = v8::Integer::New(isolate, 5);
v8::ScriptOrigin detailed_origin(origin, line_offset, column_offset); v8::ScriptOrigin detailed_origin(origin, line_offset, column_offset);
v8::Handle<v8::UnboundScript> detailed_script( v8::Handle<v8::Script> detailed_script(
v8::ScriptCompiler::CompileUnbound( v8::Script::New(detailed_src, &detailed_origin));
isolate, v8::ScriptCompiler::Source(detailed_src, detailed_origin))); v8::Handle<Value> detailed_result(detailed_script->Run());
v8::Handle<Value> detailed_result(
detailed_script->BindToCurrentContext()->Run());
CHECK(!detailed_result.IsEmpty()); CHECK(!detailed_result.IsEmpty());
CHECK(detailed_result->IsObject()); CHECK(detailed_result->IsObject());
} }

View File

@ -1495,16 +1495,20 @@ TEST(FunctionDetails) {
v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION); v8::Local<v8::Context> env = CcTest::NewContext(PROFILER_EXTENSION);
v8::Context::Scope context_scope(env); v8::Context::Scope context_scope(env);
v8::Handle<v8::Script> script_a = CompileWithOrigin( v8::Handle<v8::Script> script_a = v8::Script::Compile(
v8::String::NewFromUtf8(
env->GetIsolate(),
" function foo\n() { try { bar(); } catch(e) {} }\n" " function foo\n() { try { bar(); } catch(e) {} }\n"
" function bar() { startProfiling(); }\n", " function bar() { startProfiling(); }\n"),
"script_a"); v8::String::NewFromUtf8(env->GetIsolate(), "script_a"));
script_a->Run(); script_a->Run();
v8::Handle<v8::Script> script_b = CompileWithOrigin( v8::Handle<v8::Script> script_b = v8::Script::Compile(
v8::String::NewFromUtf8(
env->GetIsolate(),
"\n\n function baz() { try { foo(); } catch(e) {} }\n" "\n\n function baz() { try { foo(); } catch(e) {} }\n"
"\n\nbaz();\n" "\n\nbaz();\n"
"stopProfiling();\n", "stopProfiling();\n"),
"script_b"); v8::String::NewFromUtf8(env->GetIsolate(), "script_b"));
script_b->Run(); script_b->Run();
const v8::CpuProfile* profile = i::ProfilerExtension::last_profile; const v8::CpuProfile* profile = i::ProfilerExtension::last_profile;
const v8::CpuProfileNode* current = profile->GetTopDownRoot(); const v8::CpuProfileNode* current = profile->GetTopDownRoot();

View File

@ -2218,7 +2218,8 @@ TEST(ScriptBreakPointLineTopLevel) {
v8::Local<v8::Function> f; v8::Local<v8::Function> f;
{ {
v8::HandleScope scope(env->GetIsolate()); v8::HandleScope scope(env->GetIsolate());
CompileRunWithOrigin(script, "test.html"); v8::Script::Compile(
script, v8::String::NewFromUtf8(env->GetIsolate(), "test.html"))->Run();
} }
f = v8::Local<v8::Function>::Cast( f = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
@ -2234,7 +2235,8 @@ TEST(ScriptBreakPointLineTopLevel) {
// Recompile and run script and check that break point was hit. // Recompile and run script and check that break point was hit.
break_point_hit_count = 0; break_point_hit_count = 0;
CompileRunWithOrigin(script, "test.html"); v8::Script::Compile(
script, v8::String::NewFromUtf8(env->GetIsolate(), "test.html"))->Run();
CHECK_EQ(1, break_point_hit_count); CHECK_EQ(1, break_point_hit_count);
// Call f and check that there are still no break points. // Call f and check that there are still no break points.
@ -2269,7 +2271,9 @@ TEST(ScriptBreakPointTopLevelCrash) {
{ {
v8::HandleScope scope(env->GetIsolate()); v8::HandleScope scope(env->GetIsolate());
break_point_hit_count = 0; break_point_hit_count = 0;
CompileRunWithOrigin(script_source, "test.html"); v8::Script::Compile(script_source,
v8::String::NewFromUtf8(env->GetIsolate(), "test.html"))
->Run();
CHECK_EQ(1, break_point_hit_count); CHECK_EQ(1, break_point_hit_count);
} }
@ -6242,7 +6246,8 @@ TEST(ScriptNameAndData) {
CHECK_EQ(3, break_point_hit_count); CHECK_EQ(3, break_point_hit_count);
CHECK_EQ("new name", last_script_name_hit); CHECK_EQ("new name", last_script_name_hit);
v8::Handle<v8::Script> script3 = v8::Script::Compile(script, &origin2); v8::Handle<v8::Script> script3 = v8::Script::Compile(
script, &origin2, NULL);
script3->Run(); script3->Run();
f = v8::Local<v8::Function>::Cast( f = v8::Local<v8::Function>::Cast(
env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f"))); env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
@ -6983,7 +6988,7 @@ TEST(Backtrace) {
v8::Handle<v8::String> void0 = v8::Handle<v8::String> void0 =
v8::String::NewFromUtf8(env->GetIsolate(), "void(0)"); v8::String::NewFromUtf8(env->GetIsolate(), "void(0)");
v8::Handle<v8::Script> script = CompileWithOrigin(void0, void0); v8::Handle<v8::Script> script = v8::Script::Compile(void0, void0);
// Check backtrace from "void(0)" script. // Check backtrace from "void(0)" script.
BacktraceData::frame_counter = -10; BacktraceData::frame_counter = -10;
@ -7003,20 +7008,18 @@ TEST(Backtrace) {
TEST(GetMirror) { TEST(GetMirror) {
DebugLocalContext env; DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(env->GetIsolate());
v8::HandleScope scope(isolate);
v8::Handle<v8::Value> obj = v8::Handle<v8::Value> obj =
v8::Debug::GetMirror(v8::String::NewFromUtf8(isolate, "hodja")); v8::Debug::GetMirror(v8::String::NewFromUtf8(env->GetIsolate(), "hodja"));
v8::Handle<v8::Function> run_test = v8::Handle<v8::Function> run_test =
v8::Handle<v8::Function>::Cast( v8::Handle<v8::Function>::Cast(v8::Script::New(
v8::ScriptCompiler::CompileUnbound( v8::String::NewFromUtf8(
isolate, env->GetIsolate(),
v8::ScriptCompiler::Source(v8_str( "function runTest(mirror) {"
"function runTest(mirror) {" " return mirror.isString() && (mirror.length() == 5);"
" return mirror.isString() && (mirror.length() == 5);" "}"
"}" ""
"" "runTest;"))->Run());
"runTest;")))->BindToCurrentContext()->Run());
v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj);
CHECK(result->IsTrue()); CHECK(result->IsTrue());
} }

View File

@ -310,7 +310,7 @@ TEST(Issue23768) {
// Script needs to have a name in order to trigger InitLineEnds execution. // Script needs to have a name in order to trigger InitLineEnds execution.
v8::Handle<v8::String> origin = v8::Handle<v8::String> origin =
v8::String::NewFromUtf8(CcTest::isolate(), "issue-23768-test"); v8::String::NewFromUtf8(CcTest::isolate(), "issue-23768-test");
v8::Handle<v8::Script> evil_script = CompileWithOrigin(source, origin); v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin);
CHECK(!evil_script.IsEmpty()); CHECK(!evil_script.IsEmpty());
CHECK(!evil_script->Run().IsEmpty()); CHECK(!evil_script->Run().IsEmpty());
i::Handle<i::ExternalTwoByteString> i_source( i::Handle<i::ExternalTwoByteString> i_source(
@ -468,7 +468,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
CcTest::isolate(), reinterpret_cast<const char*>(source.start()), CcTest::isolate(), reinterpret_cast<const char*>(source.start()),
v8::String::kNormalString, source.length()); v8::String::kNormalString, source.length());
v8::TryCatch try_catch; v8::TryCatch try_catch;
v8::Handle<v8::Script> script = CompileWithOrigin(source_str, ""); v8::Handle<v8::Script> script = v8::Script::Compile(source_str, v8_str(""));
if (script.IsEmpty()) { if (script.IsEmpty()) {
v8::String::Utf8Value exception(try_catch.Exception()); v8::String::Utf8Value exception(try_catch.Exception());
printf("compile: %s\n", *exception); printf("compile: %s\n", *exception);

View File

@ -213,25 +213,18 @@ TEST(Preparsing) {
{ {
i::FLAG_lazy = true; i::FLAG_lazy = true;
ScriptResource* resource = new ScriptResource(source, source_length); ScriptResource* resource = new ScriptResource(source, source_length);
v8::ScriptCompiler::Source script_source( v8::Local<v8::String> script_source =
v8::String::NewExternal(isolate, resource), v8::String::NewExternal(isolate, resource);
v8::ScriptCompiler::CachedData( v8::Script::Compile(script_source, NULL, preparse);
reinterpret_cast<const uint8_t*>(preparse->Data()),
preparse->Length()));
v8::ScriptCompiler::Compile(isolate,
v8::ScriptCompiler::Source(script_source));
} }
{ {
i::FLAG_lazy = false; i::FLAG_lazy = false;
ScriptResource* resource = new ScriptResource(source, source_length); ScriptResource* resource = new ScriptResource(source, source_length);
v8::ScriptCompiler::Source script_source( v8::Local<v8::String> script_source =
v8::String::NewExternal(isolate, resource), v8::String::NewExternal(isolate, resource);
v8::ScriptCompiler::CachedData( v8::Script::New(script_source, NULL, preparse);
reinterpret_cast<const uint8_t*>(preparse->Data()),
preparse->Length()));
v8::ScriptCompiler::CompileUnbound(isolate, script_source);
} }
delete preparse; delete preparse;
i::FLAG_lazy = lazy_flag; i::FLAG_lazy = lazy_flag;