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