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

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

Issue 1664593003: [Interpreter] Adds support for rest parameters to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes comments. Created 4 years, 10 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.h ('k') | src/interpreter/bytecode-generator.h » ('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-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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArguments( 599 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArguments(
600 CreateArgumentsType type) { 600 CreateArgumentsType type) {
601 // TODO(rmcilroy): Consider passing the type as a bytecode operand rather 601 // TODO(rmcilroy): Consider passing the type as a bytecode operand rather
602 // than having two different bytecodes once we have better support for 602 // than having two different bytecodes once we have better support for
603 // branches in the InterpreterAssembler. 603 // branches in the InterpreterAssembler.
604 Bytecode bytecode = BytecodeForCreateArguments(type); 604 Bytecode bytecode = BytecodeForCreateArguments(type);
605 Output(bytecode); 605 Output(bytecode);
606 return *this; 606 return *this;
607 } 607 }
608 608
609 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRestArguments(int index) {
610 size_t index_entry =
611 GetConstantPoolEntry(Handle<Object>(Smi::FromInt(index), isolate_));
612 // This will always be the first entry in the constant pool, since the rest
613 // arguments object is created at the start of the function just after
614 // creating the arguments object.
615 CHECK(FitsInIdx8Operand(index_entry));
616 Output(Bytecode::kCreateRestArguments, static_cast<uint8_t>(index_entry));
617 return *this;
618 }
609 619
610 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral( 620 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
611 Handle<String> pattern, int literal_index, int flags) { 621 Handle<String> pattern, int literal_index, int flags) {
612 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits. 622 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
613 size_t pattern_entry = GetConstantPoolEntry(pattern); 623 size_t pattern_entry = GetConstantPoolEntry(pattern);
614 if (FitsInIdx8Operand(literal_index) && FitsInIdx8Operand(pattern_entry)) { 624 if (FitsInIdx8Operand(literal_index) && FitsInIdx8Operand(pattern_entry)) {
615 Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(pattern_entry), 625 Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(pattern_entry),
616 static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags)); 626 static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
617 } else if (FitsInIdx16Operand(literal_index) && 627 } else if (FitsInIdx16Operand(literal_index) &&
618 FitsInIdx16Operand(pattern_entry)) { 628 FitsInIdx16Operand(pattern_entry)) {
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 } 1823 }
1814 1824
1815 // static 1825 // static
1816 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { 1826 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) {
1817 return value.is_short_operand(); 1827 return value.is_short_operand();
1818 } 1828 }
1819 1829
1820 } // namespace interpreter 1830 } // namespace interpreter
1821 } // namespace internal 1831 } // namespace internal
1822 } // namespace v8 1832 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698