Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(633)

Side by Side Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1406253008: [Interpreter] Add support for VisitThisFunction. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_jsruntime
Patch Set: Add tests Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698