Commit bf06fbdb authored by whesse@chromium.org's avatar whesse@chromium.org

Recommit "First step in letting Crankshaft inline functions with a different context.""

This reverts r7810, thus recommitting 7807.

BUG=
TEST=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7851 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 79e76dbd
......@@ -1015,6 +1015,8 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
outer);
int argument_index = 0;
for (int i = 0; i < value_count; ++i) {
if (hydrogen_env->is_special_index(i)) continue;
HValue* value = hydrogen_env->values()->at(i);
LOperand* op = NULL;
if (value->IsArgumentsObject()) {
......
......@@ -3326,7 +3326,7 @@ class HLoadKeyedSpecializedArrayElement: public HBinaryOperation {
class HLoadKeyedGeneric: public HTemplateInstruction<3> {
public:
HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) {
HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
set_representation(Representation::Tagged());
SetOperandAt(0, obj);
SetOperandAt(1, key);
......
This diff is collapsed.
......@@ -322,6 +322,7 @@ class HEnvironment: public ZoneObject {
return &assigned_variables_;
}
int parameter_count() const { return parameter_count_; }
int specials_count() const { return specials_count_; }
int local_count() const { return local_count_; }
HEnvironment* outer() const { return outer_; }
int pop_count() const { return pop_count_; }
......@@ -331,6 +332,9 @@ class HEnvironment: public ZoneObject {
void set_ast_id(int id) { ast_id_ = id; }
int length() const { return values_.length(); }
bool is_special_index(int i) const {
return i >= parameter_count() && i < parameter_count() + specials_count();
}
void Bind(Variable* variable, HValue* value) {
Bind(IndexFor(variable), value);
......@@ -338,6 +342,10 @@ class HEnvironment: public ZoneObject {
void Bind(int index, HValue* value);
void BindContext(HValue* value) {
Bind(parameter_count(), value);
}
HValue* Lookup(Variable* variable) const {
return Lookup(IndexFor(variable));
}
......@@ -348,6 +356,11 @@ class HEnvironment: public ZoneObject {
return result;
}
HValue* LookupContext() const {
// Return first special.
return Lookup(parameter_count());
}
void Push(HValue* value) {
ASSERT(value != NULL);
++push_count_;
......@@ -368,6 +381,8 @@ class HEnvironment: public ZoneObject {
HValue* Top() const { return ExpressionStackAt(0); }
bool ExpressionStackIsEmpty() const;
HValue* ExpressionStackAt(int index_from_top) const {
int index = length() - index_from_top - 1;
ASSERT(HasExpressionAt(index));
......@@ -412,8 +427,6 @@ class HEnvironment: public ZoneObject {
// True if index is included in the expression stack part of the environment.
bool HasExpressionAt(int index) const;
bool ExpressionStackIsEmpty() const;
void Initialize(int parameter_count, int local_count, int stack_height);
void Initialize(const HEnvironment* other);
......@@ -423,15 +436,18 @@ class HEnvironment: public ZoneObject {
int IndexFor(Variable* variable) const {
Slot* slot = variable->AsSlot();
ASSERT(slot != NULL && slot->IsStackAllocated());
int shift = (slot->type() == Slot::PARAMETER) ? 1 : parameter_count_;
int shift = (slot->type() == Slot::PARAMETER)
? 1
: parameter_count_ + specials_count_;
return slot->index() + shift;
}
Handle<JSFunction> closure_;
// Value array [parameters] [locals] [temporaries].
// Value array [parameters] [specials] [locals] [temporaries].
ZoneList<HValue*> values_;
ZoneList<int> assigned_variables_;
int parameter_count_;
int specials_count_;
int local_count_;
HEnvironment* outer_;
int pop_count_;
......
......@@ -1010,6 +1010,8 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
outer);
int argument_index = 0;
for (int i = 0; i < value_count; ++i) {
if (hydrogen_env->is_special_index(i)) continue;
HValue* value = hydrogen_env->values()->at(i);
LOperand* op = NULL;
if (value->IsArgumentsObject()) {
......
......@@ -1010,6 +1010,8 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
outer);
int argument_index = 0;
for (int i = 0; i < value_count; ++i) {
if (hydrogen_env->is_special_index(i)) continue;
HValue* value = hydrogen_env->values()->at(i);
LOperand* op = NULL;
if (value->IsArgumentsObject()) {
......
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