Rename the kinds of locations to be consistent with the (codegen)

context of the expressions they label.  Introduce an "unintialized"
location to catch failure to assign any location at all.

Changed the object literal initialization on ARM to use a Store IC in
the same cases where it did on the other platforms.  This was required
because the location of the literal property name is given an
"unitialized" location.

Review URL: http://codereview.chromium.org/339045

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3171 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9b6a1cca
This diff is collapsed.
......@@ -162,7 +162,7 @@ class Statement: public AstNode {
class Expression: public AstNode {
public:
Expression() : location_(Location::Temporary()) {}
Expression() : location_(Location::Uninitialized()) {}
virtual Expression* AsExpression() { return this; }
......
......@@ -48,7 +48,7 @@ class CodeGenSelector: public AstVisitor {
CodeGenSelector()
: has_supported_syntax_(true),
location_(Location::Nowhere()) {
location_(Location::Uninitialized()) {
}
CodeGenTag Select(FunctionLiteral* fun);
......@@ -514,11 +514,11 @@ void CodeGenSelector::VisitStatements(ZoneList<Statement*>* stmts) {
void CodeGenSelector::VisitAsEffect(Expression* expr) {
if (location_.is_nowhere()) {
if (location_.is_effect()) {
Visit(expr);
} else {
Location saved = location_;
location_ = Location::Nowhere();
location_ = Location::Effect();
Visit(expr);
location_ = saved;
}
......@@ -526,11 +526,11 @@ void CodeGenSelector::VisitAsEffect(Expression* expr) {
void CodeGenSelector::VisitAsValue(Expression* expr) {
if (location_.is_temporary()) {
if (location_.is_value()) {
Visit(expr);
} else {
Location saved = location_;
location_ = Location::Temporary();
location_ = Location::Value();
Visit(expr);
location_ = saved;
}
......
......@@ -73,14 +73,18 @@ int FastCodeGenerator::SlotOffset(Slot* slot) {
void FastCodeGenerator::Move(Location destination, Location source) {
switch (destination.type()) {
case Location::NOWHERE:
case Location::UNINITIALIZED:
UNREACHABLE();
case Location::EFFECT:
break;
case Location::TEMP:
case Location::VALUE:
switch (source.type()) {
case Location::NOWHERE:
case Location::UNINITIALIZED: // Fall through.
case Location::EFFECT:
UNREACHABLE();
case Location::TEMP:
case Location::VALUE:
break;
}
break;
......@@ -92,9 +96,11 @@ void FastCodeGenerator::Move(Location destination, Location source) {
// function.
void FastCodeGenerator::Move(Location destination, Register source) {
switch (destination.type()) {
case Location::NOWHERE:
case Location::UNINITIALIZED:
UNREACHABLE();
case Location::EFFECT:
break;
case Location::TEMP:
case Location::VALUE:
masm_->push(source);
break;
}
......@@ -105,9 +111,10 @@ void FastCodeGenerator::Move(Location destination, Register source) {
// function.
void FastCodeGenerator::Move(Register destination, Location source) {
switch (source.type()) {
case Location::NOWHERE:
case Location::UNINITIALIZED: // Fall through.
case Location::EFFECT:
UNREACHABLE();
case Location::TEMP:
case Location::VALUE:
masm_->pop(destination);
}
}
......
This diff is collapsed.
......@@ -35,13 +35,14 @@ namespace internal {
class Location BASE_EMBEDDED {
public:
enum Type { NOWHERE, TEMP };
enum Type { UNINITIALIZED, EFFECT, VALUE };
static Location Temporary() { return Location(TEMP); }
static Location Nowhere() { return Location(NOWHERE); }
static Location Uninitialized() { return Location(UNINITIALIZED); }
static Location Effect() { return Location(EFFECT); }
static Location Value() { return Location(VALUE); }
bool is_temporary() { return type_ == TEMP; }
bool is_nowhere() { return type_ == NOWHERE; }
bool is_effect() { return type_ == EFFECT; }
bool is_value() { return type_ == VALUE; }
Type type() { return type_; }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment