Reviewers: Igor Sheludko,
Message:
PTAL
Description:
Merge BuildLoadKeyedGeneric and BuildStoreKeyedGeneric, switch on AccessType
Please review this at https://codereview.chromium.org/146623007/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+25, -39 lines):
M src/hydrogen.h
M src/hydrogen.cc
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
05d4764e83f646af313c19a3a0cf99bfb5bdfeef..da415d463717bee4400ac088d80836f2cb672ecb
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -6167,9 +6167,17 @@ HInstruction*
HOptimizedGraphBuilder::BuildNamedGeneric(
-HInstruction* HOptimizedGraphBuilder::BuildLoadKeyedGeneric(HValue* object,
- HValue* key) {
- return New<HLoadKeyedGeneric>(object, key);
+HInstruction* HOptimizedGraphBuilder::BuildKeyedGeneric(
+ PropertyAccessType access_type,
+ HValue* object,
+ HValue* key,
+ HValue* value) {
+ if (access_type == LOAD) {
+ return New<HLoadKeyedGeneric>(object, key);
+ } else {
+ return New<HStoreKeyedGeneric>(
+ object, key, value, function_strict_mode_flag());
+ }
}
@@ -6357,9 +6365,7 @@ HValue*
HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
HInstruction* instr = NULL;
if (untransitionable_map->has_slow_elements_kind() ||
!untransitionable_map->IsJSObjectMap()) {
- instr = AddInstruction(access_type == STORE
- ? BuildStoreKeyedGeneric(object, key, val)
- : BuildLoadKeyedGeneric(object, key));
+ instr = AddInstruction(BuildKeyedGeneric(access_type, object, key,
val));
} else {
instr = BuildMonomorphicElementAccess(
object, key, val, transition, untransitionable_map, access_type,
@@ -6384,9 +6390,7 @@ HValue*
HOptimizedGraphBuilder::HandlePolymorphicElementAccess(
set_current_block(this_map);
HInstruction* access = NULL;
if (IsDictionaryElementsKind(elements_kind)) {
- access = access_type == STORE
- ? AddInstruction(BuildStoreKeyedGeneric(object, key, val))
- : AddInstruction(BuildLoadKeyedGeneric(object, key));
+ access = AddInstruction(BuildKeyedGeneric(access_type, object, key,
val));
} else {
ASSERT(IsFastElementsKind(elements_kind) ||
IsExternalArrayElementsKind(elements_kind));
@@ -6452,10 +6456,7 @@ HValue*
HOptimizedGraphBuilder::HandleKeyedElementAccess(
if (monomorphic) {
Handle<Map> map = types->first();
if (map->has_slow_elements_kind() || !map->IsJSObjectMap()) {
- instr = access_type == STORE
- ? BuildStoreKeyedGeneric(obj, key, val)
- : BuildLoadKeyedGeneric(obj, key);
- AddInstruction(instr);
+ instr = AddInstruction(BuildKeyedGeneric(access_type, obj, key,
val));
} else {
BuildCheckHeapObject(obj);
instr = BuildMonomorphicElementAccess(
@@ -6472,33 +6473,19 @@ HValue*
HOptimizedGraphBuilder::HandleKeyedElementAccess(
Add<HDeoptimize>("Insufficient type feedback for keyed store",
Deoptimizer::SOFT);
}
- instr = BuildStoreKeyedGeneric(obj, key, val);
} else {
if (expr->AsProperty()->HasNoTypeInformation()) {
Add<HDeoptimize>("Insufficient type feedback for keyed load",
Deoptimizer::SOFT);
}
- instr = BuildLoadKeyedGeneric(obj, key);
}
- AddInstruction(instr);
+ instr = AddInstruction(BuildKeyedGeneric(access_type, obj, key, val));
}
*has_side_effects = instr->HasObservableSideEffects();
return instr;
}
-HInstruction* HOptimizedGraphBuilder::BuildStoreKeyedGeneric(
- HValue* object,
- HValue* key,
- HValue* value) {
- return New<HStoreKeyedGeneric>(
- object,
- key,
- value,
- function_strict_mode_flag());
-}
-
-
void HOptimizedGraphBuilder::EnsureArgumentsArePushedForAccess() {
// Outermost function already has arguments on the stack.
if (function_state()->outer() == NULL) return;
Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index
d25bb5f9bdadd9e70a7fc5e3a0bfdb992df917f9..926f63da912d3f176590117f501b2a6cc98d26b8
100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -2439,8 +2439,10 @@ class HOptimizedGraphBuilder : public HGraphBuilder,
public AstVisitor {
PushBeforeSimulateBehavior push_sim_result);
HInstruction* BuildIncrement(bool returns_original_input,
CountOperation* expr);
- HInstruction* BuildLoadKeyedGeneric(HValue* object,
- HValue* key);
+ HInstruction* BuildKeyedGeneric(PropertyAccessType access_type,
+ HValue* object,
+ HValue* key,
+ HValue* value);
HInstruction* TryBuildConsolidatedElementLoad(HValue* object,
HValue* key,
@@ -2458,12 +2460,12 @@ class HOptimizedGraphBuilder : public
HGraphBuilder, public AstVisitor {
KeyedAccessStoreMode
store_mode);
HValue* HandlePolymorphicElementAccess(HValue* object,
- HValue* key,
- HValue* val,
- SmallMapList* maps,
- PropertyAccessType access_type,
- KeyedAccessStoreMode store_mode,
- bool* has_side_effects);
+ HValue* key,
+ HValue* val,
+ SmallMapList* maps,
+ PropertyAccessType access_type,
+ KeyedAccessStoreMode store_mode,
+ bool* has_side_effects);
HValue* HandleKeyedElementAccess(HValue* obj,
HValue* key,
@@ -2503,9 +2505,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder,
public AstVisitor {
HInstruction* BuildStoreNamedField(PropertyAccessInfo* info,
HValue* checked_object,
HValue* value);
- HInstruction* BuildStoreKeyedGeneric(HValue* object,
- HValue* key,
- HValue* value);
HValue* BuildContextChainWalk(Variable* var);
--
--
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.