| 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 5168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5179 helper.MakeBytecodeForFunction(snippets[i].code_snippet); | 5179 helper.MakeBytecodeForFunction(snippets[i].code_snippet); |
| 5180 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5180 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5181 } | 5181 } |
| 5182 } | 5182 } |
| 5183 | 5183 |
| 5184 | 5184 |
| 5185 TEST(NewTarget) { | 5185 TEST(NewTarget) { |
| 5186 InitializedHandleScope handle_scope; | 5186 InitializedHandleScope handle_scope; |
| 5187 BytecodeGeneratorHelper helper; | 5187 BytecodeGeneratorHelper helper; |
| 5188 | 5188 |
| 5189 int new_target = Register::new_target().index(); |
| 5190 |
| 5189 ExpectedSnippet<int> snippets[] = { | 5191 ExpectedSnippet<int> snippets[] = { |
| 5190 {"return new.target;", | 5192 {"return new.target;", |
| 5191 1 * kPointerSize, | 5193 1 * kPointerSize, |
| 5192 1, | 5194 1, |
| 5193 8, | 5195 5, |
| 5194 { | 5196 { |
| 5195 B(CallRuntime), U16(Runtime::kGetNewTarget), R(0), U8(0), // | 5197 B(Ldar), R(new_target), // |
| 5196 B(Star), R(0), // | 5198 B(Star), R(0), // |
| 5197 B(Return), // | 5199 B(Return), // |
| 5198 }} | 5200 }}, |
| 5201 {"new.target;", |
| 5202 1 * kPointerSize, |
| 5203 1, |
| 5204 6, |
| 5205 { |
| 5206 B(Ldar), R(new_target), // |
| 5207 B(Star), R(0), // |
| 5208 B(LdaUndefined), // |
| 5209 B(Return), // |
| 5210 }}, |
| 5199 }; | 5211 }; |
| 5200 | 5212 |
| 5201 for (size_t i = 0; i < arraysize(snippets); i++) { | 5213 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5202 Handle<BytecodeArray> bytecode_array = | 5214 Handle<BytecodeArray> bytecode_array = |
| 5203 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5215 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5204 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5216 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5205 } | 5217 } |
| 5206 } | 5218 } |
| 5207 | 5219 |
| 5208 | 5220 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5479 for (size_t i = 0; i < arraysize(snippets); i++) { | 5491 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5480 Handle<BytecodeArray> bytecode_array = | 5492 Handle<BytecodeArray> bytecode_array = |
| 5481 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5493 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5482 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5494 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5483 } | 5495 } |
| 5484 } | 5496 } |
| 5485 | 5497 |
| 5486 } // namespace interpreter | 5498 } // namespace interpreter |
| 5487 } // namespace internal | 5499 } // namespace internal |
| 5488 } // namespace v8 | 5500 } // namespace v8 |
| OLD | NEW |