Chromium Code Reviews| 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 class HOptimizedGraphBuilder : public HGraphBuilder, |
|
Igor Sheludko
2016/07/14 16:39:54
Please add a comment that although the HOptimizedG
Toon Verwaest
2016/07/15 07:07:20
Done.
| |
| 2066 class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { | 2066 public AstVisitor<HOptimizedGraphBuilder> { |
| 2067 public: | 2067 public: |
| 2068 // A class encapsulating (lazily-allocated) break and continue blocks for | 2068 // A class encapsulating (lazily-allocated) break and continue blocks for |
| 2069 // a breakable statement. Separated from BreakAndContinueScope so that it | 2069 // a breakable statement. Separated from BreakAndContinueScope so that it |
| 2070 // can have a separate lifetime. | 2070 // can have a separate lifetime. |
| 2071 class BreakAndContinueInfo final BASE_EMBEDDED { | 2071 class BreakAndContinueInfo final BASE_EMBEDDED { |
| 2072 public: | 2072 public: |
| 2073 explicit BreakAndContinueInfo(BreakableStatement* target, | 2073 explicit BreakAndContinueInfo(BreakableStatement* target, |
| 2074 Scope* scope, | 2074 Scope* scope, |
| 2075 int drop_extra = 0) | 2075 int drop_extra = 0) |
| 2076 : target_(target), | 2076 : target_(target), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2136 HOsrBuilder* osr() const { return osr_; } | 2136 HOsrBuilder* osr() const { return osr_; } |
| 2137 | 2137 |
| 2138 void Bailout(BailoutReason reason); | 2138 void Bailout(BailoutReason reason); |
| 2139 | 2139 |
| 2140 HBasicBlock* CreateJoin(HBasicBlock* first, | 2140 HBasicBlock* CreateJoin(HBasicBlock* first, |
| 2141 HBasicBlock* second, | 2141 HBasicBlock* second, |
| 2142 BailoutId join_id); | 2142 BailoutId join_id); |
| 2143 | 2143 |
| 2144 FunctionState* function_state() const { return function_state_; } | 2144 FunctionState* function_state() const { return function_state_; } |
| 2145 | 2145 |
| 2146 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; | 2146 void VisitDeclarations(ZoneList<Declaration*>* declarations); |
| 2147 | 2147 |
| 2148 AstTypeBounds* bounds() { return &bounds_; } | 2148 AstTypeBounds* bounds() { return &bounds_; } |
| 2149 | 2149 |
| 2150 void* operator new(size_t size, Zone* zone) { return zone->New(size); } | 2150 void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
| 2151 void operator delete(void* pointer, Zone* zone) { } | 2151 void operator delete(void* pointer, Zone* zone) { } |
| 2152 void operator delete(void* pointer) { } | 2152 void operator delete(void* pointer) { } |
| 2153 | 2153 |
| 2154 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 2154 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 2155 | 2155 |
| 2156 protected: | 2156 protected: |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2346 // test contexts.) | 2346 // test contexts.) |
| 2347 void VisitForValue(Expression* expr, | 2347 void VisitForValue(Expression* expr, |
| 2348 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); | 2348 ArgumentsAllowedFlag flag = ARGUMENTS_NOT_ALLOWED); |
| 2349 void VisitForTypeOf(Expression* expr); | 2349 void VisitForTypeOf(Expression* expr); |
| 2350 void VisitForEffect(Expression* expr); | 2350 void VisitForEffect(Expression* expr); |
| 2351 void VisitForControl(Expression* expr, | 2351 void VisitForControl(Expression* expr, |
| 2352 HBasicBlock* true_block, | 2352 HBasicBlock* true_block, |
| 2353 HBasicBlock* false_block); | 2353 HBasicBlock* false_block); |
| 2354 | 2354 |
| 2355 // 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. |
| 2356 void VisitExpressions(ZoneList<Expression*>* exprs) override; | 2356 void VisitExpressions(ZoneList<Expression*>* exprs); |
| 2357 void VisitExpressions(ZoneList<Expression*>* exprs, | 2357 void VisitExpressions(ZoneList<Expression*>* exprs, |
| 2358 ArgumentsAllowedFlag flag); | 2358 ArgumentsAllowedFlag flag); |
| 2359 | 2359 |
| 2360 // Remove the arguments from the bailout environment and emit instructions | 2360 // Remove the arguments from the bailout environment and emit instructions |
| 2361 // to push them as outgoing parameters. | 2361 // to push them as outgoing parameters. |
| 2362 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); | 2362 template <class Instruction> HInstruction* PreProcessCall(Instruction* call); |
| 2363 void PushArgumentsFromEnvironment(int count); | 2363 void PushArgumentsFromEnvironment(int count); |
| 2364 | 2364 |
| 2365 void SetUpScope(Scope* scope); | 2365 void SetUpScope(Scope* scope); |
| 2366 void VisitStatements(ZoneList<Statement*>* statements) override; | 2366 void VisitStatements(ZoneList<Statement*>* statements); |
| 2367 | 2367 |
| 2368 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 2368 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); |
| 2369 AST_NODE_LIST(DECLARE_VISIT) | 2369 AST_NODE_LIST(DECLARE_VISIT) |
| 2370 #undef DECLARE_VISIT | 2370 #undef DECLARE_VISIT |
| 2371 | 2371 |
| 2372 private: | 2372 private: |
| 2373 // Helpers for flow graph construction. | 2373 // Helpers for flow graph construction. |
| 2374 enum GlobalPropertyAccess { | 2374 enum GlobalPropertyAccess { |
| 2375 kUseCell, | 2375 kUseCell, |
| 2376 kUseGeneric | 2376 kUseGeneric |
| 2377 }; | 2377 }; |
| 2378 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, | 2378 GlobalPropertyAccess LookupGlobalProperty(Variable* var, LookupIterator* it, |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3047 } | 3047 } |
| 3048 | 3048 |
| 3049 private: | 3049 private: |
| 3050 HOptimizedGraphBuilder* builder_; | 3050 HOptimizedGraphBuilder* builder_; |
| 3051 }; | 3051 }; |
| 3052 | 3052 |
| 3053 } // namespace internal | 3053 } // namespace internal |
| 3054 } // namespace v8 | 3054 } // namespace v8 |
| 3055 | 3055 |
| 3056 #endif // V8_CRANKSHAFT_HYDROGEN_H_ | 3056 #endif // V8_CRANKSHAFT_HYDROGEN_H_ |
| OLD | NEW |