| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // Returns the number of fixed and temporary registers. | 67 // Returns the number of fixed and temporary registers. |
| 68 int total_register_count() const { | 68 int total_register_count() const { |
| 69 DCHECK_LE(fixed_register_count(), | 69 DCHECK_LE(fixed_register_count(), |
| 70 register_allocator()->maximum_register_count()); | 70 register_allocator()->maximum_register_count()); |
| 71 return register_allocator()->maximum_register_count(); | 71 return register_allocator()->maximum_register_count(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 Register Parameter(int parameter_index) const; | 74 Register Parameter(int parameter_index) const; |
| 75 | 75 |
| 76 // Same as Parameter(0), but indicates intent |
| 77 inline Register Receiver() const { return Parameter(0); } |
| 78 |
| 76 // Constant loads to accumulator. | 79 // Constant loads to accumulator. |
| 77 BytecodeArrayBuilder& LoadConstantPoolEntry(size_t entry); | 80 BytecodeArrayBuilder& LoadConstantPoolEntry(size_t entry); |
| 78 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); | 81 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); |
| 79 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); | 82 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); |
| 80 BytecodeArrayBuilder& LoadUndefined(); | 83 BytecodeArrayBuilder& LoadUndefined(); |
| 81 BytecodeArrayBuilder& LoadNull(); | 84 BytecodeArrayBuilder& LoadNull(); |
| 82 BytecodeArrayBuilder& LoadTheHole(); | 85 BytecodeArrayBuilder& LoadTheHole(); |
| 83 BytecodeArrayBuilder& LoadTrue(); | 86 BytecodeArrayBuilder& LoadTrue(); |
| 84 BytecodeArrayBuilder& LoadFalse(); | 87 BytecodeArrayBuilder& LoadFalse(); |
| 85 | 88 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Inserts a entry into an allocated constant pool entry. | 343 // Inserts a entry into an allocated constant pool entry. |
| 341 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object); | 344 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object); |
| 342 | 345 |
| 343 void InitializeReturnPosition(FunctionLiteral* literal); | 346 void InitializeReturnPosition(FunctionLiteral* literal); |
| 344 | 347 |
| 345 void SetStatementPosition(Statement* stmt) { | 348 void SetStatementPosition(Statement* stmt) { |
| 346 if (stmt->position() == kNoSourcePosition) return; | 349 if (stmt->position() == kNoSourcePosition) return; |
| 347 latest_source_info_.MakeStatementPosition(stmt->position()); | 350 latest_source_info_.MakeStatementPosition(stmt->position()); |
| 348 } | 351 } |
| 349 | 352 |
| 350 void SetExpressionPosition(Expression* expr) { | 353 inline void SetExpressionPosition(Expression* expr) { |
| 351 if (expr->position() == kNoSourcePosition) return; | 354 SetExpressionPosition(expr->position()); |
| 355 } |
| 356 |
| 357 void SetExpressionPosition(int position) { |
| 358 if (position == kNoSourcePosition) return; |
| 352 if (!latest_source_info_.is_statement()) { | 359 if (!latest_source_info_.is_statement()) { |
| 353 // Ensure the current expression position is overwritten with the | 360 // Ensure the current expression position is overwritten with the |
| 354 // latest value. | 361 // latest value. |
| 355 latest_source_info_.MakeExpressionPosition(expr->position()); | 362 latest_source_info_.MakeExpressionPosition(position); |
| 356 } | 363 } |
| 357 } | 364 } |
| 358 | 365 |
| 359 void SetExpressionAsStatementPosition(Expression* expr) { | 366 void SetExpressionAsStatementPosition(Expression* expr) { |
| 360 if (expr->position() == kNoSourcePosition) return; | 367 if (expr->position() == kNoSourcePosition) return; |
| 361 latest_source_info_.MakeStatementPosition(expr->position()); | 368 latest_source_info_.MakeStatementPosition(expr->position()); |
| 362 } | 369 } |
| 363 | 370 |
| 364 bool RequiresImplicitReturn() const { return !return_seen_in_block_; } | 371 bool RequiresImplicitReturn() const { return !return_seen_in_block_; } |
| 365 | 372 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 static int const kNoFeedbackSlot = 0; | 450 static int const kNoFeedbackSlot = 0; |
| 444 | 451 |
| 445 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); | 452 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); |
| 446 }; | 453 }; |
| 447 | 454 |
| 448 } // namespace interpreter | 455 } // namespace interpreter |
| 449 } // namespace internal | 456 } // namespace internal |
| 450 } // namespace v8 | 457 } // namespace v8 |
| 451 | 458 |
| 452 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 459 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
| OLD | NEW |