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

Unified Diff: src/scopeinfo.h

Issue 1218783005: Support for global var shortcuts in script contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
Index: src/scopeinfo.h
diff --git a/src/scopeinfo.h b/src/scopeinfo.h
index 70a17cd7d4a945975ce7ed59f7dc73c9d42d569c..0ca082643b295f7966ee0ba9195413d137faae89 100644
--- a/src/scopeinfo.h
+++ b/src/scopeinfo.h
@@ -21,11 +21,13 @@ class ContextSlotCache {
// Lookup context slot index for (data, name).
// If absent, kNotFound is returned.
int Lookup(Object* data, String* name, VariableMode* mode,
+ ContextSlotKindFlag* context_slot_kind,
InitializationFlag* init_flag,
MaybeAssignedFlag* maybe_assigned_flag);
// Update an element in the cache.
void Update(Handle<Object> data, Handle<String> name, VariableMode mode,
+ ContextSlotKindFlag context_slot_kind,
InitializationFlag init_flag,
MaybeAssignedFlag maybe_assigned_flag, int slot_index);
@@ -47,7 +49,8 @@ class ContextSlotCache {
#ifdef DEBUG
void ValidateEntry(Handle<Object> data, Handle<String> name,
- VariableMode mode, InitializationFlag init_flag,
+ VariableMode mode, ContextSlotKindFlag context_slot_kind,
+ InitializationFlag init_flag,
MaybeAssignedFlag maybe_assigned_flag, int slot_index);
#endif
@@ -58,16 +61,20 @@ class ContextSlotCache {
};
struct Value {
- Value(VariableMode mode, InitializationFlag init_flag,
- MaybeAssignedFlag maybe_assigned_flag, int index) {
+ Value(VariableMode mode, ContextSlotKindFlag context_slot_kind,
+ InitializationFlag init_flag, MaybeAssignedFlag maybe_assigned_flag,
+ int index) {
DCHECK(ModeField::is_valid(mode));
+ DCHECK(ContextSlotKindField::is_valid(context_slot_kind));
DCHECK(InitField::is_valid(init_flag));
DCHECK(MaybeAssignedField::is_valid(maybe_assigned_flag));
DCHECK(IndexField::is_valid(index));
value_ = ModeField::encode(mode) | IndexField::encode(index) |
+ ContextSlotKindField::encode(context_slot_kind) |
InitField::encode(init_flag) |
MaybeAssignedField::encode(maybe_assigned_flag);
DCHECK(mode == this->mode());
+ DCHECK(context_slot_kind == this->context_slot_kind());
DCHECK(init_flag == this->initialization_flag());
DCHECK(maybe_assigned_flag == this->maybe_assigned_flag());
DCHECK(index == this->index());
@@ -87,6 +94,10 @@ class ContextSlotCache {
return MaybeAssignedField::decode(value_);
}
+ ContextSlotKindFlag context_slot_kind() {
+ return ContextSlotKindField::decode(value_);
+ }
+
int index() { return IndexField::decode(value_); }
// Bit fields in value_ (type, shift, size). Must be public so the
@@ -94,7 +105,8 @@ class ContextSlotCache {
class ModeField : public BitField<VariableMode, 0, 4> {};
class InitField : public BitField<InitializationFlag, 4, 1> {};
class MaybeAssignedField : public BitField<MaybeAssignedFlag, 5, 1> {};
- class IndexField : public BitField<int, 6, 32 - 6> {};
+ class ContextSlotKindField : public BitField<ContextSlotKindFlag, 6, 1> {};
+ class IndexField : public BitField<int, 7, 32 - 7> {};
private:
uint32_t value_;

Powered by Google App Engine
This is Rietveld 408576698