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 // TODO(rmcilroy): Remove this define after this flag is turned on globally | 5 // TODO(rmcilroy): Remove this define after this flag is turned on globally |
6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1540 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
1541 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1541 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
1542 } | 1542 } |
1543 } | 1543 } |
1544 | 1544 |
1545 | 1545 |
1546 TEST(CallRuntime) { | 1546 TEST(CallRuntime) { |
1547 InitializedHandleScope handle_scope; | 1547 InitializedHandleScope handle_scope; |
1548 BytecodeGeneratorHelper helper; | 1548 BytecodeGeneratorHelper helper; |
1549 | 1549 |
1550 ExpectedSnippet<int> snippets[] = { | 1550 ExpectedSnippet<InstanceType> snippets[] = { |
1551 { | 1551 { |
1552 "function f() { %TheHole() }\nf()", | 1552 "function f() { %TheHole() }\nf()", |
1553 1 * kPointerSize, | 1553 0, |
1554 1, | 1554 1, |
1555 7, | 1555 7, |
1556 { | 1556 { |
1557 B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), // | 1557 B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), // |
1558 B(LdaUndefined), // | 1558 B(LdaUndefined), // |
1559 B(Return) // | 1559 B(Return) // |
1560 }, | 1560 }, |
1561 }, | 1561 }, |
1562 { | 1562 { |
1563 "function f(a) { return %IsArray(a) }\nf(undefined)", | 1563 "function f(a) { return %IsArray(a) }\nf(undefined)", |
(...skipping 14 matching lines...) Expand all Loading... |
1578 14, | 1578 14, |
1579 { | 1579 { |
1580 B(LdaSmi8), U8(1), // | 1580 B(LdaSmi8), U8(1), // |
1581 B(Star), R(0), // | 1581 B(Star), R(0), // |
1582 B(LdaSmi8), U8(2), // | 1582 B(LdaSmi8), U8(2), // |
1583 B(Star), R(1), // | 1583 B(Star), R(1), // |
1584 B(CallRuntime), U16(Runtime::kAdd), R(0), U8(2), // | 1584 B(CallRuntime), U16(Runtime::kAdd), R(0), U8(2), // |
1585 B(Return) // | 1585 B(Return) // |
1586 }, | 1586 }, |
1587 }, | 1587 }, |
| 1588 { |
| 1589 "function f() { return %spread_iterable([1]) }\nf()", |
| 1590 2 * kPointerSize, |
| 1591 1, |
| 1592 16, |
| 1593 { |
| 1594 B(LdaUndefined), // |
| 1595 B(Star), R(0), // |
| 1596 B(LdaConstant), U8(0), // |
| 1597 B(CreateArrayLiteral), U8(0), U8(3), // |
| 1598 B(Star), R(1), // |
| 1599 B(CallJSRuntime), U16(Context::SPREAD_ITERABLE_INDEX), R(0), // |
| 1600 U8(1), // |
| 1601 B(Return), // |
| 1602 }, |
| 1603 1, |
| 1604 {InstanceType::FIXED_ARRAY_TYPE}, |
| 1605 }, |
1588 }; | 1606 }; |
1589 | 1607 |
1590 for (size_t i = 0; i < arraysize(snippets); i++) { | 1608 for (size_t i = 0; i < arraysize(snippets); i++) { |
1591 Handle<BytecodeArray> bytecode_array = | 1609 Handle<BytecodeArray> bytecode_array = |
1592 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1610 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
1593 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1611 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
1594 } | 1612 } |
1595 } | 1613 } |
1596 | 1614 |
1597 | 1615 |
(...skipping 3527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5125 for (size_t i = 0; i < arraysize(snippets); i++) { | 5143 for (size_t i = 0; i < arraysize(snippets); i++) { |
5126 Handle<BytecodeArray> bytecode_array = | 5144 Handle<BytecodeArray> bytecode_array = |
5127 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5145 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
5128 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5146 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
5129 } | 5147 } |
5130 } | 5148 } |
5131 | 5149 |
5132 } // namespace interpreter | 5150 } // namespace interpreter |
5133 } // namespace internal | 5151 } // namespace internal |
5134 } // namespace v8 | 5152 } // namespace v8 |
OLD | NEW |