OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ | 5 #ifndef V8_CRANKSHAFT_HYDROGEN_H_ |
6 #define V8_CRANKSHAFT_HYDROGEN_H_ | 6 #define V8_CRANKSHAFT_HYDROGEN_H_ |
7 | 7 |
8 #include "src/accessors.h" | 8 #include "src/accessors.h" |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/ast/ast-type-bounds.h" | 10 #include "src/ast/ast-type-bounds.h" |
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2055 inline HPrologue* HGraphBuilder::New<HPrologue>() { | 2055 inline HPrologue* HGraphBuilder::New<HPrologue>() { |
2056 return HPrologue::New(zone()); | 2056 return HPrologue::New(zone()); |
2057 } | 2057 } |
2058 | 2058 |
2059 | 2059 |
2060 template <> | 2060 template <> |
2061 inline HContext* HGraphBuilder::New<HContext>() { | 2061 inline HContext* HGraphBuilder::New<HContext>() { |
2062 return HContext::New(zone()); | 2062 return HContext::New(zone()); |
2063 } | 2063 } |
2064 | 2064 |
2065 | 2065 // This AstVistor is not final, and provides the AstVisitor methods as virtual |
2066 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { | 2066 // methods so they can be specialized by subclasses. |
| 2067 class HOptimizedGraphBuilder : public HGraphBuilder, |
| 2068 public AstVisitor<HOptimizedGraphBuilder> { |
2067 public: | 2069 public: |
2068 // A class encapsulating (lazily-allocated) break and continue blocks for | 2070 // A class encapsulating (lazily-allocated) break and continue blocks for |
2069 // a breakable statement. Separated from BreakAndContinueScope so that it | 2071 // a breakable statement. Separated from BreakAndContinueScope so that it |
2070 // can have a separate lifetime. | 2072 // can have a separate lifetime. |
2071 class BreakAndContinueInfo final BASE_EMBEDDED { | 2073 class BreakAndContinueInfo final BASE_EMBEDDED { |
2072 public: | 2074 public: |
2073 explicit BreakAndContinueInfo(BreakableStatement* target, | 2075 explicit BreakAndContinueInfo(BreakableStatement* target, |
2074 Scope* scope, | 2076 Scope* scope, |
2075 int drop_extra = 0) | 2077 int drop_extra = 0) |
2076 : target_(target), | 2078 : target_(target), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 HOsrBuilder* osr() const { return osr_; } | 2138 HOsrBuilder* osr() const { return osr_; } |
2137 | 2139 |
2138 void Bailout(BailoutReason reason); | 2140 void Bailout(BailoutReason reason); |
2139 | 2141 |
2140 HBasicBlock* CreateJoin(HBasicBlock* first, | 2142 HBasicBlock* CreateJoin(HBasicBlock* first, |
2141 HBasicBlock* second, | 2143 HBasicBlock* second, |
2142 BailoutId join_id); | 2144 BailoutId join_id); |
2143 | 2145 |
2144 FunctionState* function_state() const { return function_state_; } | 2146 FunctionState* function_state() const { return function_state_; } |
2145 | 2147 |
2146 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 2148 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
2147 | 2149 |
2148 AstTypeBounds* bounds() { return &bounds_; } | 2150 AstTypeBounds* bounds() { return &bounds_; } |
2149 | 2151 |
2150 void* operator new(size_t size, Zone* zone) { return zone->New(size); } | 2152 void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
2151 void operator delete(void* pointer, Zone* zone) { } | 2153 void operator delete(void* pointer, Zone* zone) { } |
2152 void operator delete(void* pointer) { } | 2154 void operator delete(void* pointer) { } |
2153 | 2155 |
2154 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 2156 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
2155 | 2157 |
2156 protected: | 2158 protected: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2344 // test contexts.) | 2346 // test contexts.) |
2345 void VisitForValue(Expression* expr, | 2347 void VisitForValue(Expression* expr, |
2346 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); | 2348 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); |
2347 void VisitForTypeOf(Expression* expr); | 2349 void VisitForTypeOf(Expression* expr); |
2348 void VisitForEffect(Expression* expr); | 2350 void VisitForEffect(Expression* expr); |
2349 void VisitForControl(Expression* expr, | 2351 void VisitForControl(Expression* expr, |
2350 HBasicBlock* true_block, | 2352 HBasicBlock* true_block, |
2351 HBasicBlock* false_block); | 2353 HBasicBlock* false_block); |
2352 | 2354 |
2353 // Visit a list of expressions from left to right, each in a value context. | 2355 // Visit a list of expressions from left to right, each in a value context. |
2354 void VisitExpressions(ZoneList<Expression*>* exprs) override; | 2356 void VisitExpressions(ZoneList<Expression*>* exprs); |
2355 void VisitExpressions(ZoneList<Expression*>* exprs, | 2357 void VisitExpressions(ZoneList<Expression*>* exprs, |
2356 ArgumentsAllowedFlag flag); | 2358 ArgumentsAllowedFlag flag); |
2357 | 2359 |
2358 // Remove the arguments from the bailout environment and emit instructions | 2360 // Remove the arguments from the bailout environment and emit instructions |
2359 // to push them as outgoing parameters. | 2361 // to push them as outgoing parameters. |
2360 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 2362 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
2361 void PushArgumentsFromEnvironment(int count); | 2363 void PushArgumentsFromEnvironment(int count); |
2362 | 2364 |
2363 void SetUpScope(Scope* scope); | 2365 void SetUpScope(Scope* scope); |
2364 void VisitStatements(ZoneList<Statement*>* statements) override; | 2366 void VisitStatements(ZoneList<Statement*>* statements); |
2365 | 2367 |
2366 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 2368 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
2367 AST_NODE_LIST(DECLARE_VISIT) | 2369 AST_NODE_LIST(DECLARE_VISIT) |
2368 #undef DECLARE_VISIT | 2370 #undef DECLARE_VISIT |
2369 | 2371 |
2370 private: | 2372 private: |
2371 // Helpers for flow graph construction. | 2373 // Helpers for flow graph construction. |
2372 enum GlobalPropertyAccess { | 2374 enum GlobalPropertyAccess { |
2373 kUseCell, | 2375 kUseCell, |
2374 kUseGeneric | 2376 kUseGeneric |
2375 }; | 2377 }; |
2376 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, | 2378 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3041 } | 3043 } |
3042 | 3044 |
3043 private: | 3045 private: |
3044 HOptimizedGraphBuilder* builder_; | 3046 HOptimizedGraphBuilder* builder_; |
3045 }; | 3047 }; |
3046 | 3048 |
3047 } // namespace internal | 3049 } // namespace internal |
3048 } // namespace v8 | 3050 } // namespace v8 |
3049 | 3051 |
3050 #endif // V8_CRANKSHAFT_HYDROGEN_H_ | 3052 #endif // V8_CRANKSHAFT_HYDROGEN_H_ |
OLD | NEW |