| 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/base/compiler-specific.h" | 9 #include "src/base/compiler-specific.h" |
| 10 #include "src/globals.h" | 10 #include "src/globals.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 BytecodeRegisterAllocator* register_allocator() { | 358 BytecodeRegisterAllocator* register_allocator() { |
| 359 return ®ister_allocator_; | 359 return ®ister_allocator_; |
| 360 } | 360 } |
| 361 const BytecodeRegisterAllocator* register_allocator() const { | 361 const BytecodeRegisterAllocator* register_allocator() const { |
| 362 return ®ister_allocator_; | 362 return ®ister_allocator_; |
| 363 } | 363 } |
| 364 Zone* zone() const { return zone_; } | 364 Zone* zone() const { return zone_; } |
| 365 | 365 |
| 366 private: | 366 private: |
| 367 friend class BytecodeRegisterAllocator; | 367 friend class BytecodeRegisterAllocator; |
| 368 template <OperandType... operand_types> | 368 template <Bytecode bytecode, AccumulatorUse accumulator_use, |
| 369 OperandType... operand_types> |
| 369 friend class BytecodeNodeBuilder; | 370 friend class BytecodeNodeBuilder; |
| 370 | 371 |
| 371 // Returns the current source position for the given |bytecode|. | 372 // Returns the current source position for the given |bytecode|. |
| 372 INLINE(BytecodeSourceInfo CurrentSourcePosition(Bytecode bytecode)); | 373 INLINE(BytecodeSourceInfo CurrentSourcePosition(Bytecode bytecode)); |
| 373 | 374 |
| 374 #define DECLARE_BYTECODE_OUTPUT(Name, ...) \ | 375 #define DECLARE_BYTECODE_OUTPUT(Name, ...) \ |
| 375 template <typename... Operands> \ | 376 template <typename... Operands> \ |
| 376 INLINE(void Output##Name(Operands... operands)); \ | 377 INLINE(void Output##Name(Operands... operands)); \ |
| 377 template <typename... Operands> \ | 378 template <typename... Operands> \ |
| 378 INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); | 379 INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); |
| 379 BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) | 380 BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) |
| 380 #undef DECLARE_OPERAND_TYPE_INFO | 381 #undef DECLARE_OPERAND_TYPE_INFO |
| 381 | 382 |
| 382 bool RegisterIsValid(Register reg) const; | 383 bool RegisterIsValid(Register reg) const; |
| 383 bool RegisterListIsValid(RegisterList reg_list) const; | 384 bool RegisterListIsValid(RegisterList reg_list) const; |
| 384 | 385 |
| 385 // Set position for return. | 386 // Set position for return. |
| 386 void SetReturnPosition(); | 387 void SetReturnPosition(); |
| 387 | 388 |
| 388 // Gets a constant pool entry for the |object|. | 389 // Gets a constant pool entry for the |object|. |
| 389 size_t GetConstantPoolEntry(Handle<Object> object); | 390 size_t GetConstantPoolEntry(Handle<Object> object); |
| 390 | 391 |
| 391 // Not implemented as the illegal bytecode is used inside internally | 392 // Not implemented as the illegal bytecode is used inside internally |
| 392 // to indicate a bytecode field is not valid or an error has occured | 393 // to indicate a bytecode field is not valid or an error has occured |
| 393 // during bytecode generation. | 394 // during bytecode generation. |
| 394 BytecodeArrayBuilder& Illegal(); | 395 BytecodeArrayBuilder& Illegal(); |
| 395 | 396 |
| 396 void PrepareToOutputBytecode(Bytecode bytecode); | 397 template <Bytecode bytecode, AccumulatorUse accumulator_use> |
| 398 void PrepareToOutputBytecode(); |
| 397 | 399 |
| 398 void LeaveBasicBlock() { return_seen_in_block_ = false; } | 400 void LeaveBasicBlock() { return_seen_in_block_ = false; } |
| 399 | 401 |
| 400 BytecodeArrayWriter* bytecode_array_writer() { | 402 BytecodeArrayWriter* bytecode_array_writer() { |
| 401 return &bytecode_array_writer_; | 403 return &bytecode_array_writer_; |
| 402 } | 404 } |
| 403 BytecodePipelineStage* pipeline() { return pipeline_; } | 405 BytecodePipelineStage* pipeline() { return pipeline_; } |
| 404 ConstantArrayBuilder* constant_array_builder() { | 406 ConstantArrayBuilder* constant_array_builder() { |
| 405 return &constant_array_builder_; | 407 return &constant_array_builder_; |
| 406 } | 408 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 429 static int const kNoFeedbackSlot = 0; | 431 static int const kNoFeedbackSlot = 0; |
| 430 | 432 |
| 431 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 433 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| 432 }; | 434 }; |
| 433 | 435 |
| 434 } // namespace interpreter | 436 } // namespace interpreter |
| 435 } // namespace internal | 437 } // namespace internal |
| 436 } // namespace v8 | 438 } // namespace v8 |
| 437 | 439 |
| 438 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 440 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |