OLD | NEW |
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/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
6 | 6 |
7 #include "src/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 __ SetAccumulator(result); | 1566 __ SetAccumulator(result); |
1567 __ Dispatch(); | 1567 __ Dispatch(); |
1568 } | 1568 } |
1569 | 1569 |
1570 | 1570 |
1571 // CreateRegExpLiteral <pattern_idx> <literal_idx> <flags> | 1571 // CreateRegExpLiteral <pattern_idx> <literal_idx> <flags> |
1572 // | 1572 // |
1573 // Creates a regular expression literal for literal index <literal_idx> with | 1573 // Creates a regular expression literal for literal index <literal_idx> with |
1574 // <flags> and the pattern in <pattern_idx>. | 1574 // <flags> and the pattern in <pattern_idx>. |
1575 void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) { | 1575 void Interpreter::DoCreateRegExpLiteral(InterpreterAssembler* assembler) { |
1576 DoCreateLiteral(Runtime::kCreateRegExpLiteral, assembler); | 1576 Callable callable = CodeFactory::FastCloneRegExp(isolate_); |
| 1577 Node* target = __ HeapConstant(callable.code()); |
| 1578 Node* index = __ BytecodeOperandIdx(0); |
| 1579 Node* pattern = __ LoadConstantPoolEntry(index); |
| 1580 Node* literal_index_raw = __ BytecodeOperandIdx(1); |
| 1581 Node* literal_index = __ SmiTag(literal_index_raw); |
| 1582 Node* flags_raw = __ BytecodeOperandImm(2); |
| 1583 Node* flags = __ SmiTag(flags_raw); |
| 1584 Node* closure = __ LoadRegister(Register::function_closure()); |
| 1585 Node* context = __ GetContext(); |
| 1586 Node* result = __ CallStub(callable.descriptor(), target, context, closure, |
| 1587 literal_index, pattern, flags); |
| 1588 __ SetAccumulator(result); |
| 1589 __ Dispatch(); |
1577 } | 1590 } |
1578 | 1591 |
1579 | 1592 |
1580 // CreateRegExpLiteralWide <pattern_idx> <literal_idx> <flags> | 1593 // CreateRegExpLiteralWide <pattern_idx> <literal_idx> <flags> |
1581 // | 1594 // |
1582 // Creates a regular expression literal for literal index <literal_idx> with | 1595 // Creates a regular expression literal for literal index <literal_idx> with |
1583 // <flags> and the pattern in <pattern_idx>. | 1596 // <flags> and the pattern in <pattern_idx>. |
1584 void Interpreter::DoCreateRegExpLiteralWide(InterpreterAssembler* assembler) { | 1597 void Interpreter::DoCreateRegExpLiteralWide(InterpreterAssembler* assembler) { |
1585 DoCreateLiteral(Runtime::kCreateRegExpLiteral, assembler); | 1598 DoCreateRegExpLiteral(assembler); |
1586 } | 1599 } |
1587 | 1600 |
1588 | 1601 |
1589 // CreateArrayLiteral <element_idx> <literal_idx> <flags> | 1602 // CreateArrayLiteral <element_idx> <literal_idx> <flags> |
1590 // | 1603 // |
1591 // Creates an array literal for literal index <literal_idx> with flags <flags> | 1604 // Creates an array literal for literal index <literal_idx> with flags <flags> |
1592 // and constant elements in <element_idx>. | 1605 // and constant elements in <element_idx>. |
1593 void Interpreter::DoCreateArrayLiteral(InterpreterAssembler* assembler) { | 1606 void Interpreter::DoCreateArrayLiteral(InterpreterAssembler* assembler) { |
1594 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler); | 1607 DoCreateLiteral(Runtime::kCreateArrayLiteral, assembler); |
1595 } | 1608 } |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 Node* index = __ LoadRegister(index_reg); | 1850 Node* index = __ LoadRegister(index_reg); |
1838 Node* one = __ SmiConstant(Smi::FromInt(1)); | 1851 Node* one = __ SmiConstant(Smi::FromInt(1)); |
1839 Node* result = __ SmiAdd(index, one); | 1852 Node* result = __ SmiAdd(index, one); |
1840 __ SetAccumulator(result); | 1853 __ SetAccumulator(result); |
1841 __ Dispatch(); | 1854 __ Dispatch(); |
1842 } | 1855 } |
1843 | 1856 |
1844 } // namespace interpreter | 1857 } // namespace interpreter |
1845 } // namespace internal | 1858 } // namespace internal |
1846 } // namespace v8 | 1859 } // namespace v8 |
OLD | NEW |