| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
| 10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 BytecodeArrayBuilder& Bind(BytecodeLabel* label); | 217 BytecodeArrayBuilder& Bind(BytecodeLabel* label); |
| 218 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); | 218 BytecodeArrayBuilder& Bind(const BytecodeLabel& target, BytecodeLabel* label); |
| 219 | 219 |
| 220 BytecodeArrayBuilder& Jump(BytecodeLabel* label); | 220 BytecodeArrayBuilder& Jump(BytecodeLabel* label); |
| 221 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); | 221 BytecodeArrayBuilder& JumpIfTrue(BytecodeLabel* label); |
| 222 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); | 222 BytecodeArrayBuilder& JumpIfFalse(BytecodeLabel* label); |
| 223 BytecodeArrayBuilder& JumpIfNotHole(BytecodeLabel* label); | 223 BytecodeArrayBuilder& JumpIfNotHole(BytecodeLabel* label); |
| 224 BytecodeArrayBuilder& JumpIfNull(BytecodeLabel* label); | 224 BytecodeArrayBuilder& JumpIfNull(BytecodeLabel* label); |
| 225 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); | 225 BytecodeArrayBuilder& JumpIfUndefined(BytecodeLabel* label); |
| 226 | 226 |
| 227 // Jump to targets[value], where min <= value < min + size. |
| 228 BytecodeArrayBuilder& IndexedJump(Register value, int min, size_t size, |
| 229 ZoneVector<BytecodeLabel>& targets); |
| 230 |
| 227 BytecodeArrayBuilder& StackCheck(); | 231 BytecodeArrayBuilder& StackCheck(); |
| 228 | 232 |
| 229 BytecodeArrayBuilder& Throw(); | 233 BytecodeArrayBuilder& Throw(); |
| 230 BytecodeArrayBuilder& ReThrow(); | 234 BytecodeArrayBuilder& ReThrow(); |
| 231 BytecodeArrayBuilder& Return(); | 235 BytecodeArrayBuilder& Return(); |
| 232 | 236 |
| 233 BytecodeArrayBuilder& Illegal(); | 237 BytecodeArrayBuilder& Illegal(); |
| 234 | 238 |
| 235 // Debugger. | 239 // Debugger. |
| 236 BytecodeArrayBuilder& Debugger(); | 240 BytecodeArrayBuilder& Debugger(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 static OperandSize SizeForSignedOperand(int value); | 282 static OperandSize SizeForSignedOperand(int value); |
| 279 static OperandSize SizeForUnsignedOperand(int value); | 283 static OperandSize SizeForUnsignedOperand(int value); |
| 280 static OperandSize SizeForUnsignedOperand(size_t value); | 284 static OperandSize SizeForUnsignedOperand(size_t value); |
| 281 | 285 |
| 282 static uint32_t RegisterOperand(Register reg); | 286 static uint32_t RegisterOperand(Register reg); |
| 283 static Register RegisterFromOperand(uint32_t operand); | 287 static Register RegisterFromOperand(uint32_t operand); |
| 284 static uint32_t SignedOperand(int value, OperandSize size); | 288 static uint32_t SignedOperand(int value, OperandSize size); |
| 285 static uint32_t UnsignedOperand(int value); | 289 static uint32_t UnsignedOperand(int value); |
| 286 static uint32_t UnsignedOperand(size_t value); | 290 static uint32_t UnsignedOperand(size_t value); |
| 287 | 291 |
| 292 ZoneVector<BytecodeLabel> generator_resume_points; |
| 293 int generator_yields_seen() const { return generator_yields_seen_; } |
| 294 int incr_generator_yields_seen() { return generator_yields_seen_++; } |
| 295 |
| 288 private: | 296 private: |
| 289 class PreviousBytecodeHelper; | 297 class PreviousBytecodeHelper; |
| 290 friend class BytecodeRegisterAllocator; | 298 friend class BytecodeRegisterAllocator; |
| 291 | 299 |
| 292 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 300 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
| 293 static Bytecode BytecodeForCountOperation(Token::Value op); | 301 static Bytecode BytecodeForCountOperation(Token::Value op); |
| 294 static Bytecode BytecodeForCompareOperation(Token::Value op); | 302 static Bytecode BytecodeForCompareOperation(Token::Value op); |
| 295 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); | 303 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); |
| 296 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); | 304 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); |
| 297 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); | 305 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 SourcePositionTableBuilder source_position_table_builder_; | 378 SourcePositionTableBuilder source_position_table_builder_; |
| 371 size_t last_block_end_; | 379 size_t last_block_end_; |
| 372 size_t last_bytecode_start_; | 380 size_t last_bytecode_start_; |
| 373 bool exit_seen_in_block_; | 381 bool exit_seen_in_block_; |
| 374 int unbound_jumps_; | 382 int unbound_jumps_; |
| 375 int parameter_count_; | 383 int parameter_count_; |
| 376 int local_register_count_; | 384 int local_register_count_; |
| 377 int context_register_count_; | 385 int context_register_count_; |
| 378 int return_position_; | 386 int return_position_; |
| 379 TemporaryRegisterAllocator temporary_allocator_; | 387 TemporaryRegisterAllocator temporary_allocator_; |
| 388 int generator_yields_seen_; |
| 380 | 389 |
| 381 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 390 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| 382 }; | 391 }; |
| 383 | 392 |
| 384 | 393 |
| 385 // A label representing a branch target in a bytecode array. When a | 394 // A label representing a branch target in a bytecode array. When a |
| 386 // label is bound, it represents a known position in the bytecode | 395 // label is bound, it represents a known position in the bytecode |
| 387 // array. For labels that are forward references there can be at most | 396 // array. For labels that are forward references there can be at most |
| 388 // one reference whilst it is unbound. | 397 // one reference whilst it is unbound. |
| 389 class BytecodeLabel final { | 398 class BytecodeLabel final { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 420 size_t offset_; | 429 size_t offset_; |
| 421 | 430 |
| 422 friend class BytecodeArrayBuilder; | 431 friend class BytecodeArrayBuilder; |
| 423 }; | 432 }; |
| 424 | 433 |
| 425 } // namespace interpreter | 434 } // namespace interpreter |
| 426 } // namespace internal | 435 } // namespace internal |
| 427 } // namespace v8 | 436 } // namespace v8 |
| 428 | 437 |
| 429 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 438 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |