Revision: 19109
Author: [email protected]
Date: Wed Feb 5 15:44:20 2014 UTC
Log: Merge named part of BuildLoad and BuildStore
BUG=
[email protected]
Review URL: https://codereview.chromium.org/149803007
http://code.google.com/p/v8/source/detail?r=19109
Modified:
/branches/bleeding_edge/src/ast.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
=======================================
--- /branches/bleeding_edge/src/ast.h Fri Jan 31 16:52:17 2014 UTC
+++ /branches/bleeding_edge/src/ast.h Wed Feb 5 15:44:20 2014 UTC
@@ -1694,7 +1694,7 @@
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_;
}
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Wed Feb 5 15:43:33 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc Wed Feb 5 15:44:20 2014 UTC
@@ -5800,34 +5800,9 @@
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* 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);
}
@@ -6622,6 +6597,49 @@
ast_context()->ReturnInstruction(result, expr->id());
return true;
}
+
+
+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,
@@ -6653,34 +6671,10 @@
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 @@
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);
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Wed Feb 5 15:43:33 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.h Wed Feb 5 15:44:20 2014 UTC
@@ -2387,6 +2387,15 @@
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 @@
HInstruction* BuildLoadNamedGeneric(HValue* object,
Handle<String> name,
- Property* expr);
+ bool is_uninitialized = false);
HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.