Commit 5cd84502 authored by rossberg's avatar rossberg Committed by Commit bot

[strong] Introduce --use-strong flag

R=marja@chromium.org
BUG=

Review URL: https://codereview.chromium.org/907403002

Cr-Commit-Position: refs/heads/master@{#26556}
parent a18b797f
......@@ -1358,10 +1358,11 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
compile_options == ScriptCompiler::kProduceCodeCache) {
info.PrepareForSerializing();
}
if (FLAG_use_strict) {
info.SetLanguageMode(
static_cast<LanguageMode>(info.language_mode() | STRICT_BIT));
}
LanguageMode language_mode =
construct_language_mode(FLAG_use_strict, FLAG_use_strong);
info.SetLanguageMode(
static_cast<LanguageMode>(info.language_mode() | language_mode));
result = CompileToplevel(&info);
if (extension == NULL && !result.is_null() && !result->dont_cache()) {
......@@ -1392,10 +1393,11 @@ Handle<SharedFunctionInfo> Compiler::CompileStreamedScript(
isolate->counters()->total_load_size()->Increment(source_length);
isolate->counters()->total_compile_size()->Increment(source_length);
if (FLAG_use_strict) {
info->SetLanguageMode(
static_cast<LanguageMode>(info->language_mode() | STRICT_BIT));
}
LanguageMode language_mode =
construct_language_mode(FLAG_use_strict, FLAG_use_strong);
info->SetLanguageMode(
static_cast<LanguageMode>(info->language_mode() | language_mode));
// TODO(marja): FLAG_serialize_toplevel is not honoured and won't be; when the
// real code caching lands, streaming needs to be adapted to use it.
return CompileToplevel(info);
......
......@@ -169,6 +169,11 @@ struct MaybeBoolFlag {
// Flags for language modes and experimental language features.
DEFINE_BOOL(use_strict, false, "enforce strict mode")
DEFINE_BOOL(use_strong, false, "enforce strong mode")
DEFINE_IMPLICATION(use_strong, use_strict)
DEFINE_BOOL(strong_mode, false, "experimental strong language mode")
DEFINE_IMPLICATION(use_strong, strong_mode)
DEFINE_BOOL(es_staging, false, "enable all completed harmony features")
DEFINE_BOOL(harmony, false, "enable all completed harmony features")
......@@ -261,7 +266,6 @@ DEFINE_BOOL(smi_binop, true, "support smi representation in binary operations")
DEFINE_BOOL(vector_ics, false, "support vector-based ics")
DEFINE_BOOL(experimental_classes, false,
"experimental new semantics for super() calls")
DEFINE_BOOL(strong_mode, false, "experimental strong language mode")
DEFINE_IMPLICATION(experimental_classes, harmony_classes)
DEFINE_IMPLICATION(experimental_classes, harmony_object_literals)
......
......@@ -15292,8 +15292,8 @@ Handle<Object> CompilationCacheTable::Lookup(Handle<String> src,
Handle<Context> context) {
Isolate* isolate = GetIsolate();
Handle<SharedFunctionInfo> shared(context->closure()->shared());
StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY,
RelocInfo::kNoPosition);
LanguageMode mode = construct_language_mode(FLAG_use_strict, FLAG_use_strong);
StringSharedKey key(src, shared, mode, RelocInfo::kNoPosition);
int entry = FindEntry(&key);
if (entry == kNotFound) return isolate->factory()->undefined_value();
int index = EntryToIndex(entry);
......@@ -15333,8 +15333,8 @@ Handle<CompilationCacheTable> CompilationCacheTable::Put(
Handle<Context> context, Handle<Object> value) {
Isolate* isolate = cache->GetIsolate();
Handle<SharedFunctionInfo> shared(context->closure()->shared());
StringSharedKey key(src, shared, FLAG_use_strict ? STRICT : SLOPPY,
RelocInfo::kNoPosition);
LanguageMode mode = construct_language_mode(FLAG_use_strict, FLAG_use_strong);
StringSharedKey key(src, shared, mode, RelocInfo::kNoPosition);
{
Handle<Object> k = key.AsHandle(isolate);
DisallowHeapAllocation no_allocation_scope;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment