Permalink
Browse files

sandbox, refactor: remove script code cache.

  • Loading branch information...
xicilion committed Jul 16, 2018
1 parent 4cd7e71 commit 2e7e44fdc9481e2ea997d677d408b616a27439ab
Showing with 0 additions and 18 deletions.
  1. +0 −3 fibjs/include/Isolate.h
  2. +0 −3 fibjs/src/base/Runtime.cpp
  3. +0 −12 fibjs/src/sandbox/SandBox_resolve.cpp
View
@@ -110,9 +110,6 @@ class Isolate : public exlib::linkitem {
v8::Global<v8::Object> m_AssertionError;
obj_ptr<LruCache> m_script_cache;
obj_ptr<ValueHolder> m_script_cache_holder;
obj_ptr<SandBox> m_topSandbox;
obj_ptr<obj_base> m_httpclient;
@@ -316,9 +316,6 @@ void Isolate::init()
v8::Context::Scope context_scope(_context);
m_script_cache = new LruCache(0, 3000);
m_script_cache_holder = new ValueHolder(m_script_cache->wrap());
if (g_cov && m_id == 1)
beginCoverage(m_isolate);
@@ -20,15 +20,8 @@ namespace fibjs {
result_t SandBox::loadFile(exlib::string fname, obj_ptr<Buffer_base>& data)
{
result_t hr;
v8::Local<v8::Value> v;
Isolate* isolate = holder();
isolate->m_script_cache->get(fname, v);
if (!v.IsEmpty()) {
data = Buffer_base::getInstance(v);
return data ? 0 : CHECK_ERROR(CALL_E_FILE_NOT_FOUND);
}
Variant var;
hr = fs_base::cc_readFile(fname, "", var);
if (hr == CALL_RETURN_NULL) {
@@ -37,11 +30,6 @@ result_t SandBox::loadFile(exlib::string fname, obj_ptr<Buffer_base>& data)
} else
data = Buffer_base::getInstance(var);
if (data)
isolate->m_script_cache->set(fname, data->wrap());
else
isolate->m_script_cache->set(fname, v8::Null(holder()->m_isolate));
return hr;
}

0 comments on commit 2e7e44f

Please sign in to comment.