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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 // with the |object| in a register and the closure in the accumulator. | 183 // with the |object| in a register and the closure in the accumulator. |
184 BytecodeArrayBuilder& CreateWithContext(Register object, | 184 BytecodeArrayBuilder& CreateWithContext(Register object, |
185 Handle<ScopeInfo> scope_info); | 185 Handle<ScopeInfo> scope_info); |
186 | 186 |
187 // Create a new arguments object in the accumulator. | 187 // Create a new arguments object in the accumulator. |
188 BytecodeArrayBuilder& CreateArguments(CreateArgumentsType type); | 188 BytecodeArrayBuilder& CreateArguments(CreateArgumentsType type); |
189 | 189 |
190 // Literals creation. Constant elements should be in the accumulator. | 190 // Literals creation. Constant elements should be in the accumulator. |
191 BytecodeArrayBuilder& CreateRegExpLiteral(Handle<String> pattern, | 191 BytecodeArrayBuilder& CreateRegExpLiteral(Handle<String> pattern, |
192 int literal_index, int flags); | 192 int literal_index, int flags); |
193 BytecodeArrayBuilder& CreateArrayLiteral( | 193 BytecodeArrayBuilder& CreateArrayLiteral(size_t entry, int literal_index, |
rmcilroy
2017/01/13 09:53:57
nit - constant_elements_entry (and in cc file)
Leszek Swirski
2017/01/13 10:58:10
Done. (Also changed CreateClosure for consistency)
| |
194 Handle<ConstantElementsPair> constant_elements, int literal_index, | 194 int flags); |
195 int flags); | 195 BytecodeArrayBuilder& CreateObjectLiteral(size_t entry, int literal_index, |
rmcilroy
2017/01/13 09:53:57
nit - constant_properties_entry (and in cc file)
Leszek Swirski
2017/01/13 10:58:10
Done.
| |
196 BytecodeArrayBuilder& CreateObjectLiteral( | 196 int flags, Register output); |
197 Handle<FixedArray> constant_properties, int literal_index, int flags, | |
198 Register output); | |
199 | 197 |
200 // Push the context in accumulator as the new context, and store in register | 198 // Push the context in accumulator as the new context, and store in register |
201 // |context|. | 199 // |context|. |
202 BytecodeArrayBuilder& PushContext(Register context); | 200 BytecodeArrayBuilder& PushContext(Register context); |
203 | 201 |
204 // Pop the current context and replace with |context|. | 202 // Pop the current context and replace with |context|. |
205 BytecodeArrayBuilder& PopContext(Register context); | 203 BytecodeArrayBuilder& PopContext(Register context); |
206 | 204 |
207 // Call a JS function. The JSFunction or Callable to be called should be in | 205 // Call a JS function. The JSFunction or Callable to be called should be in |
208 // |callable|. The arguments should be in |args|, with the receiver in | 206 // |callable|. The arguments should be in |args|, with the receiver in |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 // Exception handling. | 319 // Exception handling. |
322 BytecodeArrayBuilder& MarkHandler(int handler_id, | 320 BytecodeArrayBuilder& MarkHandler(int handler_id, |
323 HandlerTable::CatchPrediction will_catch); | 321 HandlerTable::CatchPrediction will_catch); |
324 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); | 322 BytecodeArrayBuilder& MarkTryBegin(int handler_id, Register context); |
325 BytecodeArrayBuilder& MarkTryEnd(int handler_id); | 323 BytecodeArrayBuilder& MarkTryEnd(int handler_id); |
326 | 324 |
327 // Creates a new handler table entry and returns a {hander_id} identifying the | 325 // Creates a new handler table entry and returns a {hander_id} identifying the |
328 // entry, so that it can be referenced by above exception handling support. | 326 // entry, so that it can be referenced by above exception handling support. |
329 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } | 327 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } |
330 | 328 |
329 // Gets a constant pool entry for the |object|. | |
330 size_t GetConstantPoolEntry(Handle<Object> object); | |
331 // Allocates a slot in the constant pool which can later be inserted. | 331 // Allocates a slot in the constant pool which can later be inserted. |
332 size_t AllocateConstantPoolEntry(); | 332 size_t AllocateConstantPoolEntry(); |
333 // Inserts a entry into an allocated constant pool entry. | 333 // Inserts a entry into an allocated constant pool entry. |
334 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object); | 334 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object); |
335 | 335 |
336 void InitializeReturnPosition(FunctionLiteral* literal); | 336 void InitializeReturnPosition(FunctionLiteral* literal); |
337 | 337 |
338 void SetStatementPosition(Statement* stmt) { | 338 void SetStatementPosition(Statement* stmt) { |
339 if (stmt->position() == kNoSourcePosition) return; | 339 if (stmt->position() == kNoSourcePosition) return; |
340 latest_source_info_.MakeStatementPosition(stmt->position()); | 340 latest_source_info_.MakeStatementPosition(stmt->position()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
387 INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); | 387 INLINE(void Output##Name(BytecodeLabel* label, Operands... operands)); |
388 BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) | 388 BYTECODE_LIST(DECLARE_BYTECODE_OUTPUT) |
389 #undef DECLARE_OPERAND_TYPE_INFO | 389 #undef DECLARE_OPERAND_TYPE_INFO |
390 | 390 |
391 bool RegisterIsValid(Register reg) const; | 391 bool RegisterIsValid(Register reg) const; |
392 bool RegisterListIsValid(RegisterList reg_list) const; | 392 bool RegisterListIsValid(RegisterList reg_list) const; |
393 | 393 |
394 // Set position for return. | 394 // Set position for return. |
395 void SetReturnPosition(); | 395 void SetReturnPosition(); |
396 | 396 |
397 // Gets a constant pool entry for the |object|. | |
398 size_t GetConstantPoolEntry(Handle<Object> object); | |
399 | |
400 // Not implemented as the illegal bytecode is used inside internally | 397 // Not implemented as the illegal bytecode is used inside internally |
401 // to indicate a bytecode field is not valid or an error has occured | 398 // to indicate a bytecode field is not valid or an error has occured |
402 // during bytecode generation. | 399 // during bytecode generation. |
403 BytecodeArrayBuilder& Illegal(); | 400 BytecodeArrayBuilder& Illegal(); |
404 | 401 |
405 template <Bytecode bytecode, AccumulatorUse accumulator_use> | 402 template <Bytecode bytecode, AccumulatorUse accumulator_use> |
406 void PrepareToOutputBytecode(); | 403 void PrepareToOutputBytecode(); |
407 | 404 |
408 void LeaveBasicBlock() { return_seen_in_block_ = false; } | 405 void LeaveBasicBlock() { return_seen_in_block_ = false; } |
409 | 406 |
(...skipping 29 matching lines...) Expand all Loading... | |
439 static int const kNoFeedbackSlot = 0; | 436 static int const kNoFeedbackSlot = 0; |
440 | 437 |
441 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 438 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
442 }; | 439 }; |
443 | 440 |
444 } // namespace interpreter | 441 } // namespace interpreter |
445 } // namespace internal | 442 } // namespace internal |
446 } // namespace v8 | 443 } // namespace v8 |
447 | 444 |
448 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 445 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |