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

Unified Diff: src/objects.h

Issue 1292753007: [es6] Parameter scopes for sloppy eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments Created 5 years, 4 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/hydrogen.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index a04ae66bb61649a19b6499083108f8729acd387e..4fe42cdc81c6c0aa30317c96daf47d843bc54faa 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -391,6 +391,7 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
V(BOX_TYPE) \
V(PROTOTYPE_INFO_TYPE) \
+ V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE) \
\
V(FIXED_ARRAY_TYPE) \
V(FIXED_DOUBLE_ARRAY_TYPE) \
@@ -507,7 +508,10 @@ const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) \
V(DEBUG_INFO, DebugInfo, debug_info) \
V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) \
- V(PROTOTYPE_INFO, PrototypeInfo, prototype_info)
+ V(PROTOTYPE_INFO, PrototypeInfo, prototype_info) \
+ V(SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION, \
+ SloppyBlockWithEvalContextExtension, \
+ sloppy_block_with_eval_context_extension)
// We use the full 8 bits of the instance_type field to encode heap object
// instance types. The high-order bit (bit 7) is set if the object is not a
@@ -685,6 +689,7 @@ enum InstanceType {
WEAK_CELL_TYPE,
PROPERTY_CELL_TYPE,
PROTOTYPE_INFO_TYPE,
+ SLOPPY_BLOCK_WITH_EVAL_CONTEXT_EXTENSION_TYPE,
// All the following types are subtypes of JSReceiver, which corresponds to
// objects in the JS sense. The first and the last type in this range are
@@ -3748,6 +3753,9 @@ class ScopeInfo : public FixedArray {
// Return the language mode of this scope.
LanguageMode language_mode();
+ // True if this scope is a (var) declaration scope.
+ bool is_declaration_scope();
+
// Does this scope make a sloppy eval call?
bool CallsSloppyEval() { return CallsEval() && is_sloppy(language_mode()); }
@@ -3971,8 +3979,11 @@ class ScopeInfo : public FixedArray {
STATIC_ASSERT(LANGUAGE_END == 3);
class LanguageModeField
: public BitField<LanguageMode, CallsEvalField::kNext, 2> {};
+ class DeclarationScopeField
+ : public BitField<bool, LanguageModeField::kNext, 1> {};
class ReceiverVariableField
- : public BitField<VariableAllocationInfo, LanguageModeField::kNext, 2> {};
+ : public BitField<VariableAllocationInfo, DeclarationScopeField::kNext,
+ 2> {};
class FunctionVariableField
: public BitField<VariableAllocationInfo, ReceiverVariableField::kNext,
2> {};
@@ -5835,6 +5846,32 @@ class PrototypeInfo : public Struct {
};
+// Pair used to store both a ScopeInfo and an extension object in the extension
+// slot of a block context. Needed in the rare case where a declaration block
+// scope (a "varblock" as used to desugar parameter destructuring) also contains
+// a sloppy direct eval. (In no other case both are needed at the same time.)
+class SloppyBlockWithEvalContextExtension : public Struct {
+ public:
+ // [scope_info]: Scope info.
+ DECL_ACCESSORS(scope_info, ScopeInfo)
+ // [extension]: Extension object.
+ DECL_ACCESSORS(extension, JSObject)
+
+ DECLARE_CAST(SloppyBlockWithEvalContextExtension)
+
+ // Dispatched behavior.
+ DECLARE_PRINTER(SloppyBlockWithEvalContextExtension)
+ DECLARE_VERIFIER(SloppyBlockWithEvalContextExtension)
+
+ static const int kScopeInfoOffset = HeapObject::kHeaderSize;
+ static const int kExtensionOffset = kScopeInfoOffset + kPointerSize;
+ static const int kSize = kExtensionOffset + kPointerSize;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(SloppyBlockWithEvalContextExtension);
+};
+
+
// Script describes a script which has been added to the VM.
class Script: public Struct {
public:
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698