Revision: 7810
Author: [email protected]
Date: Fri May 6 08:02:15 2011
Log: Revert "First step in letting Crankshaft inline functions with a
different context."
This reverts commit r7807. [email protected].
BUG=
TEST=
Review URL: http://codereview.chromium.org/6928061
http://code.google.com/p/v8/source/detail?r=7810
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/hydrogen-instructions.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Fri May 6 06:26:22 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Fri May 6 08:02:15 2011
@@ -1015,8 +1015,6 @@
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()) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri May 6 06:26:22
2011
+++ /branches/bleeding_edge/src/hydrogen-instructions.h Fri May 6 08:02:15
2011
@@ -3311,7 +3311,7 @@
class HLoadKeyedGeneric: public HTemplateInstruction<3> {
public:
- HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) {
+ HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) {
set_representation(Representation::Tagged());
SetOperandAt(0, obj);
SetOperandAt(1, key);
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Fri May 6 06:26:22 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Fri May 6 08:02:15 2011
@@ -2229,21 +2229,14 @@
// Set the initial values of parameters including "this". "This" has
// parameter index 0.
- ASSERT_EQ(scope->num_parameters() + 1, environment()->parameter_count());
-
- for (int i = 0; i < environment()->parameter_count(); ++i) {
+ int count = scope->num_parameters() + 1;
+ for (int i = 0; i < count; ++i) {
HInstruction* parameter = AddInstruction(new(zone()) HParameter(i));
environment()->Bind(i, parameter);
}
- // First special is HContext.
- HInstruction* context = AddInstruction(new(zone()) HContext);
- environment()->BindContext(context);
-
- // Initialize specials and locals to undefined.
- for (int i = environment()->parameter_count() + 1;
- i < environment()->length();
- ++i) {
+ // Set the initial values of stack-allocated locals.
+ for (int i = count; i < environment()->length(); ++i) {
environment()->Bind(i, undefined_constant);
}
@@ -2600,18 +2593,17 @@
int osr_entry_id = statement->OsrEntryId();
// We want the correct environment at the OsrEntry instruction. Build
// it explicitly. The expression stack should be empty.
- ASSERT(environment()->ExpressionStackIsEmpty());
- for (int i = 0; i < environment()->length(); ++i) {
- HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue;
- AddInstruction(osr_value);
- environment()->Bind(i, osr_value);
+ int count = environment()->length();
+ ASSERT(count ==
+ (environment()->parameter_count() +
environment()->local_count()));
+ for (int i = 0; i < count; ++i) {
+ HUnknownOSRValue* unknown = new(zone()) HUnknownOSRValue;
+ AddInstruction(unknown);
+ environment()->Bind(i, unknown);
}
AddSimulate(osr_entry_id);
AddInstruction(new(zone()) HOsrEntry(osr_entry_id));
- HContext* context = new(zone()) HContext;
- AddInstruction(context);
- environment()->BindContext(context);
current_block()->Goto(loop_predecessor);
loop_predecessor->SetJoinId(statement->EntryId());
set_current_block(loop_predecessor);
@@ -2894,12 +2886,12 @@
HValue* HGraphBuilder::BuildContextChainWalk(Variable* var) {
ASSERT(var->IsContextSlot());
- HValue* context = environment()->LookupContext();
+ HInstruction* context = new(zone()) HContext;
+ AddInstruction(context);
int length = info()->scope()->ContextChainLength(var->scope());
while (length-- > 0) {
- HInstruction* context_instruction = new(zone()) HOuterContext(context);
- AddInstruction(context_instruction);
- context = context_instruction;
+ context = new(zone()) HOuterContext(context);
+ AddInstruction(context);
}
return context;
}
@@ -2938,7 +2930,8 @@
HLoadGlobalCell* instr = new(zone()) HLoadGlobalCell(cell,
check_hole);
ast_context()->ReturnInstruction(instr, expr->id());
} else {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HGlobalObject* global_object = new(zone()) HGlobalObject(context);
AddInstruction(global_object);
HLoadGlobalGeneric* instr =
@@ -2981,7 +2974,8 @@
ASSERT(!HasStackOverflow());
ASSERT(current_block() != NULL);
ASSERT(current_block()->HasPredecessor());
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HObjectLiteral* literal =
new(zone()) HObjectLiteral(context,
expr->constant_properties(),
@@ -3163,7 +3157,8 @@
HInstruction* HGraphBuilder::BuildStoreNamedGeneric(HValue* object,
Handle<String> name,
HValue* value) {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
return new(zone()) HStoreNamedGeneric(
context,
object,
@@ -3339,7 +3334,8 @@
AddInstruction(instr);
if (instr->HasSideEffects()) AddSimulate(ast_id);
} else {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HGlobalObject* global_object = new(zone()) HGlobalObject(context);
AddInstruction(global_object);
HStoreGlobalGeneric* instr =
@@ -3564,7 +3560,8 @@
Property* expr) {
ASSERT(expr->key()->IsPropertyName());
Handle<Object> name = expr->key()->AsLiteral()->handle();
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
return new(zone()) HLoadNamedGeneric(context, obj, name);
}
@@ -3594,7 +3591,8 @@
HInstruction* HGraphBuilder::BuildLoadKeyedGeneric(HValue* object,
HValue* key) {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
return new(zone()) HLoadKeyedGeneric(context, object, key);
}
@@ -3669,7 +3667,8 @@
HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object,
HValue* key,
HValue* value) {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
return new(zone()) HStoreKeyedGeneric(
context,
object,
@@ -3922,7 +3921,8 @@
if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
current_block()->FinishExitWithDeoptimization();
} else {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallNamed* call = new(zone()) HCallNamed(context, name,
argument_count);
call->set_position(expr->position());
PreProcessCall(call);
@@ -4349,7 +4349,8 @@
CHECK_ALIVE(VisitExpressions(expr->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
call = PreProcessCall(
new(zone()) HCallKeyed(context, key, argument_count));
call->set_position(expr->position());
@@ -4388,7 +4389,8 @@
// When the target has a custom call IC generator, use the IC,
// because it is likely to generate better code. Also use the IC
// when a primitive receiver check is required.
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
call = PreProcessCall(
new(zone()) HCallNamed(context, name, argument_count));
} else {
@@ -4405,7 +4407,8 @@
return;
} else {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
call = PreProcessCall(
new(zone()) HCallNamed(context, name, argument_count));
}
@@ -4434,8 +4437,9 @@
if (known_global_function) {
// Push the global object instead of the global receiver because
// code generated by the full code generator expects it.
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
HGlobalObject* global_object = new(zone()) HGlobalObject(context);
+ AddInstruction(context);
PushAndAdd(global_object);
CHECK_ALIVE(VisitExpressions(expr->arguments()));
@@ -4457,7 +4461,8 @@
call = PreProcessCall(new(zone()) HCallKnownGlobal(expr->target(),
argument_count));
} else {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
PushAndAdd(new(zone()) HGlobalObject(context));
CHECK_ALIVE(VisitExpressions(expr->arguments()));
@@ -4467,8 +4472,9 @@
}
} else {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
HGlobalObject* global_object = new(zone()) HGlobalObject(context);
+ AddInstruction(context);
AddInstruction(global_object);
PushAndAdd(new(zone()) HGlobalReceiver(global_object));
CHECK_ALIVE(VisitExpressions(expr->arguments()));
@@ -4491,7 +4497,8 @@
CHECK_ALIVE(VisitForValue(expr->expression()));
CHECK_ALIVE(VisitExpressions(expr->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
// The constructor is both an operand to the instruction and an argument
// to the construct call.
@@ -5114,7 +5121,8 @@
// If the target is not null we have found a known global function
that is
// assumed to stay the same for this instanceof.
if (target.is_null()) {
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
instr = new(zone()) HInstanceOf(context, left, right);
} else {
AddInstruction(new(zone()) HCheckFunction(right, target));
@@ -5390,7 +5398,8 @@
void HGraphBuilder::GenerateStringAdd(CallRuntime* call) {
ASSERT_EQ(2, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result = new(zone()) HCallStub(context, CodeStub::StringAdd,
2);
Drop(2);
ast_context()->ReturnInstruction(result, call->id());
@@ -5401,7 +5410,8 @@
void HGraphBuilder::GenerateSubString(CallRuntime* call) {
ASSERT_EQ(3, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result = new(zone()) HCallStub(context, CodeStub::SubString,
3);
Drop(3);
ast_context()->ReturnInstruction(result, call->id());
@@ -5412,7 +5422,8 @@
void HGraphBuilder::GenerateStringCompare(CallRuntime* call) {
ASSERT_EQ(2, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::StringCompare, 2);
Drop(2);
@@ -5424,7 +5435,8 @@
void HGraphBuilder::GenerateRegExpExec(CallRuntime* call) {
ASSERT_EQ(4, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result = new(zone()) HCallStub(context, CodeStub::RegExpExec,
4);
Drop(4);
ast_context()->ReturnInstruction(result, call->id());
@@ -5435,7 +5447,8 @@
void HGraphBuilder::GenerateRegExpConstructResult(CallRuntime* call) {
ASSERT_EQ(3, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::RegExpConstructResult, 3);
Drop(3);
@@ -5453,7 +5466,8 @@
void HGraphBuilder::GenerateNumberToString(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::NumberToString, 1);
Drop(1);
@@ -5480,7 +5494,8 @@
}
CHECK_ALIVE(VisitForValue(call->arguments()->last()));
HValue* function = Pop();
- HValue* context = environment()->LookupContext();
+ HContext* context = new HContext;
+ AddInstruction(context);
HInvokeFunction* result =
new(zone()) HInvokeFunction(context, function, arg_count);
Drop(arg_count);
@@ -5503,7 +5518,8 @@
void HGraphBuilder::GenerateMathSin(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::SIN);
@@ -5515,7 +5531,8 @@
void HGraphBuilder::GenerateMathCos(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::COS);
@@ -5527,7 +5544,8 @@
void HGraphBuilder::GenerateMathLog(CallRuntime* call) {
ASSERT_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitArgumentList(call->arguments()));
- HValue* context = environment()->LookupContext();
+ HContext* context = new(zone()) HContext;
+ AddInstruction(context);
HCallStub* result =
new(zone()) HCallStub(context, CodeStub::TranscendentalCache, 1);
result->set_transcendental_type(TranscendentalCache::LOG);
@@ -5572,7 +5590,6 @@
values_(0),
assigned_variables_(4),
parameter_count_(0),
- specials_count_(1),
local_count_(0),
outer_(outer),
pop_count_(0),
@@ -5586,7 +5603,6 @@
: values_(0),
assigned_variables_(0),
parameter_count_(0),
- specials_count_(1),
local_count_(0),
outer_(NULL),
pop_count_(0),
@@ -5603,7 +5619,7 @@
local_count_ = local_count;
// Avoid reallocating the temporaries' backing store on the first Push.
- int total = parameter_count + specials_count_ + local_count +
stack_height;
+ int total = parameter_count + local_count + stack_height;
values_.Initialize(total + 4);
for (int i = 0; i < total; ++i) values_.Add(NULL);
}
@@ -5662,12 +5678,12 @@
bool HEnvironment::HasExpressionAt(int index) const {
- return index >= parameter_count_ + specials_count_ + local_count_;
+ return index >= parameter_count_ + local_count_;
}
bool HEnvironment::ExpressionStackIsEmpty() const {
- int first_expression = parameter_count() + specials_count() +
local_count();
+ int first_expression = parameter_count() + local_count();
ASSERT(length() >= first_expression);
return length() == first_expression;
}
@@ -5745,9 +5761,12 @@
inner->SetValueAt(i, push);
}
}
- inner->SetValueAt(arity + 1, outer->LookupContext());
- for (int i = arity + 2; i < inner->length(); ++i) {
- inner->SetValueAt(i, undefined);
+
+ // Initialize the stack-allocated locals to undefined.
+ int local_base = arity + 1;
+ int local_count = function->scope()->num_stack_slots();
+ for (int i = 0; i < local_count; ++i) {
+ inner->SetValueAt(local_base + i, undefined);
}
inner->set_ast_id(AstNode::kFunctionEntryId);
@@ -5758,11 +5777,8 @@
void HEnvironment::PrintTo(StringStream* stream) {
for (int i = 0; i < length(); i++) {
if (i == 0) stream->Add("parameters\n");
- if (i == parameter_count()) stream->Add("specials\n");
- if (i == parameter_count() + specials_count()) stream->Add("locals\n");
- if (i == parameter_count() + specials_count() + local_count()) {
- stream->Add("expressions");
- }
+ if (i == parameter_count()) stream->Add("locals\n");
+ if (i == parameter_count() + local_count()) stream->Add("expressions");
HValue* val = values_.at(i);
stream->Add("%d: ", i);
if (val != NULL) {
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Fri May 6 06:26:22 2011
+++ /branches/bleeding_edge/src/hydrogen.h Fri May 6 08:02:15 2011
@@ -322,7 +322,6 @@
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_; }
@@ -332,9 +331,6 @@
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);
@@ -342,10 +338,6 @@
void Bind(int index, HValue* value);
- void BindContext(HValue* value) {
- Bind(parameter_count(), value);
- }
-
HValue* Lookup(Variable* variable) const {
return Lookup(IndexFor(variable));
}
@@ -355,11 +347,6 @@
ASSERT(result != NULL);
return result;
}
-
- HValue* LookupContext() const {
- // Return first special.
- return Lookup(parameter_count());
- }
void Push(HValue* value) {
ASSERT(value != NULL);
@@ -380,8 +367,6 @@
void Drop(int count);
HValue* Top() const { return ExpressionStackAt(0); }
-
- bool ExpressionStackIsEmpty() const;
HValue* ExpressionStackAt(int index_from_top) const {
int index = length() - index_from_top - 1;
@@ -427,6 +412,8 @@
// 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);
@@ -436,18 +423,15 @@
int IndexFor(Variable* variable) const {
Slot* slot = variable->AsSlot();
ASSERT(slot != NULL && slot->IsStackAllocated());
- int shift = (slot->type() == Slot::PARAMETER)
- ? 1
- : parameter_count_ + specials_count_;
+ int shift = (slot->type() == Slot::PARAMETER) ? 1 : parameter_count_;
return slot->index() + shift;
}
Handle<JSFunction> closure_;
- // Value array [parameters] [specials] [locals] [temporaries].
+ // Value array [parameters] [locals] [temporaries].
ZoneList<HValue*> values_;
ZoneList<int> assigned_variables_;
int parameter_count_;
- int specials_count_;
int local_count_;
HEnvironment* outer_;
int pop_count_;
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri May 6 06:26:22
2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri May 6 08:02:15
2011
@@ -1010,8 +1010,6 @@
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()) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Fri May 6 06:26:22 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Fri May 6 08:02:15 2011
@@ -1010,8 +1010,6 @@
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()) {
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev