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 5170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5181 }}, | 5181 }}, |
5182 }; | 5182 }; |
5183 | 5183 |
5184 for (size_t i = 0; i < arraysize(snippets); i++) { | 5184 for (size_t i = 0; i < arraysize(snippets); i++) { |
5185 Handle<BytecodeArray> bytecode_array = | 5185 Handle<BytecodeArray> bytecode_array = |
5186 helper.MakeBytecodeForFunction(snippets[i].code_snippet); | 5186 helper.MakeBytecodeForFunction(snippets[i].code_snippet); |
5187 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5187 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
5188 } | 5188 } |
5189 } | 5189 } |
5190 | 5190 |
| 5191 |
| 5192 TEST(NewTarget) { |
| 5193 InitializedHandleScope handle_scope; |
| 5194 BytecodeGeneratorHelper helper; |
| 5195 |
| 5196 ExpectedSnippet<int> snippets[] = { |
| 5197 {"return new.target;", |
| 5198 1 * kPointerSize, |
| 5199 1, |
| 5200 10, |
| 5201 { |
| 5202 B(CallRuntime), U16(Runtime::kGetOriginalConstructor), R(0), // |
| 5203 U8(0), // |
| 5204 B(Star), R(0), // |
| 5205 B(Ldar), R(0), // |
| 5206 B(Return), // |
| 5207 }}, |
| 5208 }; |
| 5209 |
| 5210 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5211 Handle<BytecodeArray> bytecode_array = |
| 5212 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5213 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5214 } |
| 5215 } |
| 5216 |
5191 } // namespace interpreter | 5217 } // namespace interpreter |
5192 } // namespace internal | 5218 } // namespace internal |
5193 } // namespace v8 | 5219 } // namespace v8 |
OLD | NEW |