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-array-writer.h" | 9 #include "src/interpreter/bytecode-array-writer.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 Register Parameter(int parameter_index) const; | 72 Register Parameter(int parameter_index) const; |
73 | 73 |
74 // Return true if the register |reg| represents a parameter or a | 74 // Return true if the register |reg| represents a parameter or a |
75 // local. | 75 // local. |
76 bool RegisterIsParameterOrLocal(Register reg) const; | 76 bool RegisterIsParameterOrLocal(Register reg) const; |
77 | 77 |
78 // Returns true if the register |reg| is a live temporary register. | 78 // Returns true if the register |reg| is a live temporary register. |
79 bool TemporaryRegisterIsLive(Register reg) const; | 79 bool TemporaryRegisterIsLive(Register reg) const; |
80 | 80 |
81 // Constant loads to accumulator. | 81 // Constant loads to accumulator. |
| 82 BytecodeArrayBuilder& LoadConstantPoolEntry(size_t entry); |
82 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); | 83 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); |
83 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); | 84 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); |
84 BytecodeArrayBuilder& LoadUndefined(); | 85 BytecodeArrayBuilder& LoadUndefined(); |
85 BytecodeArrayBuilder& LoadNull(); | 86 BytecodeArrayBuilder& LoadNull(); |
86 BytecodeArrayBuilder& LoadTheHole(); | 87 BytecodeArrayBuilder& LoadTheHole(); |
87 BytecodeArrayBuilder& LoadTrue(); | 88 BytecodeArrayBuilder& LoadTrue(); |
88 BytecodeArrayBuilder& LoadFalse(); | 89 BytecodeArrayBuilder& LoadFalse(); |
89 | 90 |
90 // Global loads to the accumulator and stores from the accumulator. | 91 // Global loads to the accumulator and stores from the accumulator. |
91 BytecodeArrayBuilder& LoadGlobal(int feedback_slot, TypeofMode typeof_mode); | 92 BytecodeArrayBuilder& LoadGlobal(int feedback_slot, TypeofMode typeof_mode); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 // Exception handling. | 254 // Exception handling. |
254 BytecodeArrayBuilder& MarkHandler(int handler_id, | 255 BytecodeArrayBuilder& MarkHandler(int handler_id, |
255 HandlerTable::CatchPrediction will_catch); | 256 HandlerTable::CatchPrediction will_catch); |
256 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); | 257 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); |
257 BytecodeArrayBuilder& MarkTryEnd(int handler_id); | 258 BytecodeArrayBuilder& MarkTryEnd(int handler_id); |
258 | 259 |
259 // Creates a new handler table entry and returns a {hander_id} identifying the | 260 // Creates a new handler table entry and returns a {hander_id} identifying the |
260 // entry, so that it can be referenced by above exception handling support. | 261 // entry, so that it can be referenced by above exception handling support. |
261 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } | 262 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } |
262 | 263 |
| 264 // Allocates a slot in the constant pool which can later be inserted. |
| 265 size_t AllocateConstantPoolEntry(); |
| 266 // Inserts a entry into an allocated constant pool entry. |
| 267 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object); |
| 268 |
263 void InitializeReturnPosition(FunctionLiteral* literal); | 269 void InitializeReturnPosition(FunctionLiteral* literal); |
264 | 270 |
265 void SetStatementPosition(Statement* stmt); | 271 void SetStatementPosition(Statement* stmt); |
266 void SetExpressionPosition(Expression* expr); | 272 void SetExpressionPosition(Expression* expr); |
267 void SetExpressionAsStatementPosition(Expression* expr); | 273 void SetExpressionAsStatementPosition(Expression* expr); |
268 | 274 |
269 // Accessors | 275 // Accessors |
270 TemporaryRegisterAllocator* temporary_register_allocator() { | 276 TemporaryRegisterAllocator* temporary_register_allocator() { |
271 return &temporary_allocator_; | 277 return &temporary_allocator_; |
272 } | 278 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 BytecodeSourceInfo latest_source_info_; | 379 BytecodeSourceInfo latest_source_info_; |
374 | 380 |
375 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 381 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
376 }; | 382 }; |
377 | 383 |
378 } // namespace interpreter | 384 } // namespace interpreter |
379 } // namespace internal | 385 } // namespace internal |
380 } // namespace v8 | 386 } // namespace v8 |
381 | 387 |
382 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 388 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |