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 #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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 { | 244 { |
245 B(LdaZero), // | 245 B(LdaZero), // |
246 B(Star), R(0), // | 246 B(Star), R(0), // |
247 B(Ldar), R(0), // Easy to spot r1 not really needed here. | 247 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
248 B(Star), R(1), // Dead store. | 248 B(Star), R(1), // Dead store. |
249 B(LdaSmi8), U8(3), // | 249 B(LdaSmi8), U8(3), // |
250 B(Add), R(1), // | 250 B(Add), R(1), // |
251 B(Return) // | 251 B(Return) // |
252 }, | 252 }, |
253 0}, | 253 0}, |
| 254 {"var x = 0; return x - 3;", |
| 255 2 * kPointerSize, |
| 256 1, |
| 257 12, |
| 258 { |
| 259 B(LdaZero), // |
| 260 B(Star), R(0), // |
| 261 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 262 B(Star), R(1), // Dead store. |
| 263 B(LdaSmi8), U8(3), // |
| 264 B(Sub), R(1), // |
| 265 B(Return) // |
| 266 }, |
| 267 0}, |
| 268 {"var x = 4; return x * 3;", |
| 269 2 * kPointerSize, |
| 270 1, |
| 271 13, |
| 272 { |
| 273 B(LdaSmi8), U8(4), // |
| 274 B(Star), R(0), // |
| 275 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 276 B(Star), R(1), // Dead store. |
| 277 B(LdaSmi8), U8(3), // |
| 278 B(Mul), R(1), // |
| 279 B(Return) // |
| 280 }, |
| 281 0}, |
| 282 {"var x = 4; return x / 3;", |
| 283 2 * kPointerSize, |
| 284 1, |
| 285 13, |
| 286 { |
| 287 B(LdaSmi8), U8(4), // |
| 288 B(Star), R(0), // |
| 289 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 290 B(Star), R(1), // Dead store. |
| 291 B(LdaSmi8), U8(3), // |
| 292 B(Div), R(1), // |
| 293 B(Return) // |
| 294 }, |
| 295 0}, |
| 296 {"var x = 4; return x % 3;", |
| 297 2 * kPointerSize, |
| 298 1, |
| 299 13, |
| 300 { |
| 301 B(LdaSmi8), U8(4), // |
| 302 B(Star), R(0), // |
| 303 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 304 B(Star), R(1), // Dead store. |
| 305 B(LdaSmi8), U8(3), // |
| 306 B(Mod), R(1), // |
| 307 B(Return) // |
| 308 }, |
| 309 0}, |
| 310 {"var x = 1; return x | 2;", |
| 311 2 * kPointerSize, |
| 312 1, |
| 313 13, |
| 314 { |
| 315 B(LdaSmi8), U8(1), // |
| 316 B(Star), R(0), // |
| 317 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 318 B(Star), R(1), // Dead store. |
| 319 B(LdaSmi8), U8(2), // |
| 320 B(BitwiseOr), R(1), // |
| 321 B(Return) // |
| 322 }, |
| 323 0}, |
| 324 {"var x = 1; return x ^ 2;", |
| 325 2 * kPointerSize, |
| 326 1, |
| 327 13, |
| 328 { |
| 329 B(LdaSmi8), U8(1), // |
| 330 B(Star), R(0), // |
| 331 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 332 B(Star), R(1), // Dead store. |
| 333 B(LdaSmi8), U8(2), // |
| 334 B(BitwiseXor), R(1), // |
| 335 B(Return) // |
| 336 }, |
| 337 0}, |
| 338 {"var x = 1; return x & 2;", |
| 339 2 * kPointerSize, |
| 340 1, |
| 341 13, |
| 342 { |
| 343 B(LdaSmi8), U8(1), // |
| 344 B(Star), R(0), // |
| 345 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
| 346 B(Star), R(1), // Dead store. |
| 347 B(LdaSmi8), U8(2), // |
| 348 B(BitwiseAnd), R(1), // |
| 349 B(Return) // |
| 350 }, |
| 351 0}, |
254 {"var x = 10; return x << 3;", | 352 {"var x = 10; return x << 3;", |
255 2 * kPointerSize, | 353 2 * kPointerSize, |
256 1, | 354 1, |
257 13, | 355 13, |
258 { | 356 { |
259 B(LdaSmi8), U8(10), // | 357 B(LdaSmi8), U8(10), // |
260 B(Star), R(0), // | 358 B(Star), R(0), // |
261 B(Ldar), R(0), // Easy to spot r1 not really needed here. | 359 B(Ldar), R(0), // Easy to spot r1 not really needed here. |
262 B(Star), R(1), // Dead store. | 360 B(Star), R(1), // Dead store. |
263 B(LdaSmi8), U8(3), // | 361 B(LdaSmi8), U8(3), // |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1711 Handle<BytecodeArray> bytecode_array = | 1809 Handle<BytecodeArray> bytecode_array = |
1712 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 1810 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
1713 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1811 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
1714 } | 1812 } |
1715 } | 1813 } |
1716 | 1814 |
1717 | 1815 |
1718 } // namespace interpreter | 1816 } // namespace interpreter |
1719 } // namespace internal | 1817 } // namespace internal |
1720 } // namespace v8 | 1818 } // namespace v8 |
OLD | NEW |