Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Unified Diff: src/interpreter/bytecode-array-builder.h

Issue 2351763002: [Interpreter] Optimize BytecodeArrayBuilder and BytecodeArrayWriter. (Closed)
Patch Set: Fix Chromium Windows bots. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « BUILD.gn ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.h
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h
index 8ff0023093ea6f027d7c51d4b0b7ec85610a9699..b54365a68899be19c648c5ba7c73e063cfde2ce1 100644
--- a/src/interpreter/bytecode-array-builder.h
+++ b/src/interpreter/bytecode-array-builder.h
@@ -309,9 +309,24 @@ class BytecodeArrayBuilder final : public ZoneObject {
void InitializeReturnPosition(FunctionLiteral* literal);
- void SetStatementPosition(Statement* stmt);
- void SetExpressionPosition(Expression* expr);
- void SetExpressionAsStatementPosition(Expression* expr);
+ void SetStatementPosition(Statement* stmt) {
+ if (stmt->position() == kNoSourcePosition) return;
+ latest_source_info_.MakeStatementPosition(stmt->position());
+ }
+
+ void SetExpressionPosition(Expression* expr) {
+ if (expr->position() == kNoSourcePosition) return;
+ if (!latest_source_info_.is_statement()) {
+ // Ensure the current expression position is overwritten with the
+ // latest value.
+ latest_source_info_.MakeExpressionPosition(expr->position());
+ }
+ }
+
+ void SetExpressionAsStatementPosition(Expression* expr) {
+ if (expr->position() == kNoSourcePosition) return;
+ latest_source_info_.MakeStatementPosition(expr->position());
+ }
// Accessors
TemporaryRegisterAllocator* temporary_register_allocator() {
@@ -345,36 +360,23 @@ class BytecodeArrayBuilder final : public ZoneObject {
private:
friend class BytecodeRegisterAllocator;
- static Bytecode BytecodeForBinaryOperation(Token::Value op);
- static Bytecode BytecodeForCountOperation(Token::Value op);
- static Bytecode BytecodeForCompareOperation(Token::Value op);
- static Bytecode BytecodeForStoreNamedProperty(LanguageMode language_mode);
- static Bytecode BytecodeForStoreKeyedProperty(LanguageMode language_mode);
- static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode);
- static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode);
- static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode);
- static Bytecode BytecodeForCreateArguments(CreateArgumentsType type);
- static Bytecode BytecodeForDelete(LanguageMode language_mode);
- static Bytecode BytecodeForCall(TailCallMode tail_call_mode);
-
- void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
- uint32_t operand2, uint32_t operand3);
- void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
- uint32_t operand2);
- void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1);
- void Output(Bytecode bytecode, uint32_t operand0);
- void Output(Bytecode bytecode);
-
- BytecodeArrayBuilder& OutputJump(BytecodeNode* node, BytecodeLabel* label);
+ INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
+ uint32_t operand2, uint32_t operand3));
+ INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
+ uint32_t operand2));
+ INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1));
+ INLINE(void Output(Bytecode bytecode, uint32_t operand0));
+ INLINE(void Output(Bytecode bytecode));
+
+ INLINE(void OutputJump(Bytecode bytecode, BytecodeLabel* label));
+ INLINE(void OutputJump(Bytecode bytecode, uint32_t operand0,
+ BytecodeLabel* label));
bool RegisterIsValid(Register reg) const;
bool OperandsAreValid(Bytecode bytecode, int operand_count,
uint32_t operand0 = 0, uint32_t operand1 = 0,
uint32_t operand2 = 0, uint32_t operand3 = 0) const;
- // Attach latest source position to |node|.
- void AttachSourceInfo(BytecodeNode* node);
-
// Set position for return.
void SetReturnPosition();
« no previous file with comments | « BUILD.gn ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698