Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: src/compilation-cache.cc

Issue 1140673002: [V8] Added Script::is_opaque flag for embedders (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-cache.cc
diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc
index f2cb4c9000efc32fa530776584c440ceedd5fe46..7b2d6d5c354cbcaef03be03a15d6c213a61010e3 100644
--- a/src/compilation-cache.cc
+++ b/src/compilation-cache.cc
@@ -113,8 +113,7 @@ CompilationCacheScript::CompilationCacheScript(Isolate* isolate,
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) {
+ ScriptOriginOptions resource_options) {
Handle<Script> script =
Handle<Script>(Script::cast(function_info->script()), isolate());
// If the script name isn't set, the boilerplate script should have
@@ -127,12 +126,9 @@ bool CompilationCacheScript::HasOrigin(Handle<SharedFunctionInfo> function_info,
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()) {
+ // Are the origin_options same?
+ if (resource_options.Flags() != script->origin_options().Flags())
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.
return String::Equals(Handle<String>::cast(name),
Handle<String>(String::cast(script->name())));
@@ -145,9 +141,8 @@ bool CompilationCacheScript::HasOrigin(Handle<SharedFunctionInfo> function_info,
// won't.
Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
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) {
+ int column_offset, ScriptOriginOptions resource_options,
+ Handle<Context> context, LanguageMode language_mode) {
Object* result = NULL;
int generation;
@@ -163,7 +158,7 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
// Break when we've found a suitable shared function info that
// matches the origin.
if (HasOrigin(function_info, name, line_offset, column_offset,
- is_embedder_debug_script, is_shared_cross_origin)) {
+ resource_options)) {
result = *function_info;
break;
}
@@ -177,8 +172,8 @@ Handle<SharedFunctionInfo> CompilationCacheScript::Lookup(
if (result != NULL) {
Handle<SharedFunctionInfo> shared(SharedFunctionInfo::cast(result),
isolate());
- DCHECK(HasOrigin(shared, name, line_offset, column_offset,
- is_embedder_debug_script, is_shared_cross_origin));
+ DCHECK(
+ HasOrigin(shared, name, line_offset, column_offset, resource_options));
// 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, language_mode, shared);
@@ -292,14 +287,12 @@ 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_embedder_debug_script,
- bool is_shared_cross_origin, Handle<Context> context,
- LanguageMode language_mode) {
+ int column_offset, ScriptOriginOptions resource_options,
+ Handle<Context> context, LanguageMode language_mode) {
if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
return script_.Lookup(source, name, line_offset, column_offset,
- is_embedder_debug_script, is_shared_cross_origin,
- context, language_mode);
+ resource_options, context, language_mode);
}
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698