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

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: Fixed failing bytecode-array-builder-unittest 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
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 would always be the first entry in the constant pool, since rest
rmcilroy 2016/02/03 14:00:56 /s/since rest/since the rest/
rmcilroy 2016/02/03 14:00:56 /s/would/will
mythria 2016/02/03 15:56:16 Done.
mythria 2016/02/03 15:56:16 Done.
613 // arguments object is created at the start of function just after creating
rmcilroy 2016/02/03 14:00:56 /s/function/the function/
mythria 2016/02/03 15:56:16 Done.
614 // arguments object.
rmcilroy 2016/02/03 14:00:56 /s/arguments/the arguments
mythria 2016/02/03 15:56:16 Done.
615 DCHECK_EQ(index_entry, 0);
mythria 2016/02/03 12:44:36 I will change it to DCHECK(FitsInIdx8Operand(index
rmcilroy 2016/02/03 14:00:56 Yes please do that, but also make it a CHECK rathe
mythria 2016/02/03 15:56:16 Done.
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

Powered by Google App Engine
This is Rietveld 408576698