| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_COMPILER_AST_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/compiler/compiler-source-position-table.h" | 9 #include "src/compiler/compiler-source-position-table.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 TypeofMode typeof_mode); | 303 TypeofMode typeof_mode); |
| 304 Node* BuildGlobalStore(Handle<Name> name, Node* value, | 304 Node* BuildGlobalStore(Handle<Name> name, Node* value, |
| 305 const VectorSlotPair& feedback); | 305 const VectorSlotPair& feedback); |
| 306 | 306 |
| 307 // Builders for accessing the function context. | 307 // Builders for accessing the function context. |
| 308 Node* BuildLoadGlobalObject(); | 308 Node* BuildLoadGlobalObject(); |
| 309 Node* BuildLoadNativeContextField(int index); | 309 Node* BuildLoadNativeContextField(int index); |
| 310 | 310 |
| 311 // Builders for automatic type conversion. | 311 // Builders for automatic type conversion. |
| 312 Node* BuildToBoolean(Node* input, TypeFeedbackId feedback_id); | 312 Node* BuildToBoolean(Node* input, TypeFeedbackId feedback_id); |
| 313 Node* BuildToName(Node* input, BailoutId bailout_id); | |
| 314 Node* BuildToObject(Node* input, BailoutId bailout_id); | 313 Node* BuildToObject(Node* input, BailoutId bailout_id); |
| 315 | 314 |
| 316 // Builder for adding the [[HomeObject]] to a value if the value came from a | 315 // Builder for adding the [[HomeObject]] to a value if the value came from a |
| 317 // function literal and needs a home object. Do nothing otherwise. | 316 // function literal and needs a home object. Do nothing otherwise. |
| 318 Node* BuildSetHomeObject(Node* value, Node* home_object, | 317 Node* BuildSetHomeObject(Node* value, Node* home_object, |
| 319 LiteralProperty* property, int slot_number = 0); | 318 LiteralProperty* property, int slot_number = 0); |
| 320 | 319 |
| 321 // Builders for error reporting at runtime. | 320 // Builders for error reporting at runtime. |
| 322 Node* BuildThrowError(Node* exception, BailoutId bailout_id); | 321 Node* BuildThrowError(Node* exception, BailoutId bailout_id); |
| 323 Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id); | 322 Node* BuildThrowReferenceError(Variable* var, BailoutId bailout_id); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 346 // The following build methods have the same contract as the above ones, but | 345 // The following build methods have the same contract as the above ones, but |
| 347 // they can also return {nullptr} to indicate that no fragment was built. Note | 346 // they can also return {nullptr} to indicate that no fragment was built. Note |
| 348 // that these are optimizations, disabling any of them should still produce | 347 // that these are optimizations, disabling any of them should still produce |
| 349 // correct graphs. | 348 // correct graphs. |
| 350 | 349 |
| 351 // Optimization for variable load from global object. | 350 // Optimization for variable load from global object. |
| 352 Node* TryLoadGlobalConstant(Handle<Name> name); | 351 Node* TryLoadGlobalConstant(Handle<Name> name); |
| 353 | 352 |
| 354 // Optimizations for automatic type conversion. | 353 // Optimizations for automatic type conversion. |
| 355 Node* TryFastToBoolean(Node* input); | 354 Node* TryFastToBoolean(Node* input); |
| 356 Node* TryFastToName(Node* input); | |
| 357 | 355 |
| 358 // =========================================================================== | 356 // =========================================================================== |
| 359 // The following visitation methods all recursively visit a subtree of the | 357 // The following visitation methods all recursively visit a subtree of the |
| 360 // underlying AST and extent the graph. The operand stack is mutated in a way | 358 // underlying AST and extent the graph. The operand stack is mutated in a way |
| 361 // consistent with other compilers: | 359 // consistent with other compilers: |
| 362 // - Expressions pop operands and push result, depending on {AstContext}. | 360 // - Expressions pop operands and push result, depending on {AstContext}. |
| 363 // - Statements keep the operand stack balanced. | 361 // - Statements keep the operand stack balanced. |
| 364 | 362 |
| 365 // Visit statements. | 363 // Visit statements. |
| 366 void VisitIfNotNull(Statement* stmt); | 364 void VisitIfNotNull(Statement* stmt); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 private: | 596 private: |
| 599 SourcePositionTable* const source_positions_; | 597 SourcePositionTable* const source_positions_; |
| 600 SourcePosition const start_position_; | 598 SourcePosition const start_position_; |
| 601 }; | 599 }; |
| 602 | 600 |
| 603 } // namespace compiler | 601 } // namespace compiler |
| 604 } // namespace internal | 602 } // namespace internal |
| 605 } // namespace v8 | 603 } // namespace v8 |
| 606 | 604 |
| 607 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 605 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |