| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // | 189 // |
| 190 class AstGraphBuilder::Environment | 190 class AstGraphBuilder::Environment |
| 191 : public StructuredGraphBuilder::Environment { | 191 : public StructuredGraphBuilder::Environment { |
| 192 public: | 192 public: |
| 193 Environment(AstGraphBuilder* builder, Scope* scope, Node* control_dependency); | 193 Environment(AstGraphBuilder* builder, Scope* scope, Node* control_dependency); |
| 194 Environment(const Environment& copy); | 194 Environment(const Environment& copy); |
| 195 | 195 |
| 196 int parameters_count() const { return parameters_count_; } | 196 int parameters_count() const { return parameters_count_; } |
| 197 int locals_count() const { return locals_count_; } | 197 int locals_count() const { return locals_count_; } |
| 198 int stack_height() { | 198 int stack_height() { |
| 199 return values()->size() - parameters_count_ - locals_count_; | 199 return static_cast<int>(values()->size()) - parameters_count_ - |
| 200 locals_count_; |
| 200 } | 201 } |
| 201 | 202 |
| 202 // Operations on parameter or local variables. The parameter indices are | 203 // Operations on parameter or local variables. The parameter indices are |
| 203 // shifted by 1 (receiver is parameter index -1 but environment index 0). | 204 // shifted by 1 (receiver is parameter index -1 but environment index 0). |
| 204 void Bind(Variable* variable, Node* node) { | 205 void Bind(Variable* variable, Node* node) { |
| 205 ASSERT(variable->IsStackAllocated()); | 206 ASSERT(variable->IsStackAllocated()); |
| 206 if (variable->IsParameter()) { | 207 if (variable->IsParameter()) { |
| 207 values()->at(variable->index() + 1) = node; | 208 values()->at(variable->index() + 1) = node; |
| 208 parameters_dirty_ = true; | 209 parameters_dirty_ = true; |
| 209 } else { | 210 } else { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 234 Node* Pop() { | 235 Node* Pop() { |
| 235 ASSERT(stack_height() > 0); | 236 ASSERT(stack_height() > 0); |
| 236 Node* back = values()->back(); | 237 Node* back = values()->back(); |
| 237 values()->pop_back(); | 238 values()->pop_back(); |
| 238 return back; | 239 return back; |
| 239 } | 240 } |
| 240 | 241 |
| 241 // Direct mutations of the operand stack. | 242 // Direct mutations of the operand stack. |
| 242 void Poke(int depth, Node* node) { | 243 void Poke(int depth, Node* node) { |
| 243 ASSERT(depth >= 0 && depth < stack_height()); | 244 ASSERT(depth >= 0 && depth < stack_height()); |
| 244 int index = values()->size() - depth - 1; | 245 int index = static_cast<int>(values()->size()) - depth - 1; |
| 245 values()->at(index) = node; | 246 values()->at(index) = node; |
| 246 } | 247 } |
| 247 Node* Peek(int depth) { | 248 Node* Peek(int depth) { |
| 248 ASSERT(depth >= 0 && depth < stack_height()); | 249 ASSERT(depth >= 0 && depth < stack_height()); |
| 249 int index = values()->size() - depth - 1; | 250 int index = static_cast<int>(values()->size()) - depth - 1; |
| 250 return values()->at(index); | 251 return values()->at(index); |
| 251 } | 252 } |
| 252 void Drop(int depth) { | 253 void Drop(int depth) { |
| 253 ASSERT(depth >= 0 && depth <= stack_height()); | 254 ASSERT(depth >= 0 && depth <= stack_height()); |
| 254 values()->erase(values()->end() - depth, values()->end()); | 255 values()->erase(values()->end() - depth, values()->end()); |
| 255 } | 256 } |
| 256 | 257 |
| 257 // Preserve a checkpoint of the environment for the IR graph. Any | 258 // Preserve a checkpoint of the environment for the IR graph. Any |
| 258 // further mutation of the environment will not affect checkpoints. | 259 // further mutation of the environment will not affect checkpoints. |
| 259 Node* Checkpoint(BailoutId ast_id); | 260 Node* Checkpoint(BailoutId ast_id); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 }; | 409 }; |
| 409 | 410 |
| 410 Scope* AstGraphBuilder::current_scope() const { | 411 Scope* AstGraphBuilder::current_scope() const { |
| 411 return execution_context_->scope(); | 412 return execution_context_->scope(); |
| 412 } | 413 } |
| 413 } | 414 } |
| 414 } | 415 } |
| 415 } // namespace v8::internal::compiler | 416 } // namespace v8::internal::compiler |
| 416 | 417 |
| 417 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 418 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |