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

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

Issue 1392913002: [Interpreter] Adds shift operators to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed a test for shift operators and comments Created 5 years, 2 months 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/interpreter.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/bytecode-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "src/interpreter/bytecode-generator.h" 9 #include "src/interpreter/bytecode-generator.h"
10 #include "src/interpreter/interpreter.h" 10 #include "src/interpreter/interpreter.h"
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 {"var x = 0; return x;", 213 {"var x = 0; return x;",
214 kPointerSize, 214 kPointerSize,
215 1, 215 1,
216 6, 216 6,
217 { 217 {
218 B(LdaZero), // 218 B(LdaZero), //
219 B(Star), R(0), // 219 B(Star), R(0), //
220 B(Ldar), R(0), // 220 B(Ldar), R(0), //
221 B(Return) // 221 B(Return) //
222 }, 222 },
223 0 223 0},
224 },
225 {"var x = 0; return x + 3;", 224 {"var x = 0; return x + 3;",
226 2 * kPointerSize, 225 2 * kPointerSize,
227 1, 226 1,
228 12, 227 12,
229 { 228 {
230 B(LdaZero), // 229 B(LdaZero), //
231 B(Star), R(0), // 230 B(Star), R(0), //
232 B(Ldar), R(0), // Easy to spot r1 not really needed here. 231 B(Ldar), R(0), // Easy to spot r1 not really needed here.
233 B(Star), R(1), // Dead store. 232 B(Star), R(1), // Dead store.
234 B(LdaSmi8), U8(3), // 233 B(LdaSmi8), U8(3), //
235 B(Add), R(1), // 234 B(Add), R(1), //
236 B(Return) // 235 B(Return) //
237 }, 236 },
238 0 237 0},
239 }}; 238 {"var x = 10; return x << 3;",
239 2 * kPointerSize,
240 1,
241 13,
242 {
243 B(LdaSmi8), U8(10), //
244 B(Star), R(0), //
245 B(Ldar), R(0), // Easy to spot r1 not really needed here.
246 B(Star), R(1), // Dead store.
247 B(LdaSmi8), U8(3), //
248 B(ShiftLeft), R(1), //
249 B(Return) //
250 },
251 0},
252 {"var x = 10; return x >> 3;",
253 2 * kPointerSize,
254 1,
255 13,
256 {
257 B(LdaSmi8), U8(10), //
258 B(Star), R(0), //
259 B(Ldar), R(0), // Easy to spot r1 not really needed here.
260 B(Star), R(1), // Dead store.
261 B(LdaSmi8), U8(3), //
262 B(ShiftRight), R(1), //
263 B(Return) //
264 },
265 0},
266 {"var x = 10; return x >>> 3;",
267 2 * kPointerSize,
268 1,
269 13,
270 {
271 B(LdaSmi8), U8(10), //
272 B(Star), R(0), //
273 B(Ldar), R(0), // Easy to spot r1 not really needed here.
274 B(Star), R(1), // Dead store.
275 B(LdaSmi8), U8(3), //
276 B(ShiftRightLogical), R(1), //
277 B(Return) //
278 },
279 0}};
240 280
241 for (size_t i = 0; i < arraysize(snippets); i++) { 281 for (size_t i = 0; i < arraysize(snippets); i++) {
242 Handle<BytecodeArray> bytecode_array = 282 Handle<BytecodeArray> bytecode_array =
243 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); 283 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
244 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 284 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
245 } 285 }
246 } 286 }
247 287
248 288
249 TEST(Parameters) { 289 TEST(Parameters) {
(...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 Handle<BytecodeArray> bytecode_array = 1487 Handle<BytecodeArray> bytecode_array =
1448 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); 1488 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
1449 CheckBytecodeArrayEqual(snippets[i], bytecode_array); 1489 CheckBytecodeArrayEqual(snippets[i], bytecode_array);
1450 } 1490 }
1451 } 1491 }
1452 1492
1453 1493
1454 } // namespace interpreter 1494 } // namespace interpreter
1455 } // namespace internal 1495 } // namespace internal
1456 } // namespace v8 1496 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698