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

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

Issue 1503963002: [Interpreter] Adds wide variant of CreateLiterals. Adds CreateLiterals to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // TODO(rmcilroy): Consider passing the type as a bytecode operand rather 522 // TODO(rmcilroy): Consider passing the type as a bytecode operand rather
523 // than having two different bytecodes once we have better support for 523 // than having two different bytecodes once we have better support for
524 // branches in the InterpreterAssembler. 524 // branches in the InterpreterAssembler.
525 Bytecode bytecode = BytecodeForCreateArguments(type); 525 Bytecode bytecode = BytecodeForCreateArguments(type);
526 Output(bytecode); 526 Output(bytecode);
527 return *this; 527 return *this;
528 } 528 }
529 529
530 530
531 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral( 531 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
532 int literal_index, int flags) { 532 Handle<String> pattern, int literal_index, int flags) {
533 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits. 533 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
534 if (FitsInIdx8Operand(literal_index)) { 534 size_t pattern_entry = GetConstantPoolEntry(pattern);
535 Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(literal_index), 535 if (FitsInIdx8Operand(literal_index) && FitsInIdx8Operand(pattern_entry)) {
536 static_cast<uint8_t>(flags)); 536 Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(pattern_entry),
537 static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
537 } else { 538 } else {
rmcilroy 2015/12/07 14:33:22 Are you adding wide variants in this CL or a subse
mythria 2015/12/07 15:11:18 Added wide variants with patchset2.
538 UNIMPLEMENTED(); 539 UNIMPLEMENTED();
539 } 540 }
540 return *this; 541 return *this;
541 } 542 }
542 543
543 544
544 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral( 545 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral(
545 int literal_index, int flags) { 546 Handle<FixedArray> constant_elements, int literal_index, int flags) {
546 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits. 547 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
547 if (FitsInIdx8Operand(literal_index)) { 548 size_t cons_element_entry = GetConstantPoolEntry(constant_elements);
rmcilroy 2015/12/07 14:33:22 don't abbreviate (cons_element_entry -> constant_e
mythria 2015/12/07 15:11:18 Done.
548 Output(Bytecode::kCreateArrayLiteral, static_cast<uint8_t>(literal_index), 549 if (FitsInIdx8Operand(literal_index) &&
549 static_cast<uint8_t>(flags)); 550 FitsInIdx8Operand(cons_element_entry)) {
551 Output(Bytecode::kCreateArrayLiteral,
552 static_cast<uint8_t>(cons_element_entry),
553 static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
550 } else { 554 } else {
551 UNIMPLEMENTED(); 555 UNIMPLEMENTED();
552 } 556 }
553 return *this; 557 return *this;
554 } 558 }
555 559
556 560
557 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral( 561 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral(
558 int literal_index, int flags) { 562 Handle<FixedArray> constant_properties, int literal_index, int flags) {
559 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits. 563 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
560 if (FitsInIdx8Operand(literal_index)) { 564 size_t cons_property_entry = GetConstantPoolEntry(constant_properties);
rmcilroy 2015/12/07 14:33:22 ditto
mythria 2015/12/07 15:11:18 Done.
561 Output(Bytecode::kCreateObjectLiteral, static_cast<uint8_t>(literal_index), 565 if (FitsInIdx8Operand(literal_index) &&
562 static_cast<uint8_t>(flags)); 566 FitsInIdx8Operand(cons_property_entry)) {
567 Output(Bytecode::kCreateObjectLiteral,
568 static_cast<uint8_t>(cons_property_entry),
569 static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
563 } else { 570 } else {
564 UNIMPLEMENTED(); 571 UNIMPLEMENTED();
565 } 572 }
566 return *this; 573 return *this;
567 } 574 }
568 575
569 576
570 BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) { 577 BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) {
571 Output(Bytecode::kPushContext, context.ToOperand()); 578 Output(Bytecode::kPushContext, context.ToOperand());
572 return *this; 579 return *this;
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 DCHECK_GT(next_consecutive_count_, 0); 1431 DCHECK_GT(next_consecutive_count_, 0);
1425 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1432 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1426 allocated_.push_back(next_consecutive_register_); 1433 allocated_.push_back(next_consecutive_register_);
1427 next_consecutive_count_--; 1434 next_consecutive_count_--;
1428 return Register(next_consecutive_register_++); 1435 return Register(next_consecutive_register_++);
1429 } 1436 }
1430 1437
1431 } // namespace interpreter 1438 } // namespace interpreter
1432 } // namespace internal 1439 } // namespace internal
1433 } // namespace v8 1440 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698