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 5129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5140 }}, | 5140 }}, |
5141 }; | 5141 }; |
5142 | 5142 |
5143 for (size_t i = 0; i < arraysize(snippets); i++) { | 5143 for (size_t i = 0; i < arraysize(snippets); i++) { |
5144 Handle<BytecodeArray> bytecode_array = | 5144 Handle<BytecodeArray> bytecode_array = |
5145 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5145 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
5146 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5146 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
5147 } | 5147 } |
5148 } | 5148 } |
5149 | 5149 |
| 5150 |
| 5151 TEST(ThisFunction) { |
| 5152 InitializedHandleScope handle_scope; |
| 5153 BytecodeGeneratorHelper helper; |
| 5154 |
| 5155 int closure = Register::function_closure().index(); |
| 5156 |
| 5157 ExpectedSnippet<int> snippets[] = { |
| 5158 {"var f;\n f = function f() { }", |
| 5159 1 * kPointerSize, |
| 5160 1, |
| 5161 9, |
| 5162 { |
| 5163 B(LdaTheHole), // |
| 5164 B(Star), R(0), // |
| 5165 B(Ldar), R(closure), // |
| 5166 B(Star), R(0), // |
| 5167 B(LdaUndefined), // |
| 5168 B(Return), // |
| 5169 }}, |
| 5170 {"var f;\n f = function f() { return f; }", |
| 5171 1 * kPointerSize, |
| 5172 1, |
| 5173 10, |
| 5174 { |
| 5175 B(LdaTheHole), // |
| 5176 B(Star), R(0), // |
| 5177 B(Ldar), R(closure), // |
| 5178 B(Star), R(0), // |
| 5179 B(Ldar), R(0), // |
| 5180 B(Return), // |
| 5181 }}, |
| 5182 }; |
| 5183 |
| 5184 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5185 Handle<BytecodeArray> bytecode_array = |
| 5186 helper.MakeBytecodeForFunction(snippets[i].code_snippet); |
| 5187 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5188 } |
| 5189 } |
| 5190 |
5150 } // namespace interpreter | 5191 } // namespace interpreter |
5151 } // namespace internal | 5192 } // namespace internal |
5152 } // namespace v8 | 5193 } // namespace v8 |
OLD | NEW |