aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/compilation-cache.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-03-27 12:04:12 +0100
committerChris Dickinson <christopher.s.dickinson@gmail.com>2015-04-28 14:38:16 -0700
commit36cd5fb9d27b830320e57213f5b8829ffbb93324 (patch)
treebbab4215d26f8597019135206426fccf27a3089e /deps/v8/src/compilation-cache.cc
parentb57cc51d8d3f4ad279591ae8fa6584ee22773b97 (diff)
downloadandroid-node-v8-36cd5fb9d27b830320e57213f5b8829ffbb93324.tar.gz
android-node-v8-36cd5fb9d27b830320e57213f5b8829ffbb93324.tar.bz2
android-node-v8-36cd5fb9d27b830320e57213f5b8829ffbb93324.zip
deps: upgrade v8 to 4.2.77.13
This commit applies some secondary changes in order to make `make test` pass cleanly: * disable broken postmortem debugging in common.gypi * drop obsolete strict mode test in parallel/test-repl * drop obsolete test parallel/test-v8-features PR-URL: https://github.com/iojs/io.js/pull/1232 Reviewed-By: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'deps/v8/src/compilation-cache.cc')
-rw-r--r--deps/v8/src/compilation-cache.cc75
1 files changed, 36 insertions, 39 deletions
diff --git a/deps/v8/src/compilation-cache.cc b/deps/v8/src/compilation-cache.cc
index 6c9f95a985..b696ea5507 100644
--- a/deps/v8/src/compilation-cache.cc
+++ b/deps/v8/src/compilation-cache.cc
@@ -111,12 +111,11 @@ CompilationCacheScript::CompilationCacheScript(Isolate* isolate,
// We only re-use a cached function for some script source code if the
// script originates from the same place. This is to avoid issues
// when reporting errors, etc.
-bool CompilationCacheScript::HasOrigin(
- Handle<SharedFunctionInfo> function_info,
- Handle<Object> name,
- int line_offset,
- int column_offset,
- bool is_shared_cross_origin) {
+bool CompilationCacheScript::HasOrigin(Handle<SharedFunctionInfo> function_info,
+ Handle<Object> name, int line_offset,
+ int column_offset,
+ bool is_embedder_debug_script,
+ bool is_shared_cross_origin) {
Handle<Script> script =
Handle<Script>(Script::cast(function_info->script()), isolate());
// If the script name isn't set, the boilerplate script should have
@@ -129,6 +128,10 @@ bool CompilationCacheScript::HasOrigin(
if (column_offset != script->column_offset()->value()) return false;
// Check that both names are strings. If not, no match.
if (!name->IsString() || !script->name()->IsString()) return false;
+ // Were both scripts tagged by the embedder as being internal script?
+ if (is_embedder_debug_script != script->is_embedder_debug_script()) {
+ return false;
+ }
// Were both scripts tagged by the embedder as being shared cross-origin?
if (is_shared_cross_origin != script->is_shared_cross_origin()) return false;
// Compare the two name strings for equality.
@@ -142,12 +145,10 @@ bool CompilationCacheScript::HasOrigin(
// will be cached, but subsequent code from different source / line
// won't.
Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
- Handle<String> source,
- Handle<Object> name,
- int line_offset,
- int column_offset,
- bool is_shared_cross_origin,
- Handle<Context> context) {
+ Handle<String> source, Handle<Object> name, int line_offset,
+ int column_offset, bool is_embedder_debug_script,
+ bool is_shared_cross_origin, Handle<Context> context,
+ LanguageMode language_mode) {
Object* result = NULL;
int generation;
@@ -156,17 +157,14 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
{ HandleScope scope(isolate());
for (generation = 0; generation < generations(); generation++) {
Handle<CompilationCacheTable> table = GetTable(generation);
- Handle<Object> probe = table->Lookup(source, context);
+ Handle<Object> probe = table->Lookup(source, context, language_mode);
if (probe->IsSharedFunctionInfo()) {
Handle<SharedFunctionInfo> function_info =
Handle<SharedFunctionInfo>::cast(probe);
// Break when we've found a suitable shared function info that
// matches the origin.
- if (HasOrigin(function_info,
- name,
- line_offset,
- column_offset,
- is_shared_cross_origin)) {
+ if (HasOrigin(function_info, name, line_offset, column_offset,
+ is_embedder_debug_script, is_shared_cross_origin)) {
result = *function_info;
break;
}
@@ -180,14 +178,11 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
if (result != NULL) {
Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result),
isolate());
- DCHECK(HasOrigin(shared,
- name,
- line_offset,
- column_offset,
- is_shared_cross_origin));
+ DCHECK(HasOrigin(shared, name, line_offset, column_offset,
+ is_embedder_debug_script, is_shared_cross_origin));
// If the script was found in a later generation, we promote it to
// the first generation to let it survive longer in the cache.
- if (generation != 0) Put(source, context, shared);
+ if (generation != 0) Put(source, context, language_mode, shared);
isolate()->counters()->compilation_cache_hits()->Increment();
return shared;
} else {
@@ -199,17 +194,18 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
void CompilationCacheScript::Put(Handle<String> source,
Handle<Context> context,
+ LanguageMode language_mode,
Handle<SharedFunctionInfo> function_info) {
HandleScope scope(isolate());
Handle<CompilationCacheTable> table = GetFirstTable();
- SetFirstTable(
- CompilationCacheTable::Put(table, source, context, function_info));
+ SetFirstTable(CompilationCacheTable::Put(table, source, context,
+ language_mode, function_info));
}
MaybeHandle<SharedFunctionInfo> CompilationCacheEval::Lookup(
Handle<String> source, Handle<SharedFunctionInfo> outer_info,
- StrictMode strict_mode, int scope_position) {
+ LanguageMode language_mode, int scope_position) {
HandleScope scope(isolate());
// Make sure not to leak the table into the surrounding handle
// scope. Otherwise, we risk keeping old tables around even after
@@ -218,7 +214,8 @@ MaybeHandle<SharedFunctionInfo> CompilationCacheEval::Lookup(
int generation;
for (generation = 0; generation < generations(); generation++) {
Handle<CompilationCacheTable> table = GetTable(generation);
- result = table->LookupEval(source, outer_info, strict_mode, scope_position);
+ result =
+ table->LookupEval(source, outer_info, language_mode, scope_position);
if (result->IsSharedFunctionInfo()) break;
}
if (result->IsSharedFunctionInfo()) {
@@ -295,31 +292,30 @@ void CompilationCache::Remove(Handle<SharedFunctionInfo> function_info) {
MaybeHandle<SharedFunctionInfo> CompilationCache::LookupScript(
- Handle<String> source,
- Handle<Object> name,
- int line_offset,
- int column_offset,
- bool is_shared_cross_origin,
- Handle<Context> context) {
+ Handle<String> source, Handle<Object> name, int line_offset,
+ int column_offset, bool is_embedder_debug_script,
+ bool is_shared_cross_origin, Handle<Context> context,
+ LanguageMode language_mode) {
if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
return script_.Lookup(source, name, line_offset, column_offset,
- is_shared_cross_origin, context);
+ is_embedder_debug_script, is_shared_cross_origin,
+ context, language_mode);
}
MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval(
Handle<String> source, Handle<SharedFunctionInfo> outer_info,
- Handle<Context> context, StrictMode strict_mode, int scope_position) {
+ Handle<Context> context, LanguageMode language_mode, int scope_position) {
if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
MaybeHandle<SharedFunctionInfo> result;
if (context->IsNativeContext()) {
result =
- eval_global_.Lookup(source, outer_info, strict_mode, scope_position);
+ eval_global_.Lookup(source, outer_info, language_mode, scope_position);
} else {
DCHECK(scope_position != RelocInfo::kNoPosition);
- result = eval_contextual_.Lookup(source, outer_info, strict_mode,
+ result = eval_contextual_.Lookup(source, outer_info, language_mode,
scope_position);
}
return result;
@@ -336,10 +332,11 @@ MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
void CompilationCache::PutScript(Handle<String> source,
Handle<Context> context,
+ LanguageMode language_mode,
Handle<SharedFunctionInfo> function_info) {
if (!IsEnabled()) return;
- script_.Put(source, context, function_info);
+ script_.Put(source, context, language_mode, function_info);
}