| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/ast.h" | 10 #include "src/ast.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 stack_dirty_ = true; | 229 stack_dirty_ = true; |
| 230 } | 230 } |
| 231 Node* Top() { | 231 Node* Top() { |
| 232 DCHECK(stack_height() > 0); | 232 DCHECK(stack_height() > 0); |
| 233 return values()->back(); | 233 return values()->back(); |
| 234 } | 234 } |
| 235 Node* Pop() { | 235 Node* Pop() { |
| 236 DCHECK(stack_height() > 0); | 236 DCHECK(stack_height() > 0); |
| 237 Node* back = values()->back(); | 237 Node* back = values()->back(); |
| 238 values()->pop_back(); | 238 values()->pop_back(); |
| 239 stack_dirty_ = true; |
| 239 return back; | 240 return back; |
| 240 } | 241 } |
| 241 | 242 |
| 242 // Direct mutations of the operand stack. | 243 // Direct mutations of the operand stack. |
| 243 void Poke(int depth, Node* node) { | 244 void Poke(int depth, Node* node) { |
| 244 DCHECK(depth >= 0 && depth < stack_height()); | 245 DCHECK(depth >= 0 && depth < stack_height()); |
| 245 int index = static_cast<int>(values()->size()) - depth - 1; | 246 int index = static_cast<int>(values()->size()) - depth - 1; |
| 246 values()->at(index) = node; | 247 values()->at(index) = node; |
| 248 stack_dirty_ = true; |
| 247 } | 249 } |
| 248 Node* Peek(int depth) { | 250 Node* Peek(int depth) { |
| 249 DCHECK(depth >= 0 && depth < stack_height()); | 251 DCHECK(depth >= 0 && depth < stack_height()); |
| 250 int index = static_cast<int>(values()->size()) - depth - 1; | 252 int index = static_cast<int>(values()->size()) - depth - 1; |
| 251 return values()->at(index); | 253 return values()->at(index); |
| 252 } | 254 } |
| 253 void Drop(int depth) { | 255 void Drop(int depth) { |
| 254 DCHECK(depth >= 0 && depth <= stack_height()); | 256 DCHECK(depth >= 0 && depth <= stack_height()); |
| 255 values()->erase(values()->end() - depth, values()->end()); | 257 values()->erase(values()->end() - depth, values()->end()); |
| 258 stack_dirty_ = true; |
| 256 } | 259 } |
| 257 | 260 |
| 258 // Preserve a checkpoint of the environment for the IR graph. Any | 261 // Preserve a checkpoint of the environment for the IR graph. Any |
| 259 // further mutation of the environment will not affect checkpoints. | 262 // further mutation of the environment will not affect checkpoints. |
| 260 Node* Checkpoint(BailoutId ast_id); | 263 Node* Checkpoint(BailoutId ast_id); |
| 261 | 264 |
| 262 private: | 265 private: |
| 263 int parameters_count_; | 266 int parameters_count_; |
| 264 int locals_count_; | 267 int locals_count_; |
| 265 Node* parameters_node_; | 268 Node* parameters_node_; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 }; | 412 }; |
| 410 | 413 |
| 411 Scope* AstGraphBuilder::current_scope() const { | 414 Scope* AstGraphBuilder::current_scope() const { |
| 412 return execution_context_->scope(); | 415 return execution_context_->scope(); |
| 413 } | 416 } |
| 414 } | 417 } |
| 415 } | 418 } |
| 416 } // namespace v8::internal::compiler | 419 } // namespace v8::internal::compiler |
| 417 | 420 |
| 418 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 421 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |