pre_data_impl = NULL;
}
i::Handle<i::JSFunction> boilerplate =
- i::Compiler::Compile(str, name_obj, line_offset, column_offset, NULL,
- pre_data_impl, Utils::OpenHandle(*script_data));
+ i::Compiler::Compile(str,
+ name_obj,
+ line_offset,
+ column_offset,
+ NULL,
+ pre_data_impl,
+ Utils::OpenHandle(*script_data),
+ i::NOT_NATIVES_CODE);
has_pending_exception = boilerplate.is_null();
EXCEPTION_BAILOUT_CHECK(Local<Script>());
return Local<Script>(ToApi<Script>(boilerplate));
ASSERT(source->IsAsciiRepresentation());
Handle<String> script_name = Factory::NewStringFromUtf8(name);
boilerplate =
- Compiler::Compile(source, script_name, 0, 0, extension, NULL,
- Handle<String>::null());
+ Compiler::Compile(
+ source,
+ script_name,
+ 0,
+ 0,
+ extension,
+ NULL,
+ Handle<String>::null(),
+ use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
if (boilerplate.is_null()) return false;
cache->Add(name, boilerplate);
}
int line_offset, int column_offset,
v8::Extension* extension,
ScriptDataImpl* input_pre_data,
- Handle<Object> script_data) {
+ Handle<Object> script_data,
+ NativesFlag natives) {
int source_length = source->length();
Counters::total_load_size.Increment(source_length);
Counters::total_compile_size.Increment(source_length);
// Create a script object describing the script to be compiled.
Handle<Script> script = Factory::NewScript(source);
+ if (natives == NATIVES_CODE) {
+ script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+ }
if (!script_name.is_null()) {
script->set_name(*script_name);
script->set_line_offset(Smi::FromInt(line_offset));
int line_offset, int column_offset,
v8::Extension* extension,
ScriptDataImpl* pre_data,
- Handle<Object> script_data);
+ Handle<Object> script_data,
+ NativesFlag is_natives_code);
// Compile a String source within a context for Eval.
static Handle<JSFunction> CompileEval(Handle<String> source,
bool allow_natives_syntax = FLAG_allow_natives_syntax;
FLAG_allow_natives_syntax = true;
Handle<JSFunction> boilerplate;
- boilerplate = Compiler::Compile(source_code, script_name, 0, 0, NULL, NULL,
- Handle<String>::null());
+ boilerplate = Compiler::Compile(source_code,
+ script_name,
+ 0,
+ 0,
+ NULL,
+ NULL,
+ Handle<String>::null(),
+ NATIVES_CODE);
FLAG_allow_natives_syntax = allow_natives_syntax;
// Silently ignore stack overflows during compilation.
enum VisitMode { VISIT_ALL, VISIT_ALL_IN_SCAVENGE, VISIT_ONLY_STRONG };
+// Flag indicating whether code is built into the VM (one of the natives files).
+enum NativesFlag { NOT_NATIVES_CODE, NATIVES_CODE };
+
+
// A CodeDesc describes a buffer holding instructions and relocation
// information. The instructions start at the beginning of the buffer
// and grow forward, the relocation information starts at the end of
bool allow_natives_syntax = FLAG_allow_natives_syntax;
FLAG_allow_natives_syntax = true;
boilerplate = Compiler::Compile(source_code, script_name, 0, 0, NULL, NULL,
- Handle<String>::null());
+ Handle<String>::null(), NATIVES_CODE);
FLAG_allow_natives_syntax = allow_natives_syntax;
// If the compilation failed (possibly due to stack overflows), we
// should never enter the result in the natives cache. Instead we
static Handle<JSFunction> Compile(const char* source) {
Handle<String> source_code(Factory::NewStringFromUtf8(CStrVector(source)));
Handle<JSFunction> boilerplate =
- Compiler::Compile(source_code, Handle<String>(), 0, 0, NULL, NULL,
- Handle<String>::null());
+ Compiler::Compile(source_code,
+ Handle<String>(),
+ 0,
+ 0,
+ NULL,
+ NULL,
+ Handle<String>::null(),
+ NOT_NATIVES_CODE);
return Factory::NewFunctionFromBoilerplate(boilerplate,
Top::global_context());
}