Merge named part of BuildLoad and BuildStore
BUG= R=dcarney@chromium.org Review URL: https://codereview.chromium.org/149803007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19109 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d985948c7a
commit
5949fe1679
@ -1694,7 +1694,7 @@ class Property V8_FINAL : public Expression {
|
||||
virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE {
|
||||
return STANDARD_STORE;
|
||||
}
|
||||
bool IsUninitialized() { return is_uninitialized_; }
|
||||
bool IsUninitialized() { return !is_for_call_ && is_uninitialized_; }
|
||||
bool HasNoTypeInformation() {
|
||||
return is_uninitialized_;
|
||||
}
|
||||
|
113
src/hydrogen.cc
113
src/hydrogen.cc
@ -5800,34 +5800,9 @@ void HOptimizedGraphBuilder::BuildStore(Expression* expr,
|
||||
Handle<String> name = Handle<String>::cast(key->value());
|
||||
ASSERT(!name.is_null());
|
||||
|
||||
HInstruction* instr = NULL;
|
||||
|
||||
SmallMapList* types;
|
||||
ComputeReceiverTypes(expr, object, &types, zone());
|
||||
|
||||
if (types->length() > 0) {
|
||||
PropertyAccessInfo info(this, STORE, ToType(types->first()), name);
|
||||
if (!info.CanAccessAsMonomorphic(types)) {
|
||||
return HandlePolymorphicNamedFieldAccess(
|
||||
STORE, ast_id, return_id, object, value, types, name);
|
||||
}
|
||||
|
||||
ASSERT(!info.type()->Is(Type::Number()));
|
||||
BuildCheckHeapObject(object);
|
||||
HValue* checked_object;
|
||||
if (AreStringTypes(types)) {
|
||||
checked_object = Add<HCheckInstanceType>(
|
||||
object, HCheckInstanceType::IS_STRING);
|
||||
} else {
|
||||
checked_object = Add<HCheckMaps>(object, types);
|
||||
}
|
||||
instr = BuildMonomorphicAccess(
|
||||
&info, object, checked_object, value, ast_id, return_id);
|
||||
if (instr == NULL) return;
|
||||
ASSERT(!instr->IsLinked());
|
||||
} else {
|
||||
instr = BuildStoreNamedGeneric(object, name, value, is_uninitialized);
|
||||
}
|
||||
HInstruction* instr = BuildNamedAccess(STORE, ast_id, return_id, expr,
|
||||
object, name, value, is_uninitialized);
|
||||
if (instr == NULL) return;
|
||||
|
||||
if (!ast_context()->IsEffect()) Push(value);
|
||||
AddInstruction(instr);
|
||||
@ -6208,8 +6183,8 @@ HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) {
|
||||
HInstruction* HOptimizedGraphBuilder::BuildLoadNamedGeneric(
|
||||
HValue* object,
|
||||
Handle<String> name,
|
||||
Property* expr) {
|
||||
if (!expr->IsForCall() && expr->IsUninitialized()) {
|
||||
bool is_uninitialized) {
|
||||
if (is_uninitialized) {
|
||||
Add<HDeoptimize>("Insufficient type feedback for generic named load",
|
||||
Deoptimizer::SOFT);
|
||||
}
|
||||
@ -6624,6 +6599,49 @@ bool HOptimizedGraphBuilder::TryArgumentsAccess(Property* expr) {
|
||||
}
|
||||
|
||||
|
||||
HInstruction* HOptimizedGraphBuilder::BuildNamedAccess(
|
||||
PropertyAccessType access,
|
||||
BailoutId ast_id,
|
||||
BailoutId return_id,
|
||||
Expression* expr,
|
||||
HValue* object,
|
||||
Handle<String> name,
|
||||
HValue* value,
|
||||
bool is_uninitialized) {
|
||||
SmallMapList* types;
|
||||
ComputeReceiverTypes(expr, object, &types, zone());
|
||||
ASSERT(types != NULL);
|
||||
|
||||
if (types->length() > 0) {
|
||||
PropertyAccessInfo info(this, access, ToType(types->first()), name);
|
||||
if (!info.CanAccessAsMonomorphic(types)) {
|
||||
HandlePolymorphicNamedFieldAccess(
|
||||
access, ast_id, return_id, object, value, types, name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HValue* checked_object;
|
||||
// Type::Number() is only supported by polymorphic load/call handling.
|
||||
ASSERT(!info.type()->Is(Type::Number()));
|
||||
BuildCheckHeapObject(object);
|
||||
if (AreStringTypes(types)) {
|
||||
checked_object =
|
||||
Add<HCheckInstanceType>(object, HCheckInstanceType::IS_STRING);
|
||||
} else {
|
||||
checked_object = Add<HCheckMaps>(object, types);
|
||||
}
|
||||
return BuildMonomorphicAccess(
|
||||
&info, object, checked_object, value, ast_id, return_id);
|
||||
}
|
||||
|
||||
if (access == LOAD) {
|
||||
return BuildLoadNamedGeneric(object, name, is_uninitialized);
|
||||
} else {
|
||||
return BuildStoreNamedGeneric(object, name, value, is_uninitialized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void HOptimizedGraphBuilder::PushLoad(Property* expr,
|
||||
HValue* object,
|
||||
HValue* key) {
|
||||
@ -6653,34 +6671,10 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr,
|
||||
Handle<String> name = expr->key()->AsLiteral()->AsPropertyName();
|
||||
HValue* object = Pop();
|
||||
|
||||
SmallMapList* types;
|
||||
ComputeReceiverTypes(expr, object, &types, zone());
|
||||
ASSERT(types != NULL);
|
||||
|
||||
if (types->length() > 0) {
|
||||
PropertyAccessInfo info(this, LOAD, ToType(types->first()), name);
|
||||
if (!info.CanAccessAsMonomorphic(types)) {
|
||||
return HandlePolymorphicNamedFieldAccess(
|
||||
LOAD, ast_id, expr->LoadId(), object, NULL, types, name);
|
||||
}
|
||||
|
||||
HValue* checked_object;
|
||||
// Type::Number() is only supported by polymorphic load/call handling.
|
||||
ASSERT(!info.type()->Is(Type::Number()));
|
||||
BuildCheckHeapObject(object);
|
||||
if (AreStringTypes(types)) {
|
||||
checked_object =
|
||||
Add<HCheckInstanceType>(object, HCheckInstanceType::IS_STRING);
|
||||
} else {
|
||||
checked_object = Add<HCheckMaps>(object, types);
|
||||
}
|
||||
instr = BuildMonomorphicAccess(
|
||||
&info, object, checked_object, NULL, ast_id, expr->LoadId());
|
||||
if (instr == NULL) return;
|
||||
if (instr->IsLinked()) return ast_context()->ReturnValue(instr);
|
||||
} else {
|
||||
instr = BuildLoadNamedGeneric(object, name, expr);
|
||||
}
|
||||
instr = BuildNamedAccess(LOAD, ast_id, expr->LoadId(), expr,
|
||||
object, name, NULL, expr->IsUninitialized());
|
||||
if (instr == NULL) return;
|
||||
if (instr->IsLinked()) return ast_context()->ReturnValue(instr);
|
||||
|
||||
} else {
|
||||
HValue* key = Pop();
|
||||
@ -6996,7 +6990,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
|
||||
FinishExitWithHardDeoptimization("Unknown map in polymorphic call", join);
|
||||
} else {
|
||||
Property* prop = expr->expression()->AsProperty();
|
||||
HInstruction* function = BuildLoadNamedGeneric(receiver, name, prop);
|
||||
HInstruction* function = BuildLoadNamedGeneric(
|
||||
receiver, name, prop->IsUninitialized());
|
||||
AddInstruction(function);
|
||||
Push(function);
|
||||
AddSimulate(prop->LoadId(), REMOVABLE_SIMULATE);
|
||||
|
@ -2387,6 +2387,15 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
|
||||
BailoutId return_id,
|
||||
bool can_inline_accessor = true);
|
||||
|
||||
HInstruction* BuildNamedAccess(PropertyAccessType access,
|
||||
BailoutId ast_id,
|
||||
BailoutId reutrn_id,
|
||||
Expression* expr,
|
||||
HValue* object,
|
||||
Handle<String> name,
|
||||
HValue* value,
|
||||
bool is_uninitialized = false);
|
||||
|
||||
void HandlePolymorphicCallNamed(Call* expr,
|
||||
HValue* receiver,
|
||||
SmallMapList* types,
|
||||
@ -2449,7 +2458,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
|
||||
|
||||
HInstruction* BuildLoadNamedGeneric(HValue* object,
|
||||
Handle<String> name,
|
||||
Property* expr);
|
||||
bool is_uninitialized = false);
|
||||
|
||||
HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user