diff options
Diffstat (limited to 'src/crankshaft/hydrogen.h')
-rw-r--r-- | src/crankshaft/hydrogen.h | 116 |
1 files changed, 65 insertions, 51 deletions
diff --git a/src/crankshaft/hydrogen.h b/src/crankshaft/hydrogen.h index 9f2508a7..2ce6454f 100644 --- a/src/crankshaft/hydrogen.h +++ b/src/crankshaft/hydrogen.h @@ -12,10 +12,13 @@ #include "src/bailout-reason.h" #include "src/compilation-info.h" #include "src/compiler.h" +#include "src/counters.h" #include "src/crankshaft/compilation-phase.h" #include "src/crankshaft/hydrogen-instructions.h" #include "src/globals.h" #include "src/parsing/parse-info.h" +#include "src/string-stream.h" +#include "src/transitions.h" #include "src/zone/zone.h" namespace v8 { @@ -37,9 +40,8 @@ class HCompilationJob final : public CompilationJob { public: explicit HCompilationJob(Handle<JSFunction> function) : CompilationJob(function->GetIsolate(), &info_, "Crankshaft"), - zone_(function->GetIsolate()->allocator(), ZONE_NAME), - parse_info_(&zone_, handle(function->shared())), - info_(&parse_info_, function), + parse_info_(handle(function->shared())), + info_(parse_info_.zone(), &parse_info_, function), graph_(nullptr), chunk_(nullptr) {} @@ -49,7 +51,6 @@ class HCompilationJob final : public CompilationJob { virtual Status FinalizeJobImpl(); private: - Zone zone_; ParseInfo parse_info_; CompilationInfo info_; HGraph* graph_; @@ -463,12 +464,6 @@ class HGraph final : public ZoneObject { void DecrementInNoSideEffectsScope() { no_side_effects_scope_count_--; } bool IsInsideNoSideEffectsScope() { return no_side_effects_scope_count_ > 0; } - // If we are tracking source positions then this function assigns a unique - // identifier to each inlining and dumps function source if it was inlined - // for the first time during the current optimization. - int TraceInlinedFunction(Handle<SharedFunctionInfo> shared, - SourcePosition position); - private: HConstant* ReinsertConstantIfNecessary(HConstant* constant); HConstant* GetConstant(SetOncePointer<HConstant>* pointer, @@ -1807,9 +1802,11 @@ class HGraphBuilder { HValue* previous_object_size, HValue* payload); - HInstruction* BuildConstantMapCheck(Handle<JSObject> constant); + HInstruction* BuildConstantMapCheck(Handle<JSObject> constant, + bool ensure_no_elements = false); HInstruction* BuildCheckPrototypeMaps(Handle<JSObject> prototype, - Handle<JSObject> holder); + Handle<JSObject> holder, + bool ensure_no_elements = false); HInstruction* BuildGetNativeContext(HValue* closure); HInstruction* BuildGetNativeContext(); @@ -1853,9 +1850,6 @@ class HGraphBuilder { bool is_tracking_positions() { return track_positions_; } - void TraceInlinedFunction(Handle<SharedFunctionInfo> shared, - SourcePosition position, int inlining_id); - HValue* BuildAllocateEmptyArrayBuffer(HValue* byte_length); template <typename ViewClass> void BuildArrayBufferViewInitialization(HValue* obj, @@ -2149,7 +2143,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, Handle<SharedFunctionInfo> current_shared_info() const { return current_info()->shared_info(); } - TypeFeedbackVector* current_feedback_vector() const { + FeedbackVector* current_feedback_vector() const { return current_closure()->feedback_vector(); } void ClearInlinedTestContext() { @@ -2163,10 +2157,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder, F(IsSmi) \ F(IsArray) \ F(IsTypedArray) \ - F(IsRegExp) \ F(IsJSProxy) \ F(Call) \ - F(NewObject) \ F(ToInteger) \ F(ToObject) \ F(ToString) \ @@ -2176,8 +2168,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder, F(DebugBreakInOptimizedCode) \ F(StringCharCodeAt) \ F(SubString) \ - F(RegExpExec) \ - F(NumberToString) \ F(DebugIsActive) \ /* Typed Arrays */ \ F(TypedArrayInitialize) \ @@ -2386,6 +2376,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, TailCallMode syntactic_tail_call_mode); static bool IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map); static bool CanInlineArrayResizeOperation(Handle<Map> receiver_map); + static bool NoElementsInPrototypeChain(Handle<Map> receiver_map); // If --trace-inlining, print a line of the inlining trace. Inlining // succeeded if the reason string is NULL and failed if there is a @@ -2395,15 +2386,16 @@ class HOptimizedGraphBuilder : public HGraphBuilder, TailCallMode tail_call_mode = TailCallMode::kDisallow); void HandleGlobalVariableAssignment(Variable* var, HValue* value, - FeedbackVectorSlot slot, - BailoutId ast_id); + FeedbackSlot slot, BailoutId ast_id); void HandlePropertyAssignment(Assignment* expr); void HandleCompoundAssignment(Assignment* expr); - void HandlePolymorphicNamedFieldAccess( - PropertyAccessType access_type, Expression* expr, FeedbackVectorSlot slot, - BailoutId ast_id, BailoutId return_id, HValue* object, HValue* value, - SmallMapList* types, Handle<Name> name); + void HandlePolymorphicNamedFieldAccess(PropertyAccessType access_type, + Expression* expr, FeedbackSlot slot, + BailoutId ast_id, BailoutId return_id, + HValue* object, HValue* value, + SmallMapList* types, + Handle<Name> name); HValue* BuildAllocateExternalElements( ExternalArrayType array_type, @@ -2464,7 +2456,19 @@ class HOptimizedGraphBuilder : public HGraphBuilder, field_type_(HType::Tagged()), access_(HObjectAccess::ForMap()), lookup_type_(NOT_FOUND), - details_(NONE, DATA, Representation::None()) {} + details_(PropertyDetails::Empty()), + store_mode_(STORE_TO_INITIALIZED_ENTRY) {} + + // Ensure the full store is performed. + void MarkAsInitializingStore() { + DCHECK_EQ(STORE, access_type_); + store_mode_ = INITIALIZING_STORE; + } + + StoreFieldOrKeyedMode StoreMode() { + DCHECK_EQ(STORE, access_type_); + return store_mode_; + } // Checkes whether this PropertyAccessInfo can be handled as a monomorphic // load named. It additionally fills in the fields necessary to generate the @@ -2521,15 +2525,23 @@ class HOptimizedGraphBuilder : public HGraphBuilder, bool IsFound() const { return lookup_type_ != NOT_FOUND; } bool IsProperty() const { return IsFound() && !IsTransition(); } bool IsTransition() const { return lookup_type_ == TRANSITION_TYPE; } + // TODO(ishell): rename to IsDataConstant() once constant field tracking + // is done. + bool IsDataConstantField() const { + return lookup_type_ == DESCRIPTOR_TYPE && details_.kind() == kData && + details_.location() == kField && details_.constness() == kConst; + } bool IsData() const { - return lookup_type_ == DESCRIPTOR_TYPE && details_.type() == DATA; + return lookup_type_ == DESCRIPTOR_TYPE && details_.kind() == kData && + details_.location() == kField; } bool IsDataConstant() const { - return lookup_type_ == DESCRIPTOR_TYPE && - details_.type() == DATA_CONSTANT; + return lookup_type_ == DESCRIPTOR_TYPE && details_.kind() == kData && + details_.location() == kDescriptor; } bool IsAccessorConstant() const { - return !IsTransition() && details_.type() == ACCESSOR_CONSTANT; + return !IsTransition() && details_.kind() == kAccessor && + details_.location() == kDescriptor; } bool IsConfigurable() const { return details_.IsConfigurable(); } bool IsReadOnly() const { return details_.IsReadOnly(); } @@ -2578,6 +2590,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, transition_ = handle(target); number_ = transition_->LastAdded(); details_ = transition_->instance_descriptors()->GetDetails(number_); + MarkAsInitializingStore(); } void NotFound() { lookup_type_ = NOT_FOUND; @@ -2588,7 +2601,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder, return details_.representation(); } bool IsTransitionToData() const { - return IsTransition() && details_.type() == DATA; + return IsTransition() && details_.kind() == kData && + details_.location() == kField; } Zone* zone() { return builder_->zone(); } @@ -2623,6 +2637,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, Handle<Map> transition_; int number_; PropertyDetails details_; + StoreFieldOrKeyedMode store_mode_; }; HValue* BuildMonomorphicAccess(PropertyAccessInfo* info, HValue* object, @@ -2632,9 +2647,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder, HValue* BuildNamedAccess(PropertyAccessType access, BailoutId ast_id, BailoutId reutrn_id, Expression* expr, - FeedbackVectorSlot slot, HValue* object, - Handle<Name> name, HValue* value, - bool is_uninitialized = false); + FeedbackSlot slot, HValue* object, Handle<Name> name, + HValue* value, bool is_uninitialized = false); void HandlePolymorphicCallNamed(Call* expr, HValue* receiver, @@ -2668,7 +2682,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, PushBeforeSimulateBehavior push_sim_result); HInstruction* BuildIncrement(CountOperation* expr); HInstruction* BuildKeyedGeneric(PropertyAccessType access_type, - Expression* expr, FeedbackVectorSlot slot, + Expression* expr, FeedbackSlot slot, HValue* object, HValue* key, HValue* value); HInstruction* TryBuildConsolidatedElementLoad(HValue* object, @@ -2686,19 +2700,21 @@ class HOptimizedGraphBuilder : public HGraphBuilder, PropertyAccessType access_type, KeyedAccessStoreMode store_mode); - HValue* HandlePolymorphicElementAccess( - Expression* expr, FeedbackVectorSlot slot, HValue* object, HValue* key, - HValue* val, SmallMapList* maps, PropertyAccessType access_type, - KeyedAccessStoreMode store_mode, bool* has_side_effects); + HValue* HandlePolymorphicElementAccess(Expression* expr, FeedbackSlot slot, + HValue* object, HValue* key, + HValue* val, SmallMapList* maps, + PropertyAccessType access_type, + KeyedAccessStoreMode store_mode, + bool* has_side_effects); HValue* HandleKeyedElementAccess(HValue* obj, HValue* key, HValue* val, - Expression* expr, FeedbackVectorSlot slot, + Expression* expr, FeedbackSlot slot, BailoutId ast_id, BailoutId return_id, PropertyAccessType access_type, bool* has_side_effects); HInstruction* BuildNamedGeneric(PropertyAccessType access, Expression* expr, - FeedbackVectorSlot slot, HValue* object, + FeedbackSlot slot, HValue* object, Handle<Name> name, HValue* value, bool is_uninitialized = false); @@ -2711,19 +2727,18 @@ class HOptimizedGraphBuilder : public HGraphBuilder, HValue* key); void BuildStoreForEffect(Expression* expression, Property* prop, - FeedbackVectorSlot slot, BailoutId ast_id, + FeedbackSlot slot, BailoutId ast_id, BailoutId return_id, HValue* object, HValue* key, HValue* value); - void BuildStore(Expression* expression, Property* prop, - FeedbackVectorSlot slot, BailoutId ast_id, - BailoutId return_id, bool is_uninitialized = false); + void BuildStore(Expression* expression, Property* prop, FeedbackSlot slot, + BailoutId ast_id, BailoutId return_id, + bool is_uninitialized = false); HInstruction* BuildLoadNamedField(PropertyAccessInfo* info, HValue* checked_object); - HInstruction* BuildStoreNamedField(PropertyAccessInfo* info, - HValue* checked_object, - HValue* value); + HValue* BuildStoreNamedField(PropertyAccessInfo* info, HValue* checked_object, + HValue* value); HValue* BuildContextChainWalk(Variable* var); @@ -2769,7 +2784,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, TailCallMode syntactic_tail_call_mode, ConvertReceiverMode convert_mode, TailCallMode tail_call_mode, - FeedbackVectorSlot slot); + FeedbackSlot slot); HInstruction* NewCallConstantFunction(Handle<JSFunction> target, int argument_count, @@ -2804,7 +2819,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder, friend class FunctionState; // Pushes and pops the state stack. friend class AstContext; // Pushes and pops the AST context stack. - friend class KeyedLoadFastElementStub; friend class HOsrBuilder; DISALLOW_COPY_AND_ASSIGN(HOptimizedGraphBuilder); |