7f21e67b38
Adds a protector cell to prevent inlining (which will likely lead to deopt loops) when a JSArrayIterator's array transitions from a fast JSArray to a slow JSArray (such as, when the array is touched during iteration in a way which triggers a map transition). Also adds TODO comments relating to the spec update proposed by Dan at https://github.com/tc39/ecma262/pull/724 BUG=v8:5388 R=bmeurer@chromium.org, mstarzinger@chromium.org TBR=hpayer@chromium.org, ulan@chromium.org Review-Url: https://codereview.chromium.org/2484003002 Cr-Commit-Position: refs/heads/master@{#40970}
109 lines
4.0 KiB
C++
109 lines
4.0 KiB
C++
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef V8_COMPILER_JS_CREATE_LOWERING_H_
|
|
#define V8_COMPILER_JS_CREATE_LOWERING_H_
|
|
|
|
#include "src/base/compiler-specific.h"
|
|
#include "src/compiler/graph-reducer.h"
|
|
#include "src/globals.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
// Forward declarations.
|
|
class AllocationSiteUsageContext;
|
|
class CompilationDependencies;
|
|
class Factory;
|
|
|
|
|
|
namespace compiler {
|
|
|
|
// Forward declarations.
|
|
class CommonOperatorBuilder;
|
|
class JSGraph;
|
|
class JSOperatorBuilder;
|
|
class MachineOperatorBuilder;
|
|
class SimplifiedOperatorBuilder;
|
|
|
|
|
|
// Lowers JSCreate-level operators to fast (inline) allocations.
|
|
class V8_EXPORT_PRIVATE JSCreateLowering final
|
|
: public NON_EXPORTED_BASE(AdvancedReducer) {
|
|
public:
|
|
JSCreateLowering(Editor* editor, CompilationDependencies* dependencies,
|
|
JSGraph* jsgraph, MaybeHandle<LiteralsArray> literals_array,
|
|
Handle<Context> native_context, Zone* zone)
|
|
: AdvancedReducer(editor),
|
|
dependencies_(dependencies),
|
|
jsgraph_(jsgraph),
|
|
literals_array_(literals_array),
|
|
native_context_(native_context),
|
|
zone_(zone) {}
|
|
~JSCreateLowering() final {}
|
|
|
|
Reduction Reduce(Node* node) final;
|
|
|
|
private:
|
|
Reduction ReduceJSCreate(Node* node);
|
|
Reduction ReduceJSCreateArguments(Node* node);
|
|
Reduction ReduceJSCreateArray(Node* node);
|
|
Reduction ReduceJSCreateClosure(Node* node);
|
|
Reduction ReduceJSCreateIterResultObject(Node* node);
|
|
Reduction ReduceJSCreateKeyValueArray(Node* node);
|
|
Reduction ReduceJSCreateLiteral(Node* node);
|
|
Reduction ReduceJSCreateFunctionContext(Node* node);
|
|
Reduction ReduceJSCreateWithContext(Node* node);
|
|
Reduction ReduceJSCreateCatchContext(Node* node);
|
|
Reduction ReduceJSCreateBlockContext(Node* node);
|
|
Reduction ReduceNewArray(Node* node, Node* length, int capacity,
|
|
Handle<AllocationSite> site);
|
|
|
|
Node* AllocateArguments(Node* effect, Node* control, Node* frame_state);
|
|
Node* AllocateRestArguments(Node* effect, Node* control, Node* frame_state,
|
|
int start_index);
|
|
Node* AllocateAliasedArguments(Node* effect, Node* control, Node* frame_state,
|
|
Node* context, Handle<SharedFunctionInfo>,
|
|
bool* has_aliased_arguments);
|
|
Node* AllocateElements(Node* effect, Node* control,
|
|
ElementsKind elements_kind, int capacity,
|
|
PretenureFlag pretenure);
|
|
Node* AllocateFastLiteral(Node* effect, Node* control,
|
|
Handle<JSObject> boilerplate,
|
|
AllocationSiteUsageContext* site_context);
|
|
Node* AllocateFastLiteralElements(Node* effect, Node* control,
|
|
Handle<JSObject> boilerplate,
|
|
PretenureFlag pretenure,
|
|
AllocationSiteUsageContext* site_context);
|
|
|
|
Reduction ReduceNewArrayToStubCall(Node* node, Handle<AllocationSite> site);
|
|
|
|
// Infers the LiteralsArray to use for a given {node}.
|
|
MaybeHandle<LiteralsArray> GetSpecializationLiterals(Node* node);
|
|
|
|
Factory* factory() const;
|
|
Graph* graph() const;
|
|
JSGraph* jsgraph() const { return jsgraph_; }
|
|
Isolate* isolate() const;
|
|
Handle<Context> native_context() const { return native_context_; }
|
|
JSOperatorBuilder* javascript() const;
|
|
CommonOperatorBuilder* common() const;
|
|
SimplifiedOperatorBuilder* simplified() const;
|
|
MachineOperatorBuilder* machine() const;
|
|
CompilationDependencies* dependencies() const { return dependencies_; }
|
|
Zone* zone() const { return zone_; }
|
|
|
|
CompilationDependencies* const dependencies_;
|
|
JSGraph* const jsgraph_;
|
|
MaybeHandle<LiteralsArray> const literals_array_;
|
|
Handle<Context> const native_context_;
|
|
Zone* const zone_;
|
|
};
|
|
|
|
} // namespace compiler
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_COMPILER_JS_CREATE_LOWERING_H_
|