Commit 0f7ea219 authored by franzih's avatar franzih Committed by Commit bot

[compiler] Delete extra map check.

Use HeapConstant for string_iterator_map rather than loading it
manually. This avoids unnecessary map checks.

BUG= v8:3822,v8:5267

Review-Url: https://codereview.chromium.org/2479563003
Cr-Commit-Position: refs/heads/master@{#40741}
parent cdf9a406
...@@ -96,11 +96,13 @@ class JSCallReduction { ...@@ -96,11 +96,13 @@ class JSCallReduction {
JSBuiltinReducer::JSBuiltinReducer(Editor* editor, JSGraph* jsgraph, JSBuiltinReducer::JSBuiltinReducer(Editor* editor, JSGraph* jsgraph,
Flags flags, Flags flags,
CompilationDependencies* dependencies) CompilationDependencies* dependencies,
Handle<Context> native_context)
: AdvancedReducer(editor), : AdvancedReducer(editor),
dependencies_(dependencies), dependencies_(dependencies),
flags_(flags), flags_(flags),
jsgraph_(jsgraph), jsgraph_(jsgraph),
native_context_(native_context),
type_cache_(TypeCache::Get()) {} type_cache_(TypeCache::Get()) {}
namespace { namespace {
...@@ -1033,14 +1035,9 @@ Reduction JSBuiltinReducer::ReduceStringIterator(Node* node) { ...@@ -1033,14 +1035,9 @@ Reduction JSBuiltinReducer::ReduceStringIterator(Node* node) {
if (Node* receiver = GetStringWitness(node)) { if (Node* receiver = GetStringWitness(node)) {
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node); Node* control = NodeProperties::GetControlInput(node);
Node* context = NodeProperties::GetContextInput(node);
Node* native_context = effect = graph()->NewNode( Node* map = jsgraph()->HeapConstant(
javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), handle(native_context()->string_iterator_map(), isolate()));
context, context, effect);
Node* map = effect = graph()->NewNode(
javascript()->LoadContext(0, Context::STRING_ITERATOR_MAP_INDEX, true),
native_context, native_context, effect);
// allocate new iterator // allocate new iterator
effect = graph()->NewNode( effect = graph()->NewNode(
......
...@@ -38,7 +38,8 @@ class V8_EXPORT_PRIVATE JSBuiltinReducer final ...@@ -38,7 +38,8 @@ class V8_EXPORT_PRIVATE JSBuiltinReducer final
typedef base::Flags<Flag> Flags; typedef base::Flags<Flag> Flags;
JSBuiltinReducer(Editor* editor, JSGraph* jsgraph, Flags flags, JSBuiltinReducer(Editor* editor, JSGraph* jsgraph, Flags flags,
CompilationDependencies* dependencies); CompilationDependencies* dependencies,
Handle<Context> native_context);
~JSBuiltinReducer() final {} ~JSBuiltinReducer() final {}
Reduction Reduce(Node* node) final; Reduction Reduce(Node* node) final;
...@@ -104,6 +105,7 @@ class V8_EXPORT_PRIVATE JSBuiltinReducer final ...@@ -104,6 +105,7 @@ class V8_EXPORT_PRIVATE JSBuiltinReducer final
Factory* factory() const; Factory* factory() const;
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const; Isolate* isolate() const;
Handle<Context> native_context() const { return native_context_; }
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
SimplifiedOperatorBuilder* simplified() const; SimplifiedOperatorBuilder* simplified() const;
JSOperatorBuilder* javascript() const; JSOperatorBuilder* javascript() const;
...@@ -112,6 +114,7 @@ class V8_EXPORT_PRIVATE JSBuiltinReducer final ...@@ -112,6 +114,7 @@ class V8_EXPORT_PRIVATE JSBuiltinReducer final
CompilationDependencies* const dependencies_; CompilationDependencies* const dependencies_;
Flags const flags_; Flags const flags_;
JSGraph* const jsgraph_; JSGraph* const jsgraph_;
Handle<Context> const native_context_;
TypeCache const& type_cache_; TypeCache const& type_cache_;
}; };
......
...@@ -918,7 +918,7 @@ struct TypedLoweringPhase { ...@@ -918,7 +918,7 @@ struct TypedLoweringPhase {
data->info()->is_deoptimization_enabled() data->info()->is_deoptimization_enabled()
? JSBuiltinReducer::kDeoptimizationEnabled ? JSBuiltinReducer::kDeoptimizationEnabled
: JSBuiltinReducer::kNoFlags, : JSBuiltinReducer::kNoFlags,
data->info()->dependencies()); data->info()->dependencies(), data->native_context());
Handle<LiteralsArray> literals_array(data->info()->closure()->literals()); Handle<LiteralsArray> literals_array(data->info()->closure()->literals());
JSCreateLowering create_lowering( JSCreateLowering create_lowering(
&graph_reducer, data->info()->dependencies(), data->jsgraph(), &graph_reducer, data->info()->dependencies(), data->jsgraph(),
......
...@@ -33,8 +33,10 @@ class JSBuiltinReducerTest : public TypedGraphTest { ...@@ -33,8 +33,10 @@ class JSBuiltinReducerTest : public TypedGraphTest {
&machine); &machine);
// TODO(titzer): mock the GraphReducer here for better unit testing. // TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph()); GraphReducer graph_reducer(zone(), graph());
JSBuiltinReducer reducer(&graph_reducer, &jsgraph, JSBuiltinReducer reducer(&graph_reducer, &jsgraph,
JSBuiltinReducer::kNoFlags, nullptr); JSBuiltinReducer::kNoFlags, nullptr,
native_context());
return reducer.Reduce(node); return reducer.Reduce(node);
} }
......
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