summaryrefslogtreecommitdiff
path: root/deps/v8/src/variables.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/variables.h')
-rw-r--r--deps/v8/src/variables.h58
1 files changed, 6 insertions, 52 deletions
diff --git a/deps/v8/src/variables.h b/deps/v8/src/variables.h
index 5d27a02d5..a9c06d1ee 100644
--- a/deps/v8/src/variables.h
+++ b/deps/v8/src/variables.h
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -33,46 +33,6 @@
namespace v8 {
namespace internal {
-// Variables and AST expression nodes can track their "type" to enable
-// optimizations and removal of redundant checks when generating code.
-
-class StaticType {
- public:
- enum Kind {
- UNKNOWN,
- LIKELY_SMI
- };
-
- StaticType() : kind_(UNKNOWN) {}
-
- bool Is(Kind kind) const { return kind_ == kind; }
-
- bool IsKnown() const { return !Is(UNKNOWN); }
- bool IsUnknown() const { return Is(UNKNOWN); }
- bool IsLikelySmi() const { return Is(LIKELY_SMI); }
-
- void CopyFrom(StaticType* other) {
- kind_ = other->kind_;
- }
-
- static const char* Type2String(StaticType* type);
-
- // LIKELY_SMI accessors
- void SetAsLikelySmi() {
- kind_ = LIKELY_SMI;
- }
-
- void SetAsLikelySmiIfUnknown() {
- if (IsUnknown()) {
- SetAsLikelySmi();
- }
- }
-
- private:
- Kind kind_;
-};
-
-
// The AST refers to variables via VariableProxies - placeholders for the actual
// variables. Variables themselves are never directly referred to from the AST,
// they are maintained by scopes, and referred to from VariableProxies and Slots
@@ -121,7 +81,7 @@ class Variable: public ZoneObject {
// Printing support
static const char* Mode2String(Mode mode);
- // Type testing & conversion
+ // Type testing & conversion. Global variables are not slots.
Property* AsProperty() const;
Slot* AsSlot() const;
@@ -165,7 +125,7 @@ class Variable: public ZoneObject {
// True if the variable is named eval and not known to be shadowed.
bool is_possibly_eval() const {
- return IsVariable(Factory::eval_symbol()) &&
+ return IsVariable(FACTORY->eval_symbol()) &&
(mode_ == DYNAMIC || mode_ == DYNAMIC_GLOBAL);
}
@@ -178,10 +138,8 @@ class Variable: public ZoneObject {
local_if_not_shadowed_ = local;
}
- Expression* rewrite() const { return rewrite_; }
- void set_rewrite(Expression* expr) { rewrite_ = expr; }
-
- StaticType* type() { return &type_; }
+ Slot* rewrite() const { return rewrite_; }
+ void set_rewrite(Slot* slot) { rewrite_ = slot; }
private:
Scope* scope_;
@@ -191,12 +149,8 @@ class Variable: public ZoneObject {
Variable* local_if_not_shadowed_;
- // Static type information
- StaticType type_;
-
// Code generation.
- // rewrite_ is usually a Slot or a Property, but may be any expression.
- Expression* rewrite_;
+ Slot* rewrite_;
// Valid as a LHS? (const and this are not valid LHS, for example)
bool is_valid_LHS_;