Reviewers: marja,
Description:
[strong] Introduce --use-strong flag
[email protected]
BUG=
Please review this at https://codereview.chromium.org/907403002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+18, -13 lines):
M src/compiler.cc
M src/flag-definitions.h
M src/objects.cc
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index
12437f8a2b9162890552b69ad8619d843f1d45bd..8961debaab4055f5869c9df0d6b73b1b203b41fa
100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -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);
Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index
40d93f6df5ca78e0828ba335851bee0cce75f7b6..19edd90917daadf43ec471679b2043205fb770eb
100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -169,6 +169,10 @@ 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_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 +265,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)
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
e8bb005dc8b8f46ae88b0b68dc75e3b5ef773e2f..7e85e59bdb169ea56e6fc862d7d21d01cd2defbe
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -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;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.