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

Side by Side Diff: src/interpreter/bytecode-array-writer.cc

Issue 2331033002: [interpreter] Merge {OsrPoll} with {Jump} bytecode. (Closed)
Patch Set: One more test. 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 | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-generator.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 #include "src/interpreter/bytecode-array-writer.h" 5 #include "src/interpreter/bytecode-array-writer.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/interpreter/bytecode-label.h" 8 #include "src/interpreter/bytecode-label.h"
9 #include "src/interpreter/bytecode-register.h" 9 #include "src/interpreter/bytecode-register.h"
10 #include "src/interpreter/constant-array-builder.h" 10 #include "src/interpreter/constant-array-builder.h"
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 CHECK_LE(current_offset, static_cast<size_t>(kMaxInt)); 350 CHECK_LE(current_offset, static_cast<size_t>(kMaxInt));
351 // Label has been bound already so this is a backwards jump. 351 // Label has been bound already so this is a backwards jump.
352 size_t abs_delta = current_offset - label->offset(); 352 size_t abs_delta = current_offset - label->offset();
353 int delta = -static_cast<int>(abs_delta); 353 int delta = -static_cast<int>(abs_delta);
354 OperandSize operand_size = Bytecodes::SizeForSignedOperand(delta); 354 OperandSize operand_size = Bytecodes::SizeForSignedOperand(delta);
355 if (operand_size > OperandSize::kByte) { 355 if (operand_size > OperandSize::kByte) {
356 // Adjust for scaling byte prefix for wide jump offset. 356 // Adjust for scaling byte prefix for wide jump offset.
357 DCHECK_LE(delta, 0); 357 DCHECK_LE(delta, 0);
358 delta -= 1; 358 delta -= 1;
359 } 359 }
360 node->set_bytecode(node->bytecode(), delta); 360 DCHECK_EQ(Bytecode::kJumpLoop, node->bytecode());
361 node->set_bytecode(node->bytecode(), delta, node->operand(1));
361 } else { 362 } else {
362 // The label has not yet been bound so this is a forward reference 363 // The label has not yet been bound so this is a forward reference
363 // that will be patched when the label is bound. We create a 364 // that will be patched when the label is bound. We create a
364 // reservation in the constant pool so the jump can be patched 365 // reservation in the constant pool so the jump can be patched
365 // when the label is bound. The reservation means the maximum size 366 // when the label is bound. The reservation means the maximum size
366 // of the operand for the constant is known and the jump can 367 // of the operand for the constant is known and the jump can
367 // be emitted into the bytecode stream with space for the operand. 368 // be emitted into the bytecode stream with space for the operand.
368 unbound_jumps_++; 369 unbound_jumps_++;
369 label->set_referrer(current_offset); 370 label->set_referrer(current_offset);
370 OperandSize reserved_operand_size = 371 OperandSize reserved_operand_size =
371 constant_array_builder()->CreateReservedEntry(); 372 constant_array_builder()->CreateReservedEntry();
373 DCHECK_NE(Bytecode::kJumpLoop, node->bytecode());
372 switch (reserved_operand_size) { 374 switch (reserved_operand_size) {
373 case OperandSize::kNone: 375 case OperandSize::kNone:
374 UNREACHABLE(); 376 UNREACHABLE();
375 break; 377 break;
376 case OperandSize::kByte: 378 case OperandSize::kByte:
377 node->set_bytecode(node->bytecode(), k8BitJumpPlaceholder); 379 node->set_bytecode(node->bytecode(), k8BitJumpPlaceholder);
378 break; 380 break;
379 case OperandSize::kShort: 381 case OperandSize::kShort:
380 node->set_bytecode(node->bytecode(), k16BitJumpPlaceholder); 382 node->set_bytecode(node->bytecode(), k16BitJumpPlaceholder);
381 break; 383 break;
382 case OperandSize::kQuad: 384 case OperandSize::kQuad:
383 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); 385 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder);
384 break; 386 break;
385 } 387 }
386 } 388 }
387 EmitBytecode(node); 389 EmitBytecode(node);
388 } 390 }
389 391
390 } // namespace interpreter 392 } // namespace interpreter
391 } // namespace internal 393 } // namespace internal
392 } // namespace v8 394 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698