Index: src/compilation-cache.cc |
diff --git a/src/compilation-cache.cc b/src/compilation-cache.cc |
index f2cb4c9000efc32fa530776584c440ceedd5fe46..cf894382be934f9406ed0dc1d28bd7f05b4075c9 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 |
@@ -128,11 +127,17 @@ bool CompilationCacheScript::HasOrigin(Handle<SharedFunctionInfo> function_info, |
// 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()) { |
+ if (resource_options.IsEmbedderDebugScript() != |
+ 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; |
+ if ((resource_options.IsSharedCrossOrigin()) != |
+ script->is_shared_cross_origin()) { |
+ return false; |
+ } |
+ // Were both scripts tagged by the embedder as opaque? |
+ if ((resource_options.IsOpaque()) != script->is_opaque()) return false; |
Yang
2015/05/18 07:23:33
Please combine those three compares into a method
horo
2015/05/18 10:19:23
Done.
|
// Compare the two name strings for equality. |
return String::Equals(Handle<String>::cast(name), |
Handle<String>(String::cast(script->name()))); |
@@ -145,9 +150,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 +167,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 +181,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 +296,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); |
} |