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

Side by Side Diff: src/interpreter/bytecode-array-builder.h

Issue 2358423002: Version 5.5.251.1 (cherry-pick) (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « include/v8-version.h ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 // entry, so that it can be referenced by above exception handling support. 302 // entry, so that it can be referenced by above exception handling support.
303 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); } 303 int NewHandlerEntry() { return handler_table_builder()->NewHandlerEntry(); }
304 304
305 // Allocates a slot in the constant pool which can later be inserted. 305 // Allocates a slot in the constant pool which can later be inserted.
306 size_t AllocateConstantPoolEntry(); 306 size_t AllocateConstantPoolEntry();
307 // Inserts a entry into an allocated constant pool entry. 307 // Inserts a entry into an allocated constant pool entry.
308 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object); 308 void InsertConstantPoolEntryAt(size_t entry, Handle<Object> object);
309 309
310 void InitializeReturnPosition(FunctionLiteral* literal); 310 void InitializeReturnPosition(FunctionLiteral* literal);
311 311
312 void SetStatementPosition(Statement* stmt) { 312 void SetStatementPosition(Statement* stmt);
313 if (stmt->position() == kNoSourcePosition) return; 313 void SetExpressionPosition(Expression* expr);
314 latest_source_info_.MakeStatementPosition(stmt->position()); 314 void SetExpressionAsStatementPosition(Expression* expr);
315 }
316
317 void SetExpressionPosition(Expression* expr) {
318 if (expr->position() == kNoSourcePosition) return;
319 if (!latest_source_info_.is_statement()) {
320 // Ensure the current expression position is overwritten with the
321 // latest value.
322 latest_source_info_.MakeExpressionPosition(expr->position());
323 }
324 }
325
326 void SetExpressionAsStatementPosition(Expression* expr) {
327 if (expr->position() == kNoSourcePosition) return;
328 latest_source_info_.MakeStatementPosition(expr->position());
329 }
330 315
331 // Accessors 316 // Accessors
332 TemporaryRegisterAllocator* temporary_register_allocator() { 317 TemporaryRegisterAllocator* temporary_register_allocator() {
333 return &temporary_allocator_; 318 return &temporary_allocator_;
334 } 319 }
335 const TemporaryRegisterAllocator* temporary_register_allocator() const { 320 const TemporaryRegisterAllocator* temporary_register_allocator() const {
336 return &temporary_allocator_; 321 return &temporary_allocator_;
337 } 322 }
338 Zone* zone() const { return zone_; } 323 Zone* zone() const { return zone_; }
339 324
(...skipping 13 matching lines...) Expand all
353 } 338 }
354 339
355 static uint32_t UnsignedOperand(size_t value) { 340 static uint32_t UnsignedOperand(size_t value) {
356 DCHECK_LE(value, kMaxUInt32); 341 DCHECK_LE(value, kMaxUInt32);
357 return static_cast<uint32_t>(value); 342 return static_cast<uint32_t>(value);
358 } 343 }
359 344
360 private: 345 private:
361 friend class BytecodeRegisterAllocator; 346 friend class BytecodeRegisterAllocator;
362 347
363 INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, 348 static Bytecode BytecodeForBinaryOperation(Token::Value op);
364 uint32_t operand2, uint32_t operand3)); 349 static Bytecode BytecodeForCountOperation(Token::Value op);
365 INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1, 350 static Bytecode BytecodeForCompareOperation(Token::Value op);
366 uint32_t operand2)); 351 static Bytecode BytecodeForStoreNamedProperty(LanguageMode language_mode);
367 INLINE(void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1)); 352 static Bytecode BytecodeForStoreKeyedProperty(LanguageMode language_mode);
368 INLINE(void Output(Bytecode bytecode, uint32_t operand0)); 353 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode);
369 INLINE(void Output(Bytecode bytecode)); 354 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode);
355 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode);
356 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type);
357 static Bytecode BytecodeForDelete(LanguageMode language_mode);
358 static Bytecode BytecodeForCall(TailCallMode tail_call_mode);
370 359
371 INLINE(void OutputJump(Bytecode bytecode, BytecodeLabel* label)); 360 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
372 INLINE(void OutputJump(Bytecode bytecode, uint32_t operand0, 361 uint32_t operand2, uint32_t operand3);
373 BytecodeLabel* label)); 362 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
363 uint32_t operand2);
364 void Output(Bytecode bytecode, uint32_t operand0, uint32_t operand1);
365 void Output(Bytecode bytecode, uint32_t operand0);
366 void Output(Bytecode bytecode);
367
368 BytecodeArrayBuilder& OutputJump(BytecodeNode* node, BytecodeLabel* label);
374 369
375 bool RegisterIsValid(Register reg) const; 370 bool RegisterIsValid(Register reg) const;
376 bool OperandsAreValid(Bytecode bytecode, int operand_count, 371 bool OperandsAreValid(Bytecode bytecode, int operand_count,
377 uint32_t operand0 = 0, uint32_t operand1 = 0, 372 uint32_t operand0 = 0, uint32_t operand1 = 0,
378 uint32_t operand2 = 0, uint32_t operand3 = 0) const; 373 uint32_t operand2 = 0, uint32_t operand3 = 0) const;
379 374
375 // Attach latest source position to |node|.
376 void AttachSourceInfo(BytecodeNode* node);
377
380 // Set position for return. 378 // Set position for return.
381 void SetReturnPosition(); 379 void SetReturnPosition();
382 380
383 // Gets a constant pool entry for the |object|. 381 // Gets a constant pool entry for the |object|.
384 size_t GetConstantPoolEntry(Handle<Object> object); 382 size_t GetConstantPoolEntry(Handle<Object> object);
385 383
386 // Not implemented as the illegal bytecode is used inside internally 384 // Not implemented as the illegal bytecode is used inside internally
387 // to indicate a bytecode field is not valid or an error has occured 385 // to indicate a bytecode field is not valid or an error has occured
388 // during bytecode generation. 386 // during bytecode generation.
389 BytecodeArrayBuilder& Illegal(); 387 BytecodeArrayBuilder& Illegal();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 static int const kNoFeedbackSlot = 0; 419 static int const kNoFeedbackSlot = 0;
422 420
423 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder); 421 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayBuilder);
424 }; 422 };
425 423
426 } // namespace interpreter 424 } // namespace interpreter
427 } // namespace internal 425 } // namespace internal
428 } // namespace v8 426 } // namespace v8
429 427
430 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ 428 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | src/interpreter/bytecode-array-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698