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

Unified Diff: src/contexts.h

Issue 954693003: [strong] Make functions and generators non-extensible non-constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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/bootstrapper.cc ('k') | test/mjsunit/strong/functions.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/contexts.h
diff --git a/src/contexts.h b/src/contexts.h
index f932c60092dcba78b2b3818422bc20ef044769ea..b1ae58fca739c9740e3f585f5ae06f7cf7666f11 100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -125,10 +125,12 @@ enum BindingFlags {
V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
sloppy_function_with_readonly_prototype_map) \
V(STRICT_FUNCTION_MAP_INDEX, Map, strict_function_map) \
+ V(STRONG_FUNCTION_MAP_INDEX, Map, strong_function_map) \
V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
sloppy_function_without_prototype_map) \
V(STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
strict_function_without_prototype_map) \
+ V(STRONG_CONSTRUCTOR_MAP_INDEX, Map, strong_constructor_map) \
V(BOUND_FUNCTION_MAP_INDEX, Map, bound_function_map) \
V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \
V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \
@@ -176,6 +178,7 @@ enum BindingFlags {
native_object_notifier_perform_change) \
V(SLOPPY_GENERATOR_FUNCTION_MAP_INDEX, Map, sloppy_generator_function_map) \
V(STRICT_GENERATOR_FUNCTION_MAP_INDEX, Map, strict_generator_function_map) \
+ V(STRONG_GENERATOR_FUNCTION_MAP_INDEX, Map, strong_generator_function_map) \
V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, generator_object_prototype_map) \
V(ITERATOR_RESULT_MAP_INDEX, Map, iterator_result_map) \
V(MAP_ITERATOR_MAP_INDEX, Map, map_iterator_map) \
@@ -319,8 +322,10 @@ class Context: public FixedArray {
SLOPPY_FUNCTION_MAP_INDEX,
SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX,
STRICT_FUNCTION_MAP_INDEX,
+ STRONG_FUNCTION_MAP_INDEX,
SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX,
STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX,
+ STRONG_CONSTRUCTOR_MAP_INDEX,
BOUND_FUNCTION_MAP_INDEX,
INITIAL_OBJECT_PROTOTYPE_INDEX,
INITIAL_ARRAY_PROTOTYPE_INDEX,
@@ -406,6 +411,7 @@ class Context: public FixedArray {
NATIVE_OBJECT_NOTIFIER_PERFORM_CHANGE,
SLOPPY_GENERATOR_FUNCTION_MAP_INDEX,
STRICT_GENERATOR_FUNCTION_MAP_INDEX,
+ STRONG_GENERATOR_FUNCTION_MAP_INDEX,
GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX,
ITERATOR_RESULT_MAP_INDEX,
MAP_ITERATOR_MAP_INDEX,
@@ -570,18 +576,27 @@ class Context: public FixedArray {
static int FunctionMapIndex(LanguageMode language_mode, FunctionKind kind) {
if (IsGeneratorFunction(kind)) {
- return is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX
+ return is_strong(language_mode) ? STRONG_GENERATOR_FUNCTION_MAP_INDEX :
+ is_strict(language_mode) ? STRICT_GENERATOR_FUNCTION_MAP_INDEX
: SLOPPY_GENERATOR_FUNCTION_MAP_INDEX;
}
+ if (IsConstructor(kind)) {
+ return is_strong(language_mode) ? STRONG_CONSTRUCTOR_MAP_INDEX :
+ is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX
+ : SLOPPY_FUNCTION_MAP_INDEX;
+ }
+
if (IsArrowFunction(kind) || IsConciseMethod(kind) ||
IsAccessorFunction(kind)) {
- return is_strict(language_mode)
- ? STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX
- : SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX;
+ return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX :
+ is_strict(language_mode) ?
+ STRICT_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX :
+ SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX;
}
- return is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX
+ return is_strong(language_mode) ? STRONG_FUNCTION_MAP_INDEX :
+ is_strict(language_mode) ? STRICT_FUNCTION_MAP_INDEX
: SLOPPY_FUNCTION_MAP_INDEX;
}
« no previous file with comments | « src/bootstrapper.cc ('k') | test/mjsunit/strong/functions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698