Commit f6a886d5 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Rename JSGlobalSpecialization to JSNativeContextSpecialization.

R=jarin@chromium.org
BUG=v8:4470
LOG=n

Review URL: https://codereview.chromium.org/1410353002

Cr-Commit-Position: refs/heads/master@{#31356}
parent dbae315a
...@@ -757,8 +757,6 @@ source_set("v8_base") { ...@@ -757,8 +757,6 @@ source_set("v8_base") {
"src/compiler/js-frame-specialization.h", "src/compiler/js-frame-specialization.h",
"src/compiler/js-generic-lowering.cc", "src/compiler/js-generic-lowering.cc",
"src/compiler/js-generic-lowering.h", "src/compiler/js-generic-lowering.h",
"src/compiler/js-global-specialization.cc",
"src/compiler/js-global-specialization.h",
"src/compiler/js-graph.cc", "src/compiler/js-graph.cc",
"src/compiler/js-graph.h", "src/compiler/js-graph.h",
"src/compiler/js-inlining.cc", "src/compiler/js-inlining.cc",
...@@ -767,6 +765,8 @@ source_set("v8_base") { ...@@ -767,6 +765,8 @@ source_set("v8_base") {
"src/compiler/js-inlining-heuristic.h", "src/compiler/js-inlining-heuristic.h",
"src/compiler/js-intrinsic-lowering.cc", "src/compiler/js-intrinsic-lowering.cc",
"src/compiler/js-intrinsic-lowering.h", "src/compiler/js-intrinsic-lowering.h",
"src/compiler/js-native-context-specialization.cc",
"src/compiler/js-native-context-specialization.h",
"src/compiler/js-operator.cc", "src/compiler/js-operator.cc",
"src/compiler/js-operator.h", "src/compiler/js-operator.h",
"src/compiler/js-type-feedback.cc", "src/compiler/js-type-feedback.cc",
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "src/compiler/common-operator-reducer.h" #include "src/compiler/common-operator-reducer.h"
#include "src/compiler/dead-code-elimination.h" #include "src/compiler/dead-code-elimination.h"
#include "src/compiler/graph-reducer.h" #include "src/compiler/graph-reducer.h"
#include "src/compiler/js-global-specialization.h" #include "src/compiler/js-native-context-specialization.h"
#include "src/compiler/js-operator.h" #include "src/compiler/js-operator.h"
#include "src/compiler/node-matchers.h" #include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h" #include "src/compiler/node-properties.h"
...@@ -364,16 +364,16 @@ Reduction JSInliner::ReduceJSCallFunction(Node* node, ...@@ -364,16 +364,16 @@ Reduction JSInliner::ReduceJSCallFunction(Node* node,
jsgraph.common()); jsgraph.common());
CommonOperatorReducer common_reducer(&graph_reducer, &graph, CommonOperatorReducer common_reducer(&graph_reducer, &graph,
jsgraph.common(), jsgraph.machine()); jsgraph.common(), jsgraph.machine());
JSGlobalSpecialization global_specialization( JSNativeContextSpecialization native_context_specialization(
&graph_reducer, &jsgraph, &graph_reducer, &jsgraph,
info.is_deoptimization_enabled() info.is_deoptimization_enabled()
? JSGlobalSpecialization::kDeoptimizationEnabled ? JSNativeContextSpecialization::kDeoptimizationEnabled
: JSGlobalSpecialization::kNoFlags, : JSNativeContextSpecialization::kNoFlags,
handle(info.global_object(), info.isolate()), info_->dependencies(), handle(info.global_object(), info.isolate()), info_->dependencies(),
local_zone_); local_zone_);
graph_reducer.AddReducer(&dead_code_elimination); graph_reducer.AddReducer(&dead_code_elimination);
graph_reducer.AddReducer(&common_reducer); graph_reducer.AddReducer(&common_reducer);
graph_reducer.AddReducer(&global_specialization); graph_reducer.AddReducer(&native_context_specialization);
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "src/compiler/js-global-specialization.h" #include "src/compiler/js-native-context-specialization.h"
#include "src/compilation-dependencies.h" #include "src/compilation-dependencies.h"
#include "src/compiler/access-builder.h" #include "src/compiler/access-builder.h"
...@@ -18,14 +18,14 @@ namespace v8 { ...@@ -18,14 +18,14 @@ namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
struct JSGlobalSpecialization::ScriptContextTableLookupResult { struct JSNativeContextSpecialization::ScriptContextTableLookupResult {
Handle<Context> context; Handle<Context> context;
bool immutable; bool immutable;
int index; int index;
}; };
JSGlobalSpecialization::JSGlobalSpecialization( JSNativeContextSpecialization::JSNativeContextSpecialization(
Editor* editor, JSGraph* jsgraph, Flags flags, Editor* editor, JSGraph* jsgraph, Flags flags,
Handle<GlobalObject> global_object, CompilationDependencies* dependencies, Handle<GlobalObject> global_object, CompilationDependencies* dependencies,
Zone* zone) Zone* zone)
...@@ -37,7 +37,7 @@ JSGlobalSpecialization::JSGlobalSpecialization( ...@@ -37,7 +37,7 @@ JSGlobalSpecialization::JSGlobalSpecialization(
zone_(zone) {} zone_(zone) {}
Reduction JSGlobalSpecialization::Reduce(Node* node) { Reduction JSNativeContextSpecialization::Reduce(Node* node) {
switch (node->opcode()) { switch (node->opcode()) {
case IrOpcode::kJSLoadGlobal: case IrOpcode::kJSLoadGlobal:
return ReduceJSLoadGlobal(node); return ReduceJSLoadGlobal(node);
...@@ -52,7 +52,7 @@ Reduction JSGlobalSpecialization::Reduce(Node* node) { ...@@ -52,7 +52,7 @@ Reduction JSGlobalSpecialization::Reduce(Node* node) {
} }
Reduction JSGlobalSpecialization::ReduceJSLoadGlobal(Node* node) { Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode()); DCHECK_EQ(IrOpcode::kJSLoadGlobal, node->opcode());
Handle<Name> name = LoadGlobalParametersOf(node->op()).name(); Handle<Name> name = LoadGlobalParametersOf(node->op()).name();
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
...@@ -131,7 +131,7 @@ Reduction JSGlobalSpecialization::ReduceJSLoadGlobal(Node* node) { ...@@ -131,7 +131,7 @@ Reduction JSGlobalSpecialization::ReduceJSLoadGlobal(Node* node) {
} }
Reduction JSGlobalSpecialization::ReduceJSStoreGlobal(Node* node) { Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreGlobal, node->opcode()); DCHECK_EQ(IrOpcode::kJSStoreGlobal, node->opcode());
Handle<Name> name = StoreGlobalParametersOf(node->op()).name(); Handle<Name> name = StoreGlobalParametersOf(node->op()).name();
Node* value = NodeProperties::GetValueInput(node, 2); Node* value = NodeProperties::GetValueInput(node, 2);
...@@ -238,7 +238,7 @@ Reduction JSGlobalSpecialization::ReduceJSStoreGlobal(Node* node) { ...@@ -238,7 +238,7 @@ Reduction JSGlobalSpecialization::ReduceJSStoreGlobal(Node* node) {
// This class encapsulates all information required to access a certain // This class encapsulates all information required to access a certain
// object property, either on the object itself or on the prototype chain. // object property, either on the object itself or on the prototype chain.
class JSGlobalSpecialization::PropertyAccessInfo final { class JSNativeContextSpecialization::PropertyAccessInfo final {
public: public:
enum Kind { kInvalid, kData, kDataConstant }; enum Kind { kInvalid, kData, kDataConstant };
...@@ -304,7 +304,7 @@ bool CanInlinePropertyAccess(Handle<Map> map) { ...@@ -304,7 +304,7 @@ bool CanInlinePropertyAccess(Handle<Map> map) {
} // namespace } // namespace
bool JSGlobalSpecialization::ComputePropertyAccessInfo( bool JSNativeContextSpecialization::ComputePropertyAccessInfo(
Handle<Map> map, Handle<Name> name, PropertyAccessInfo* access_info) { Handle<Map> map, Handle<Name> name, PropertyAccessInfo* access_info) {
MaybeHandle<JSObject> holder; MaybeHandle<JSObject> holder;
Type* receiver_type = Type::Class(map, graph()->zone()); Type* receiver_type = Type::Class(map, graph()->zone());
...@@ -358,7 +358,7 @@ bool JSGlobalSpecialization::ComputePropertyAccessInfo( ...@@ -358,7 +358,7 @@ bool JSGlobalSpecialization::ComputePropertyAccessInfo(
} }
bool JSGlobalSpecialization::ComputePropertyAccessInfos( bool JSNativeContextSpecialization::ComputePropertyAccessInfos(
MapHandleList const& maps, Handle<Name> name, MapHandleList const& maps, Handle<Name> name,
ZoneVector<PropertyAccessInfo>* access_infos) { ZoneVector<PropertyAccessInfo>* access_infos) {
for (Handle<Map> map : maps) { for (Handle<Map> map : maps) {
...@@ -370,7 +370,7 @@ bool JSGlobalSpecialization::ComputePropertyAccessInfos( ...@@ -370,7 +370,7 @@ bool JSGlobalSpecialization::ComputePropertyAccessInfos(
} }
Reduction JSGlobalSpecialization::ReduceJSLoadNamed(Node* node) { Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
LoadNamedParameters const p = LoadNamedParametersOf(node->op()); LoadNamedParameters const p = LoadNamedParametersOf(node->op());
Handle<Name> name = p.name(); Handle<Name> name = p.name();
...@@ -553,11 +553,11 @@ Reduction JSGlobalSpecialization::ReduceJSLoadNamed(Node* node) { ...@@ -553,11 +553,11 @@ Reduction JSGlobalSpecialization::ReduceJSLoadNamed(Node* node) {
// Collect the fallthru control as final "exit" control. // Collect the fallthru control as final "exit" control.
exit_controls.push_back(fallthrough_control); exit_controls.push_back(fallthrough_control);
// TODO(bmeurer/mtrofin): Splintering cannot currently deal with deferred // TODO(bmeurer/mtrofin): Splintering cannot currently deal with deferred
// blocks that contain only a single non-deoptimize instruction (i.e. a // blocks that contain only a single non-deoptimize instruction (i.e. a
// jump). Generating a single Merge here, which joins all the deoptimizing // jump). Generating a single Merge here, which joins all the deoptimizing
// controls would generate a lot of these basic blocks, however. So this // controls would generate a lot of these basic blocks, however. So this
// is disabled for now until splintering is fixed. // is disabled for now until splintering is fixed.
#if 0 #if 0
// Generate the single "exit" point, where we get if either all map/instance // Generate the single "exit" point, where we get if either all map/instance
// type checks failed, or one of the assumptions inside one of the cases // type checks failed, or one of the assumptions inside one of the cases
...@@ -604,12 +604,13 @@ Reduction JSGlobalSpecialization::ReduceJSLoadNamed(Node* node) { ...@@ -604,12 +604,13 @@ Reduction JSGlobalSpecialization::ReduceJSLoadNamed(Node* node) {
} }
Reduction JSGlobalSpecialization::Replace(Node* node, Handle<Object> value) { Reduction JSNativeContextSpecialization::Replace(Node* node,
Handle<Object> value) {
return Replace(node, jsgraph()->Constant(value)); return Replace(node, jsgraph()->Constant(value));
} }
bool JSGlobalSpecialization::LookupInScriptContextTable( bool JSNativeContextSpecialization::LookupInScriptContextTable(
Handle<Name> name, ScriptContextTableLookupResult* result) { Handle<Name> name, ScriptContextTableLookupResult* result) {
if (!name->IsString()) return false; if (!name->IsString()) return false;
Handle<ScriptContextTable> script_context_table( Handle<ScriptContextTable> script_context_table(
...@@ -629,30 +630,32 @@ bool JSGlobalSpecialization::LookupInScriptContextTable( ...@@ -629,30 +630,32 @@ bool JSGlobalSpecialization::LookupInScriptContextTable(
} }
Graph* JSGlobalSpecialization::graph() const { return jsgraph()->graph(); } Graph* JSNativeContextSpecialization::graph() const {
return jsgraph()->graph();
}
Isolate* JSGlobalSpecialization::isolate() const { Isolate* JSNativeContextSpecialization::isolate() const {
return jsgraph()->isolate(); return jsgraph()->isolate();
} }
MachineOperatorBuilder* JSGlobalSpecialization::machine() const { MachineOperatorBuilder* JSNativeContextSpecialization::machine() const {
return jsgraph()->machine(); return jsgraph()->machine();
} }
CommonOperatorBuilder* JSGlobalSpecialization::common() const { CommonOperatorBuilder* JSNativeContextSpecialization::common() const {
return jsgraph()->common(); return jsgraph()->common();
} }
JSOperatorBuilder* JSGlobalSpecialization::javascript() const { JSOperatorBuilder* JSNativeContextSpecialization::javascript() const {
return jsgraph()->javascript(); return jsgraph()->javascript();
} }
SimplifiedOperatorBuilder* JSGlobalSpecialization::simplified() const { SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const {
return jsgraph()->simplified(); return jsgraph()->simplified();
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef V8_COMPILER_JS_GLOBAL_SPECIALIZATION_H_ #ifndef V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_
#define V8_COMPILER_JS_GLOBAL_SPECIALIZATION_H_ #define V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_
#include "src/base/flags.h" #include "src/base/flags.h"
#include "src/compiler/graph-reducer.h" #include "src/compiler/graph-reducer.h"
...@@ -25,10 +25,11 @@ class JSOperatorBuilder; ...@@ -25,10 +25,11 @@ class JSOperatorBuilder;
class MachineOperatorBuilder; class MachineOperatorBuilder;
// Specializes a given JSGraph to a given GlobalObject, potentially constant // Specializes a given JSGraph to a given native context, potentially constant
// folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal} // folding some {LoadGlobal} nodes or strength reducing some {StoreGlobal}
// nodes. // nodes. And also specializes {LoadNamed} and {StoreNamed} nodes according
class JSGlobalSpecialization final : public AdvancedReducer { // to type feedback (if available).
class JSNativeContextSpecialization final : public AdvancedReducer {
public: public:
// Flags that control the mode of operation. // Flags that control the mode of operation.
enum Flag { enum Flag {
...@@ -37,9 +38,10 @@ class JSGlobalSpecialization final : public AdvancedReducer { ...@@ -37,9 +38,10 @@ class JSGlobalSpecialization final : public AdvancedReducer {
}; };
typedef base::Flags<Flag> Flags; typedef base::Flags<Flag> Flags;
JSGlobalSpecialization(Editor* editor, JSGraph* jsgraph, Flags flags, JSNativeContextSpecialization(Editor* editor, JSGraph* jsgraph, Flags flags,
Handle<GlobalObject> global_object, Handle<GlobalObject> global_object,
CompilationDependencies* dependencies, Zone* zone); CompilationDependencies* dependencies,
Zone* zone);
Reduction Reduce(Node* node) final; Reduction Reduce(Node* node) final;
...@@ -83,13 +85,13 @@ class JSGlobalSpecialization final : public AdvancedReducer { ...@@ -83,13 +85,13 @@ class JSGlobalSpecialization final : public AdvancedReducer {
CompilationDependencies* const dependencies_; CompilationDependencies* const dependencies_;
Zone* const zone_; Zone* const zone_;
DISALLOW_COPY_AND_ASSIGN(JSGlobalSpecialization); DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization);
}; };
DEFINE_OPERATORS_FOR_FLAGS(JSGlobalSpecialization::Flags) DEFINE_OPERATORS_FOR_FLAGS(JSNativeContextSpecialization::Flags)
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
#endif // V8_COMPILER_JS_GLOBAL_SPECIALIZATION_H_ #endif // V8_COMPILER_JS_NATIVE_CONTEXT_SPECIALIZATION_H_
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
#include "src/compiler/js-context-specialization.h" #include "src/compiler/js-context-specialization.h"
#include "src/compiler/js-frame-specialization.h" #include "src/compiler/js-frame-specialization.h"
#include "src/compiler/js-generic-lowering.h" #include "src/compiler/js-generic-lowering.h"
#include "src/compiler/js-global-specialization.h"
#include "src/compiler/js-inlining-heuristic.h" #include "src/compiler/js-inlining-heuristic.h"
#include "src/compiler/js-intrinsic-lowering.h" #include "src/compiler/js-intrinsic-lowering.h"
#include "src/compiler/js-native-context-specialization.h"
#include "src/compiler/js-type-feedback.h" #include "src/compiler/js-type-feedback.h"
#include "src/compiler/js-type-feedback-lowering.h" #include "src/compiler/js-type-feedback-lowering.h"
#include "src/compiler/js-typed-lowering.h" #include "src/compiler/js-typed-lowering.h"
...@@ -513,16 +513,16 @@ struct NativeContextSpecializationPhase { ...@@ -513,16 +513,16 @@ struct NativeContextSpecializationPhase {
data->common()); data->common());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(), CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine()); data->common(), data->machine());
JSGlobalSpecialization global_specialization( JSNativeContextSpecialization native_context_specialization(
&graph_reducer, data->jsgraph(), &graph_reducer, data->jsgraph(),
data->info()->is_deoptimization_enabled() data->info()->is_deoptimization_enabled()
? JSGlobalSpecialization::kDeoptimizationEnabled ? JSNativeContextSpecialization::kDeoptimizationEnabled
: JSGlobalSpecialization::kNoFlags, : JSNativeContextSpecialization::kNoFlags,
handle(data->info()->global_object(), data->isolate()), handle(data->info()->global_object(), data->isolate()),
data->info()->dependencies(), temp_zone); data->info()->dependencies(), temp_zone);
AddReducer(data, &graph_reducer, &dead_code_elimination); AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &common_reducer); AddReducer(data, &graph_reducer, &common_reducer);
AddReducer(data, &graph_reducer, &global_specialization); AddReducer(data, &graph_reducer, &native_context_specialization);
graph_reducer.ReduceGraph(); graph_reducer.ReduceGraph();
} }
}; };
......
...@@ -522,8 +522,6 @@ ...@@ -522,8 +522,6 @@
'../../src/compiler/js-frame-specialization.h', '../../src/compiler/js-frame-specialization.h',
'../../src/compiler/js-generic-lowering.cc', '../../src/compiler/js-generic-lowering.cc',
'../../src/compiler/js-generic-lowering.h', '../../src/compiler/js-generic-lowering.h',
'../../src/compiler/js-global-specialization.cc',
'../../src/compiler/js-global-specialization.h',
'../../src/compiler/js-graph.cc', '../../src/compiler/js-graph.cc',
'../../src/compiler/js-graph.h', '../../src/compiler/js-graph.h',
'../../src/compiler/js-inlining.cc', '../../src/compiler/js-inlining.cc',
...@@ -532,6 +530,8 @@ ...@@ -532,6 +530,8 @@
'../../src/compiler/js-inlining-heuristic.h', '../../src/compiler/js-inlining-heuristic.h',
'../../src/compiler/js-intrinsic-lowering.cc', '../../src/compiler/js-intrinsic-lowering.cc',
'../../src/compiler/js-intrinsic-lowering.h', '../../src/compiler/js-intrinsic-lowering.h',
'../../src/compiler/js-native-context-specialization.cc',
'../../src/compiler/js-native-context-specialization.h',
'../../src/compiler/js-operator.cc', '../../src/compiler/js-operator.cc',
'../../src/compiler/js-operator.h', '../../src/compiler/js-operator.h',
'../../src/compiler/js-type-feedback.cc', '../../src/compiler/js-type-feedback.cc',
......
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