Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 75c67e096af3a7655f150da19ebeaea65a1827de..f70e1d5d37a091ad9d832b947da17de6e3a5f9ae 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1567,45 +1567,6 @@ void ObjectTemplate::SetInternalFieldCount(int value) { |
} |
-// --- S c r i p t D a t a --- |
- |
- |
-ScriptData* ScriptData::PreCompile(v8::Handle<String> source) { |
- i::Handle<i::String> str = Utils::OpenHandle(*source); |
- i::Isolate* isolate = str->GetIsolate(); |
- if (str->IsExternalTwoByteString()) { |
- i::ExternalTwoByteStringUtf16CharacterStream stream( |
- i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length()); |
- return i::PreParserApi::PreParse(isolate, &stream); |
- } else { |
- i::GenericStringUtf16CharacterStream stream(str, 0, str->length()); |
- return i::PreParserApi::PreParse(isolate, &stream); |
- } |
-} |
- |
- |
-ScriptData* ScriptData::New(const char* data, int length) { |
- // Return an empty ScriptData if the length is obviously invalid. |
- if (length % sizeof(unsigned) != 0) { |
- return new i::ScriptDataImpl(); |
- } |
- |
- // Copy the data to ensure it is properly aligned. |
- int deserialized_data_length = length / sizeof(unsigned); |
- // If aligned, don't create a copy of the data. |
- if (reinterpret_cast<intptr_t>(data) % sizeof(unsigned) == 0) { |
- return new i::ScriptDataImpl(data, length); |
- } |
- // Copy the data to align it. |
- unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length); |
- i::CopyBytes(reinterpret_cast<char*>(deserialized_data), |
- data, static_cast<size_t>(length)); |
- |
- return new i::ScriptDataImpl( |
- i::Vector<unsigned>(deserialized_data, deserialized_data_length)); |
-} |
- |
- |
// --- S c r i p t s --- |
@@ -1737,11 +1698,11 @@ Local<UnboundScript> ScriptCompiler::CompileUnbound( |
source->cached_data = NULL; |
} |
} else if (source->cached_data) { |
- // FIXME(marja): Make compiler use CachedData directly. Aligning needs to be |
- // taken care of. |
- script_data_impl = static_cast<i::ScriptDataImpl*>(ScriptData::New( |
+ // ScriptDataImpl takes care of aligning, in case the data is not aligned |
+ // correctly. |
+ script_data_impl = new i::ScriptDataImpl( |
reinterpret_cast<const char*>(source->cached_data->data), |
- source->cached_data->length)); |
+ source->cached_data->length); |
// 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. |
ASSERT(script_data_impl->SanityCheck()); |
@@ -1830,22 +1791,15 @@ Local<Script> ScriptCompiler::Compile( |
Local<Script> Script::Compile(v8::Handle<String> source, |
- v8::ScriptOrigin* origin, |
- ScriptData* script_data) { |
+ v8::ScriptOrigin* origin) { |
i::Handle<i::String> str = Utils::OpenHandle(*source); |
- ScriptCompiler::CachedData* cached_data = NULL; |
- if (script_data) { |
- cached_data = new ScriptCompiler::CachedData( |
- reinterpret_cast<const uint8_t*>(script_data->Data()), |
- script_data->Length()); |
- } |
if (origin) { |
- ScriptCompiler::Source script_source(source, *origin, cached_data); |
+ ScriptCompiler::Source script_source(source, *origin); |
return ScriptCompiler::Compile( |
reinterpret_cast<v8::Isolate*>(str->GetIsolate()), |
&script_source); |
} |
- ScriptCompiler::Source script_source(source, cached_data); |
+ ScriptCompiler::Source script_source(source); |
return ScriptCompiler::Compile( |
reinterpret_cast<v8::Isolate*>(str->GetIsolate()), |
&script_source); |