Commit 92446398 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Use ast_id (id) instead of return_id (LoadId) in simulates for load instructions.

R=svenpanne@chromium.org

Review URL: https://chromiumcodereview.appspot.com/23889006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16519 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a6f162de
...@@ -4655,14 +4655,14 @@ static bool PrototypeChainCanNeverResolve( ...@@ -4655,14 +4655,14 @@ static bool PrototypeChainCanNeverResolve(
void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField( void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
int position, int position,
BailoutId return_id, BailoutId ast_id,
HValue* object, HValue* object,
SmallMapList* types, SmallMapList* types,
Handle<String> name) { Handle<String> name) {
HInstruction* instr = TryLoadPolymorphicAsMonomorphic(object, types, name); HInstruction* instr = TryLoadPolymorphicAsMonomorphic(object, types, name);
if (instr != NULL) { if (instr != NULL) {
instr->set_position(position); instr->set_position(position);
return ast_context()->ReturnInstruction(instr, return_id); return ast_context()->ReturnInstruction(instr, ast_id);
} }
// Something did not match; must use a polymorphic load. // Something did not match; must use a polymorphic load.
...@@ -4734,14 +4734,14 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField( ...@@ -4734,14 +4734,14 @@ void HOptimizedGraphBuilder::HandlePolymorphicLoadNamedField(
if (join != NULL) { if (join != NULL) {
current_block()->Goto(join); current_block()->Goto(join);
} else { } else {
Add<HSimulate>(return_id, REMOVABLE_SIMULATE); Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop()); if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
return; return;
} }
} }
ASSERT(join != NULL); ASSERT(join != NULL);
join->SetJoinId(return_id); join->SetJoinId(ast_id);
set_current_block(join); set_current_block(join);
if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop()); if (!ast_context()->IsEffect()) ast_context()->ReturnValue(Pop());
} }
...@@ -5122,7 +5122,7 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) { ...@@ -5122,7 +5122,7 @@ void HOptimizedGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
// Named property. // Named property.
CHECK_ALIVE(VisitForValue(prop->obj())); CHECK_ALIVE(VisitForValue(prop->obj()));
HValue* object = Top(); HValue* object = Top();
PushLoad(prop, object, expr->position(), expr->id(), prop->LoadId()); PushLoad(prop, object, expr->position());
CHECK_ALIVE(VisitForValue(expr->value())); CHECK_ALIVE(VisitForValue(expr->value()));
HValue* right = Pop(); HValue* right = Pop();
...@@ -5825,19 +5825,16 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) { ...@@ -5825,19 +5825,16 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
void HOptimizedGraphBuilder::PushLoad(Property* expr, void HOptimizedGraphBuilder::PushLoad(Property* expr,
HValue* object, HValue* object,
int position, int position) {
BailoutId ast_id,
BailoutId return_id) {
ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED); ValueContext for_value(this, ARGUMENTS_NOT_ALLOWED);
Push(object); Push(object);
BuildLoad(expr, position, ast_id, return_id); BuildLoad(expr, position, expr->LoadId());
} }
void HOptimizedGraphBuilder::BuildLoad(Property* expr, void HOptimizedGraphBuilder::BuildLoad(Property* expr,
int position, int position,
BailoutId ast_id, BailoutId ast_id) {
BailoutId return_id) {
HInstruction* instr = NULL; HInstruction* instr = NULL;
if (expr->IsStringLength()) { if (expr->IsStringLength()) {
HValue* string = Pop(); HValue* string = Pop();
...@@ -5879,7 +5876,10 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr, ...@@ -5879,7 +5876,10 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
Handle<JSObject> holder; Handle<JSObject> holder;
if (LookupGetter(map, name, &getter, &holder)) { if (LookupGetter(map, name, &getter, &holder)) {
AddCheckConstantFunction(holder, Top(), map); AddCheckConstantFunction(holder, Top(), map);
if (FLAG_inline_accessors && TryInlineGetter(getter, return_id)) return; if (FLAG_inline_accessors &&
TryInlineGetter(getter, ast_id, expr->LoadId())) {
return;
}
Add<HPushArgument>(Pop()); Add<HPushArgument>(Pop());
instr = new(zone()) HCallConstantFunction(getter, 1); instr = new(zone()) HCallConstantFunction(getter, 1);
} else { } else {
...@@ -5887,7 +5887,7 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr, ...@@ -5887,7 +5887,7 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
} }
} else if (types != NULL && types->length() > 1) { } else if (types != NULL && types->length() > 1) {
return HandlePolymorphicLoadNamedField( return HandlePolymorphicLoadNamedField(
position, return_id, Pop(), types, name); position, ast_id, Pop(), types, name);
} else { } else {
instr = BuildLoadNamedGeneric(Pop(), name, expr); instr = BuildLoadNamedGeneric(Pop(), name, expr);
} }
...@@ -5900,22 +5900,22 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr, ...@@ -5900,22 +5900,22 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
bool has_side_effects = false; bool has_side_effects = false;
HValue* load = HandleKeyedElementAccess( HValue* load = HandleKeyedElementAccess(
obj, key, NULL, expr, return_id, position, obj, key, NULL, expr, ast_id, position,
false, // is_store false, // is_store
&has_side_effects); &has_side_effects);
if (has_side_effects) { if (has_side_effects) {
if (ast_context()->IsEffect()) { if (ast_context()->IsEffect()) {
Add<HSimulate>(return_id, REMOVABLE_SIMULATE); Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
} else { } else {
Push(load); Push(load);
Add<HSimulate>(return_id, REMOVABLE_SIMULATE); Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
Drop(1); Drop(1);
} }
} }
return ast_context()->ReturnValue(load); return ast_context()->ReturnValue(load);
} }
instr->set_position(position); instr->set_position(position);
return ast_context()->ReturnInstruction(instr, return_id); return ast_context()->ReturnInstruction(instr, ast_id);
} }
...@@ -5927,7 +5927,7 @@ void HOptimizedGraphBuilder::VisitProperty(Property* expr) { ...@@ -5927,7 +5927,7 @@ void HOptimizedGraphBuilder::VisitProperty(Property* expr) {
if (TryArgumentsAccess(expr)) return; if (TryArgumentsAccess(expr)) return;
CHECK_ALIVE(VisitForValue(expr->obj())); CHECK_ALIVE(VisitForValue(expr->obj()));
BuildLoad(expr, expr->position(), expr->id(), expr->id()); BuildLoad(expr, expr->position(), expr->id());
} }
...@@ -6604,12 +6604,13 @@ bool HOptimizedGraphBuilder::TryInlineConstruct(CallNew* expr, ...@@ -6604,12 +6604,13 @@ bool HOptimizedGraphBuilder::TryInlineConstruct(CallNew* expr,
bool HOptimizedGraphBuilder::TryInlineGetter(Handle<JSFunction> getter, bool HOptimizedGraphBuilder::TryInlineGetter(Handle<JSFunction> getter,
BailoutId ast_id,
BailoutId return_id) { BailoutId return_id) {
return TryInline(CALL_AS_METHOD, return TryInline(CALL_AS_METHOD,
getter, getter,
0, 0,
NULL, NULL,
return_id, ast_id,
return_id, return_id,
GETTER_CALL_RETURN); GETTER_CALL_RETURN);
} }
...@@ -7560,7 +7561,7 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) { ...@@ -7560,7 +7561,7 @@ void HOptimizedGraphBuilder::VisitCountOperation(CountOperation* expr) {
CHECK_ALIVE(VisitForValue(prop->obj())); CHECK_ALIVE(VisitForValue(prop->obj()));
HValue* object = Top(); HValue* object = Top();
PushLoad(prop, object, expr->position(), expr->id(), prop->LoadId()); PushLoad(prop, object, expr->position());
after = BuildIncrement(returns_original_input, expr); after = BuildIncrement(returns_original_input, expr);
......
...@@ -1911,7 +1911,9 @@ class HOptimizedGraphBuilder V8_FINAL ...@@ -1911,7 +1911,9 @@ class HOptimizedGraphBuilder V8_FINAL
bool TryInlineCall(Call* expr, bool drop_extra = false); bool TryInlineCall(Call* expr, bool drop_extra = false);
bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value); bool TryInlineConstruct(CallNew* expr, HValue* implicit_return_value);
bool TryInlineGetter(Handle<JSFunction> getter, BailoutId return_id); bool TryInlineGetter(Handle<JSFunction> getter,
BailoutId ast_id,
BailoutId return_id);
bool TryInlineSetter(Handle<JSFunction> setter, bool TryInlineSetter(Handle<JSFunction> setter,
BailoutId id, BailoutId id,
BailoutId assignment_id, BailoutId assignment_id,
...@@ -2033,13 +2035,10 @@ class HOptimizedGraphBuilder V8_FINAL ...@@ -2033,13 +2035,10 @@ class HOptimizedGraphBuilder V8_FINAL
void BuildLoad(Property* property, void BuildLoad(Property* property,
int position, int position,
BailoutId ast_id, BailoutId ast_id);
BailoutId return_id);
void PushLoad(Property* property, void PushLoad(Property* property,
HValue* object, HValue* object,
int position, int position);
BailoutId ast_id,
BailoutId return_id);
void BuildStoreNamed(Expression* expression, void BuildStoreNamed(Expression* expression,
BailoutId id, BailoutId id,
......
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