| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 ExpectedSnippet<int> snippets[] = { | 286 ExpectedSnippet<int> snippets[] = { |
| 287 {"var x = 0; return x;", | 287 {"var x = 0; return x;", |
| 288 kPointerSize, | 288 kPointerSize, |
| 289 1, | 289 1, |
| 290 4, | 290 4, |
| 291 {B(LdaZero), // | 291 {B(LdaZero), // |
| 292 B(Star), R(0), // | 292 B(Star), R(0), // |
| 293 B(Return)}, | 293 B(Return)}, |
| 294 0}, | 294 0}, |
| 295 {"var x = 0; return x + 3;", | 295 {"var x = 0; return x + 3;", |
| 296 kPointerSize, | 296 2 * kPointerSize, |
| 297 1, | 297 1, |
| 298 8, | 298 10, |
| 299 {B(LdaZero), // | 299 {B(LdaZero), // |
| 300 B(Star), R(0), // | 300 B(Star), R(0), // |
| 301 B(Star), R(1), // |
| 301 B(LdaSmi8), U8(3), // | 302 B(LdaSmi8), U8(3), // |
| 302 B(Add), R(0), // | 303 B(Add), R(1), // |
| 303 B(Return)}, | 304 B(Return)}, |
| 304 0}, | 305 0}, |
| 305 {"var x = 0; return x - 3;", | 306 {"var x = 0; return x - 3;", |
| 306 kPointerSize, | 307 2 * kPointerSize, |
| 307 1, | 308 1, |
| 308 8, | 309 10, |
| 309 {B(LdaZero), // | 310 {B(LdaZero), // |
| 310 B(Star), R(0), // | 311 B(Star), R(0), // |
| 312 B(Star), R(1), // |
| 311 B(LdaSmi8), U8(3), // | 313 B(LdaSmi8), U8(3), // |
| 312 B(Sub), R(0), // | 314 B(Sub), R(1), // |
| 313 B(Return)}, | 315 B(Return)}, |
| 314 0}, | 316 0}, |
| 315 {"var x = 4; return x * 3;", | 317 {"var x = 4; return x * 3;", |
| 316 kPointerSize, | 318 2 * kPointerSize, |
| 317 1, | 319 1, |
| 318 9, | 320 11, |
| 319 {B(LdaSmi8), U8(4), // | 321 {B(LdaSmi8), U8(4), // |
| 320 B(Star), R(0), // | 322 B(Star), R(0), // |
| 323 B(Star), R(1), // |
| 321 B(LdaSmi8), U8(3), // | 324 B(LdaSmi8), U8(3), // |
| 322 B(Mul), R(0), // | 325 B(Mul), R(1), // |
| 323 B(Return)}, | 326 B(Return)}, |
| 324 0}, | 327 0}, |
| 325 {"var x = 4; return x / 3;", | 328 {"var x = 4; return x / 3;", |
| 326 kPointerSize, | 329 2 * kPointerSize, |
| 327 1, | 330 1, |
| 328 9, | 331 11, |
| 329 {B(LdaSmi8), U8(4), // | 332 {B(LdaSmi8), U8(4), // |
| 330 B(Star), R(0), // | 333 B(Star), R(0), // |
| 334 B(Star), R(1), // |
| 331 B(LdaSmi8), U8(3), // | 335 B(LdaSmi8), U8(3), // |
| 332 B(Div), R(0), // | 336 B(Div), R(1), // |
| 333 B(Return)}, | 337 B(Return)}, |
| 334 0}, | 338 0}, |
| 335 {"var x = 4; return x % 3;", | 339 {"var x = 4; return x % 3;", |
| 336 kPointerSize, | 340 2 * kPointerSize, |
| 337 1, | 341 1, |
| 338 9, | 342 11, |
| 339 {B(LdaSmi8), U8(4), // | 343 {B(LdaSmi8), U8(4), // |
| 340 B(Star), R(0), // | 344 B(Star), R(0), // |
| 345 B(Star), R(1), // |
| 341 B(LdaSmi8), U8(3), // | 346 B(LdaSmi8), U8(3), // |
| 342 B(Mod), R(0), // | 347 B(Mod), R(1), // |
| 343 B(Return)}, | 348 B(Return)}, |
| 344 0}, | 349 0}, |
| 345 {"var x = 1; return x | 2;", | 350 {"var x = 1; return x | 2;", |
| 346 kPointerSize, | 351 2 * kPointerSize, |
| 347 1, | 352 1, |
| 348 9, | 353 11, |
| 349 {B(LdaSmi8), U8(1), // | 354 {B(LdaSmi8), U8(1), // |
| 350 B(Star), R(0), // | 355 B(Star), R(0), // |
| 356 B(Star), R(1), // |
| 351 B(LdaSmi8), U8(2), // | 357 B(LdaSmi8), U8(2), // |
| 352 B(BitwiseOr), R(0), // | 358 B(BitwiseOr), R(1), // |
| 353 B(Return)}, | 359 B(Return)}, |
| 354 0}, | 360 0}, |
| 355 {"var x = 1; return x ^ 2;", | 361 {"var x = 1; return x ^ 2;", |
| 356 kPointerSize, | 362 2 * kPointerSize, |
| 357 1, | 363 1, |
| 358 9, | 364 11, |
| 359 {B(LdaSmi8), U8(1), // | 365 {B(LdaSmi8), U8(1), // |
| 360 B(Star), R(0), // | 366 B(Star), R(0), // |
| 367 B(Star), R(1), // |
| 361 B(LdaSmi8), U8(2), // | 368 B(LdaSmi8), U8(2), // |
| 362 B(BitwiseXor), R(0), // | 369 B(BitwiseXor), R(1), // |
| 363 B(Return)}, | 370 B(Return)}, |
| 364 0}, | 371 0}, |
| 365 {"var x = 1; return x & 2;", | 372 {"var x = 1; return x & 2;", |
| 366 kPointerSize, | 373 2 * kPointerSize, |
| 367 1, | 374 1, |
| 368 9, | 375 11, |
| 369 {B(LdaSmi8), U8(1), // | 376 {B(LdaSmi8), U8(1), // |
| 370 B(Star), R(0), // | 377 B(Star), R(0), // |
| 378 B(Star), R(1), // |
| 371 B(LdaSmi8), U8(2), // | 379 B(LdaSmi8), U8(2), // |
| 372 B(BitwiseAnd), R(0), // | 380 B(BitwiseAnd), R(1), // |
| 373 B(Return)}, | 381 B(Return)}, |
| 374 0}, | 382 0}, |
| 375 {"var x = 10; return x << 3;", | 383 {"var x = 10; return x << 3;", |
| 376 kPointerSize, | 384 2 * kPointerSize, |
| 377 1, | 385 1, |
| 378 9, | 386 11, |
| 379 {B(LdaSmi8), U8(10), // | 387 {B(LdaSmi8), U8(10), // |
| 380 B(Star), R(0), // | 388 B(Star), R(0), // |
| 389 B(Star), R(1), // |
| 381 B(LdaSmi8), U8(3), // | 390 B(LdaSmi8), U8(3), // |
| 382 B(ShiftLeft), R(0), // | 391 B(ShiftLeft), R(1), // |
| 383 B(Return)}, | 392 B(Return)}, |
| 384 0}, | 393 0}, |
| 385 {"var x = 10; return x >> 3;", | 394 {"var x = 10; return x >> 3;", |
| 386 kPointerSize, | 395 2 * kPointerSize, |
| 387 1, | 396 1, |
| 388 9, | 397 11, |
| 389 {B(LdaSmi8), U8(10), // | 398 {B(LdaSmi8), U8(10), // |
| 390 B(Star), R(0), // | 399 B(Star), R(0), // |
| 400 B(Star), R(1), // |
| 391 B(LdaSmi8), U8(3), // | 401 B(LdaSmi8), U8(3), // |
| 392 B(ShiftRight), R(0), // | 402 B(ShiftRight), R(1), // |
| 393 B(Return)}, | 403 B(Return)}, |
| 394 0}, | 404 0}, |
| 395 {"var x = 10; return x >>> 3;", | 405 {"var x = 10; return x >>> 3;", |
| 396 kPointerSize, | 406 2 * kPointerSize, |
| 397 1, | 407 1, |
| 398 9, | 408 11, |
| 399 {B(LdaSmi8), U8(10), // | 409 {B(LdaSmi8), U8(10), // |
| 400 B(Star), R(0), // | 410 B(Star), R(0), // |
| 411 B(Star), R(1), // |
| 401 B(LdaSmi8), U8(3), // | 412 B(LdaSmi8), U8(3), // |
| 402 B(ShiftRightLogical), R(0), // | 413 B(ShiftRightLogical), R(1), // |
| 403 B(Return)}, | 414 B(Return)}, |
| 404 0}, | 415 0}, |
| 405 {"var x = 0; return (x, 3);", | 416 {"var x = 0; return (x, 3);", |
| 406 kPointerSize, | 417 1 * kPointerSize, |
| 407 1, | 418 1, |
| 408 6, | 419 6, |
| 409 {B(LdaZero), // | 420 {B(LdaZero), // |
| 410 B(Star), R(0), // | 421 B(Star), R(0), // |
| 411 B(LdaSmi8), U8(3), // | 422 B(LdaSmi8), U8(3), // |
| 412 B(Return)}, | 423 B(Return)}, |
| 413 0}}; | 424 0}}; |
| 414 | 425 |
| 415 for (size_t i = 0; i < arraysize(snippets); i++) { | 426 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 416 Handle<BytecodeArray> bytecode_array = | 427 Handle<BytecodeArray> bytecode_array = |
| (...skipping 12 matching lines...) Expand all Loading... |
| 429 1 * kPointerSize, | 440 1 * kPointerSize, |
| 430 1, | 441 1, |
| 431 8, | 442 8, |
| 432 {B(LdaZero), // | 443 {B(LdaZero), // |
| 433 B(Star), R(0), // | 444 B(Star), R(0), // |
| 434 B(JumpIfToBooleanTrue), U8(4), // | 445 B(JumpIfToBooleanTrue), U8(4), // |
| 435 B(LdaSmi8), U8(3), // | 446 B(LdaSmi8), U8(3), // |
| 436 B(Return)}, | 447 B(Return)}, |
| 437 0}, | 448 0}, |
| 438 {"var x = 0; return (x == 1) || 3;", | 449 {"var x = 0; return (x == 1) || 3;", |
| 439 1 * kPointerSize, | 450 2 * kPointerSize, |
| 440 1, | 451 1, |
| 441 12, | 452 14, |
| 442 {B(LdaZero), // | 453 {B(LdaZero), // |
| 443 B(Star), R(0), // | 454 B(Star), R(0), // |
| 455 B(Star), R(1), // |
| 444 B(LdaSmi8), U8(1), // | 456 B(LdaSmi8), U8(1), // |
| 445 B(TestEqual), R(0), // | 457 B(TestEqual), R(1), // |
| 446 B(JumpIfTrue), U8(4), // | 458 B(JumpIfTrue), U8(4), // |
| 447 B(LdaSmi8), U8(3), // | 459 B(LdaSmi8), U8(3), // |
| 448 B(Return)}, | 460 B(Return)}, |
| 449 0}, | 461 0}, |
| 450 {"var x = 0; return x && 3;", | 462 {"var x = 0; return x && 3;", |
| 451 1 * kPointerSize, | 463 1 * kPointerSize, |
| 452 1, | 464 1, |
| 453 8, | 465 8, |
| 454 {B(LdaZero), // | 466 {B(LdaZero), // |
| 455 B(Star), R(0), // | 467 B(Star), R(0), // |
| 456 B(JumpIfToBooleanFalse), U8(4), // | 468 B(JumpIfToBooleanFalse), U8(4), // |
| 457 B(LdaSmi8), U8(3), // | 469 B(LdaSmi8), U8(3), // |
| 458 B(Return)}, | 470 B(Return)}, |
| 459 0}, | 471 0}, |
| 460 {"var x = 0; return (x == 0) && 3;", | 472 {"var x = 0; return (x == 0) && 3;", |
| 461 1 * kPointerSize, | 473 2 * kPointerSize, |
| 462 1, | 474 1, |
| 463 11, | 475 13, |
| 464 {B(LdaZero), // | 476 {B(LdaZero), // |
| 465 B(Star), R(0), // | 477 B(Star), R(0), // |
| 478 B(Star), R(1), // |
| 466 B(LdaZero), // | 479 B(LdaZero), // |
| 467 B(TestEqual), R(0), // | 480 B(TestEqual), R(1), // |
| 468 B(JumpIfFalse), U8(4), // | 481 B(JumpIfFalse), U8(4), // |
| 469 B(LdaSmi8), U8(3), // | 482 B(LdaSmi8), U8(3), // |
| 470 B(Return)}, | 483 B(Return)}, |
| 471 0}, | 484 0}, |
| 472 {"var x = 0; return x || (1, 2, 3);", | 485 {"var x = 0; return x || (1, 2, 3);", |
| 473 1 * kPointerSize, | 486 1 * kPointerSize, |
| 474 1, | 487 1, |
| 475 8, | 488 8, |
| 476 {B(LdaZero), // | 489 {B(LdaZero), // |
| 477 B(Star), R(0), // | 490 B(Star), R(0), // |
| 478 B(JumpIfToBooleanTrue), U8(4), // | 491 B(JumpIfToBooleanTrue), U8(4), // |
| 479 B(LdaSmi8), U8(3), // | 492 B(LdaSmi8), U8(3), // |
| 480 B(Return)}, | 493 B(Return)}, |
| 481 0}, | 494 0}, |
| 482 {"var a = 2, b = 3, c = 4; return a || (a, b, a, b, c = 5, 3);", | 495 {"var a = 2, b = 3, c = 4; return a || (a, b, a, b, c = 5, 3);", |
| 483 3 * kPointerSize, | 496 3 * kPointerSize, |
| 484 1, | 497 1, |
| 485 23, | 498 31, |
| 486 {B(LdaSmi8), U8(2), // | 499 {B(LdaSmi8), U8(2), // |
| 487 B(Star), R(0), // | 500 B(Star), R(0), // |
| 488 B(LdaSmi8), U8(3), // | 501 B(LdaSmi8), U8(3), // |
| 489 B(Star), R(1), // | 502 B(Star), R(1), // |
| 490 B(LdaSmi8), U8(4), // | 503 B(LdaSmi8), U8(4), // |
| 491 B(Star), R(2), // | 504 B(Star), R(2), // |
| 492 B(Ldar), R(0), // | 505 B(Ldar), R(0), // |
| 493 B(JumpIfToBooleanTrue), U8(8), // | 506 B(JumpIfToBooleanTrue), U8(16), // |
| 494 B(LdaSmi8), U8(5), // | 507 B(Ldar), R(0), // |
| 495 B(Star), R(2), // | 508 B(Ldar), R(1), // |
| 496 B(LdaSmi8), U8(3), // | 509 B(Ldar), R(0), // |
| 510 B(Ldar), R(1), // |
| 511 B(LdaSmi8), U8(5), // |
| 512 B(Star), R(2), // |
| 513 B(LdaSmi8), U8(3), // |
| 497 B(Return)}, | 514 B(Return)}, |
| 498 0}, | 515 0}, |
| 499 {"var x = 1; var a = 2, b = 3; return x || (" | 516 {"var x = 1; var a = 2, b = 3; return x || (" |
| 500 REPEAT_32(SPACE, "a = 1, b = 2, ") | 517 REPEAT_32(SPACE, "a = 1, b = 2, ") |
| 501 "3);", | 518 "3);", |
| 502 3 * kPointerSize, | 519 3 * kPointerSize, |
| 503 1, | 520 1, |
| 504 275, | 521 275, |
| 505 {B(LdaSmi8), U8(1), // | 522 {B(LdaSmi8), U8(1), // |
| 506 B(Star), R(0), // | 523 B(Star), R(0), // |
| 507 B(LdaSmi8), U8(2), // | 524 B(LdaSmi8), U8(2), // |
| 508 B(Star), R(1), // | 525 B(Star), R(1), // |
| 509 B(LdaSmi8), U8(3), // | 526 B(LdaSmi8), U8(3), // |
| 510 B(Star), R(2), // | 527 B(Star), R(2), // |
| 511 B(Ldar), R(0), // | 528 B(Ldar), R(0), // |
| 512 B(JumpIfToBooleanTrueConstant), U8(0), // | 529 B(JumpIfToBooleanTrueConstant), U8(0), // |
| 513 REPEAT_32(COMMA, // | 530 REPEAT_32(COMMA, // |
| 514 B(LdaSmi8), U8(1), // | 531 B(LdaSmi8), U8(1), // |
| 515 B(Star), R(1), // | 532 B(Star), R(1), // |
| 516 B(LdaSmi8), U8(2), // | 533 B(LdaSmi8), U8(2), // |
| 517 B(Star), R(2)), // | 534 B(Star), R(2)), // |
| 518 B(LdaSmi8), U8(3), // | 535 B(LdaSmi8), U8(3), // |
| 519 B(Return)}, | 536 B(Return)}, |
| 520 1, | 537 1, |
| 521 {260, 0, 0, 0}}, | 538 {260, 0, 0, 0}}, |
| 522 {"var x = 0; var a = 2, b = 3; return x && (" | 539 {"var x = 0; var a = 2, b = 3; return x && (" |
| 523 REPEAT_32(SPACE, "a = 1, b = 2, ") | 540 REPEAT_32(SPACE, "a = 1, b = 2, ") |
| 524 "3);", | 541 "3);", |
| 525 3 * kPointerSize, | 542 3 * kPointerSize, |
| 526 1, | 543 1, |
| 527 274, | 544 274, |
| 528 {B(LdaZero), // | 545 {B(LdaZero), // |
| 529 B(Star), R(0), // | 546 B(Star), R(0), // |
| 530 B(LdaSmi8), U8(2), // | 547 B(LdaSmi8), U8(2), // |
| 531 B(Star), R(1), // | 548 B(Star), R(1), // |
| 532 B(LdaSmi8), U8(3), // | 549 B(LdaSmi8), U8(3), // |
| 533 B(Star), R(2), // | 550 B(Star), R(2), // |
| 534 B(Ldar), R(0), // | 551 B(Ldar), R(0), // |
| 535 B(JumpIfToBooleanFalseConstant), U8(0), // | 552 B(JumpIfToBooleanFalseConstant), U8(0), // |
| 536 REPEAT_32(COMMA, // | 553 REPEAT_32(COMMA, // |
| 537 B(LdaSmi8), U8(1), // | 554 B(LdaSmi8), U8(1), // |
| 538 B(Star), R(1), // | 555 B(Star), R(1), // |
| 539 B(LdaSmi8), U8(2), // | 556 B(LdaSmi8), U8(2), // |
| 540 B(Star), R(2)), // | 557 B(Star), R(2)), // |
| 541 B(LdaSmi8), U8(3), // | 558 B(LdaSmi8), U8(3), // |
| 542 B(Return)}, // | 559 B(Return)}, // |
| 543 1, | 560 1, |
| 544 {260, 0, 0, 0}}, | 561 {260, 0, 0, 0}}, |
| 545 {"var x = 1; var a = 2, b = 3; return (x > 3) || (" | 562 {"var x = 1; var a = 2, b = 3; return (x > 3) || (" |
| 546 REPEAT_32(SPACE, "a = 1, b = 2, ") | 563 REPEAT_32(SPACE, "a = 1, b = 2, ") |
| 547 "3);", | 564 "3);", |
| 548 3 * kPointerSize, | 565 4 * kPointerSize, |
| 549 1, | 566 1, |
| 550 277, | 567 281, |
| 551 {B(LdaSmi8), U8(1), // | 568 {B(LdaSmi8), U8(1), // |
| 552 B(Star), R(0), // | 569 B(Star), R(0), // |
| 553 B(LdaSmi8), U8(2), // | 570 B(LdaSmi8), U8(2), // |
| 554 B(Star), R(1), // | 571 B(Star), R(1), // |
| 555 B(LdaSmi8), U8(3), // | 572 B(LdaSmi8), U8(3), // |
| 556 B(Star), R(2), // | 573 B(Star), R(2), // |
| 574 B(Ldar), R(0), // |
| 575 B(Star), R(3), // |
| 557 B(LdaSmi8), U8(3), // | 576 B(LdaSmi8), U8(3), // |
| 558 B(TestGreaterThan), R(0), // | 577 B(TestGreaterThan), R(3), // |
| 559 B(JumpIfTrueConstant), U8(0), // | 578 B(JumpIfTrueConstant), U8(0), // |
| 560 REPEAT_32(COMMA, // | 579 REPEAT_32(COMMA, // |
| 561 B(LdaSmi8), U8(1), // | 580 B(LdaSmi8), U8(1), // |
| 562 B(Star), R(1), // | 581 B(Star), R(1), // |
| 563 B(LdaSmi8), U8(2), // | 582 B(LdaSmi8), U8(2), // |
| 564 B(Star), R(2)), // | 583 B(Star), R(2)), // |
| 565 B(LdaSmi8), U8(3), // | 584 B(LdaSmi8), U8(3), // |
| 566 B(Return)}, | 585 B(Return)}, |
| 567 1, | 586 1, |
| 568 {260, 0, 0, 0}}, | 587 {260, 0, 0, 0}}, |
| 569 {"var x = 0; var a = 2, b = 3; return (x < 5) && (" | 588 {"var x = 0; var a = 2, b = 3; return (x < 5) && (" |
| 570 REPEAT_32(SPACE, "a = 1, b = 2, ") | 589 REPEAT_32(SPACE, "a = 1, b = 2, ") |
| 571 "3);", | 590 "3);", |
| 572 3 * kPointerSize, | 591 4 * kPointerSize, |
| 573 1, | 592 1, |
| 574 276, | 593 280, |
| 575 {B(LdaZero), // | 594 {B(LdaZero), // |
| 576 B(Star), R(0), // | 595 B(Star), R(0), // |
| 577 B(LdaSmi8), U8(2), // | 596 B(LdaSmi8), U8(2), // |
| 578 B(Star), R(1), // | 597 B(Star), R(1), // |
| 579 B(LdaSmi8), U8(3), // | 598 B(LdaSmi8), U8(3), // |
| 580 B(Star), R(2), // | 599 B(Star), R(2), // |
| 600 B(Ldar), R(0), // |
| 601 B(Star), R(3), // |
| 581 B(LdaSmi8), U8(5), // | 602 B(LdaSmi8), U8(5), // |
| 582 B(TestLessThan), R(0), // | 603 B(TestLessThan), R(3), // |
| 583 B(JumpIfFalseConstant), U8(0), // | 604 B(JumpIfFalseConstant), U8(0), // |
| 584 REPEAT_32(COMMA, // | 605 REPEAT_32(COMMA, // |
| 585 B(LdaSmi8), U8(1), // | 606 B(LdaSmi8), U8(1), // |
| 586 B(Star), R(1), // | 607 B(Star), R(1), // |
| 587 B(LdaSmi8), U8(2), // | 608 B(LdaSmi8), U8(2), // |
| 588 B(Star), R(2)), // | 609 B(Star), R(2)), // |
| 589 B(LdaSmi8), U8(3), // | 610 B(LdaSmi8), U8(3), // |
| 590 B(Return)}, | 611 B(Return)}, |
| 591 1, | 612 1, |
| 592 {260, 0, 0, 0}}, | 613 {260, 0, 0, 0}}, |
| 593 {"return 0 && 3;", | 614 {"return 0 && 3;", |
| 594 0 * kPointerSize, | 615 0 * kPointerSize, |
| 595 1, | 616 1, |
| 596 2, | 617 2, |
| 597 {B(LdaZero), // | 618 {B(LdaZero), // |
| 598 B(Return)}, | 619 B(Return)}, |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | 887 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); |
| 867 | 888 |
| 868 // These are a hack used by the LoadICXXXWide tests below. | 889 // These are a hack used by the LoadICXXXWide tests below. |
| 869 int wide_idx_1 = vector->GetIndex(slot1) - 2; | 890 int wide_idx_1 = vector->GetIndex(slot1) - 2; |
| 870 int wide_idx_2 = vector->GetIndex(slot1) - 2; | 891 int wide_idx_2 = vector->GetIndex(slot1) - 2; |
| 871 int wide_idx_3 = vector->GetIndex(slot1) - 2; | 892 int wide_idx_3 = vector->GetIndex(slot1) - 2; |
| 872 int wide_idx_4 = vector->GetIndex(slot1) - 2; | 893 int wide_idx_4 = vector->GetIndex(slot1) - 2; |
| 873 | 894 |
| 874 ExpectedSnippet<const char*> snippets[] = { | 895 ExpectedSnippet<const char*> snippets[] = { |
| 875 {"function f(a) { return a.name; }\nf({name : \"test\"})", | 896 {"function f(a) { return a.name; }\nf({name : \"test\"})", |
| 876 0, | 897 1 * kPointerSize, |
| 877 2, | 898 2, |
| 878 5, | 899 9, |
| 879 { | 900 { |
| 880 B(LoadICSloppy), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), // | 901 B(Ldar), A(1, 2), // |
| 881 B(Return), // | 902 B(Star), R(0), // |
| 903 B(LoadICSloppy), R(0), U8(0), U8(vector->GetIndex(slot1)), // |
| 904 B(Return), // |
| 882 }, | 905 }, |
| 883 1, | 906 1, |
| 884 {"name"}}, | 907 {"name"}}, |
| 885 {"function f(a) { return a[\"key\"]; }\nf({key : \"test\"})", | 908 {"function f(a) { return a[\"key\"]; }\nf({key : \"test\"})", |
| 886 0, | 909 1 * kPointerSize, |
| 887 2, | 910 2, |
| 888 5, | 911 9, |
| 889 { | 912 { |
| 890 B(LoadICSloppy), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), // | 913 B(Ldar), A(1, 2), // |
| 891 B(Return) // | 914 B(Star), R(0), // |
| 915 B(LoadICSloppy), R(0), U8(0), U8(vector->GetIndex(slot1)), // |
| 916 B(Return) // |
| 892 }, | 917 }, |
| 893 1, | 918 1, |
| 894 {"key"}}, | 919 {"key"}}, |
| 895 {"function f(a) { return a[100]; }\nf({100 : \"test\"})", | 920 {"function f(a) { return a[100]; }\nf({100 : \"test\"})", |
| 896 0, | 921 1 * kPointerSize, |
| 897 2, | 922 2, |
| 898 6, | 923 10, |
| 899 { | 924 { |
| 900 B(LdaSmi8), U8(100), // | 925 B(Ldar), A(1, 2), // |
| 901 B(KeyedLoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), // | 926 B(Star), R(0), // |
| 902 B(Return) // | 927 B(LdaSmi8), U8(100), // |
| 928 B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot1)), // |
| 929 B(Return) // |
| 903 }, | 930 }, |
| 904 0}, | 931 0}, |
| 905 {"function f(a, b) { return a[b]; }\nf({arg : \"test\"}, \"arg\")", | 932 {"function f(a, b) { return a[b]; }\nf({arg : \"test\"}, \"arg\")", |
| 906 0, | 933 1 * kPointerSize, |
| 907 3, | 934 3, |
| 908 6, | 935 10, |
| 909 { | 936 { |
| 910 B(Ldar), A(1, 2), // | 937 B(Ldar), A(1, 3), // |
| 911 B(KeyedLoadICSloppy), A(1, 3), U8(vector->GetIndex(slot1)), // | 938 B(Star), R(0), // |
| 912 B(Return) // | 939 B(Ldar), A(1, 2), // |
| 940 B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot1)), // |
| 941 B(Return) // |
| 913 }, | 942 }, |
| 914 0}, | 943 0}, |
| 915 {"function f(a) { var b = a.name; return a[-124]; }\n" | 944 {"function f(a) { var b = a.name; return a[-124]; }\n" |
| 916 "f({\"-124\" : \"test\", name : 123 })", | 945 "f({\"-124\" : \"test\", name : 123 })", |
| 917 kPointerSize, | 946 2 * kPointerSize, |
| 918 2, | 947 2, |
| 919 12, | 948 20, |
| 920 { | 949 { |
| 921 B(LoadICSloppy), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), // | 950 B(Ldar), A(1, 2), // |
| 922 B(Star), R(0), // | 951 B(Star), R(1), // |
| 923 B(LdaSmi8), U8(-124), // | 952 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot1)), // |
| 924 B(KeyedLoadICSloppy), A(1, 2), U8(vector->GetIndex(slot2)), // | 953 B(Star), R(0), // |
| 925 B(Return), // | 954 B(Ldar), A(1, 2), // |
| 955 B(Star), R(1), // |
| 956 B(LdaSmi8), U8(-124), // |
| 957 B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot2)), // |
| 958 B(Return), // |
| 926 }, | 959 }, |
| 927 1, | 960 1, |
| 928 {"name"}}, | 961 {"name"}}, |
| 929 {"function f(a) { \"use strict\"; return a.name; }\nf({name : \"test\"})", | 962 {"function f(a) { \"use strict\"; return a.name; }\nf({name : \"test\"})", |
| 930 0, | 963 1 * kPointerSize, |
| 931 2, | 964 2, |
| 932 5, | 965 9, |
| 933 { | 966 { |
| 934 B(LoadICStrict), A(1, 2), U8(0), U8(vector->GetIndex(slot1)), // | 967 B(Ldar), A(1, 2), // |
| 935 B(Return), // | 968 B(Star), R(0), // |
| 969 B(LoadICStrict), R(0), U8(0), U8(vector->GetIndex(slot1)), // |
| 970 B(Return), // |
| 936 }, | 971 }, |
| 937 1, | 972 1, |
| 938 {"name"}}, | 973 {"name"}}, |
| 939 {"function f(a, b) { \"use strict\"; return a[b]; }\n" | 974 {"function f(a, b) { \"use strict\"; return a[b]; }\n" |
| 940 "f({arg : \"test\"}, \"arg\")", | 975 "f({arg : \"test\"}, \"arg\")", |
| 941 0, | 976 1 * kPointerSize, |
| 942 3, | 977 3, |
| 943 6, | 978 10, |
| 944 { | 979 { |
| 945 B(Ldar), A(2, 3), // | 980 B(Ldar), A(1, 3), // |
| 946 B(KeyedLoadICStrict), A(1, 3), U8(vector->GetIndex(slot1)), // | 981 B(Star), R(0), // |
| 947 B(Return), // | 982 B(Ldar), A(2, 3), // |
| 983 B(KeyedLoadICStrict), R(0), U8(vector->GetIndex(slot1)), // |
| 984 B(Return), // |
| 948 }, | 985 }, |
| 949 0}, | 986 0}, |
| 950 {"function f(a) {\n" | 987 {"function f(a) {\n" |
| 951 " var b;\n" | 988 " var b;\n" |
| 952 "b = a.name;" | 989 "b = a.name;" |
| 953 REPEAT_127(SPACE, " b = a.name; ") | 990 REPEAT_127(SPACE, " b = a.name; ") |
| 954 " return a.name; }\n" | 991 " return a.name; }\n" |
| 955 "f({name : \"test\"})\n", | 992 "f({name : \"test\"})\n", |
| 956 1 * kPointerSize, | 993 2 * kPointerSize, |
| 957 2, | 994 2, |
| 958 775, | 995 1291, |
| 959 { | 996 { |
| 960 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2), // | 997 B(Ldar), A(1, 2), // |
| 961 B(Star), R(0), // | 998 B(Star), R(1), // |
| 962 REPEAT_127(COMMA, // | 999 B(LoadICSloppy), R(1), U8(0), U8(wide_idx_1 += 2), // |
| 963 B(LoadICSloppy), A(1, 2), U8(0), // | 1000 B(Star), R(0), // |
| 964 U8((wide_idx_1 += 2)), // | 1001 REPEAT_127(COMMA, // |
| 965 B(Star), R(0)), // | 1002 B(Ldar), A(1, 2), // |
| 966 B(LoadICSloppyWide), A(1, 2), U16(0), U16(wide_idx_1 + 2), // | 1003 B(Star), R(1), // |
| 967 B(Return), // | 1004 B(LoadICSloppy), R(1), U8(0), // |
| 1005 U8((wide_idx_1 += 2)), // |
| 1006 B(Star), R(0)), // |
| 1007 B(Ldar), A(1, 2), // |
| 1008 B(Star), R(1), // |
| 1009 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx_1 + 2), // |
| 1010 B(Return), // |
| 968 }, | 1011 }, |
| 969 1, | 1012 1, |
| 970 {"name"}}, | 1013 {"name"}}, |
| 971 {"function f(a) {\n" | 1014 {"function f(a) {\n" |
| 972 " 'use strict'; var b;\n" | 1015 " 'use strict'; var b;\n" |
| 973 " b = a.name;\n" | 1016 " b = a.name;\n" |
| 974 REPEAT_127(SPACE, " b = a.name; ") | 1017 REPEAT_127(SPACE, " b = a.name; ") |
| 975 " return a.name; }\n" | 1018 " return a.name; }\n" |
| 976 "f({name : \"test\"})\n", | 1019 "f({name : \"test\"})\n", |
| 977 1 * kPointerSize, | 1020 2 * kPointerSize, |
| 978 2, | 1021 2, |
| 979 775, | 1022 1291, |
| 980 { | 1023 { |
| 981 B(LoadICStrict), A(1, 2), U8(0), U8((wide_idx_2 += 2)), // | 1024 B(Ldar), A(1, 2), // |
| 982 B(Star), R(0), // | 1025 B(Star), R(1), // |
| 983 REPEAT_127(COMMA, // | 1026 B(LoadICStrict), R(1), U8(0), U8((wide_idx_2 += 2)), // |
| 984 B(LoadICStrict), A(1, 2), U8(0), // | 1027 B(Star), R(0), // |
| 985 U8((wide_idx_2 += 2)), // | 1028 REPEAT_127(COMMA, // |
| 986 B(Star), R(0)), // | 1029 B(Ldar), A(1, 2), // |
| 987 B(LoadICStrictWide), A(1, 2), U16(0), U16(wide_idx_2 + 2), // | 1030 B(Star), R(1), // |
| 988 B(Return), // | 1031 B(LoadICStrict), R(1), U8(0), // |
| 1032 U8((wide_idx_2 += 2)), // |
| 1033 B(Star), R(0)), // |
| 1034 B(Ldar), A(1, 2), // |
| 1035 B(Star), R(1), // |
| 1036 B(LoadICStrictWide), R(1), U16(0), U16(wide_idx_2 + 2), // |
| 1037 B(Return), // |
| 989 }, | 1038 }, |
| 990 1, | 1039 1, |
| 991 {"name"}}, | 1040 {"name"}}, |
| 992 {"function f(a, b) {\n" | 1041 {"function f(a, b) {\n" |
| 993 " var c;\n" | 1042 " var c;\n" |
| 994 " c = a[b];" | 1043 " c = a[b];" |
| 995 REPEAT_127(SPACE, " c = a[b]; ") | 1044 REPEAT_127(SPACE, " c = a[b]; ") |
| 996 " return a[b]; }\n" | 1045 " return a[b]; }\n" |
| 997 "f({name : \"test\"}, \"name\")\n", | 1046 "f({name : \"test\"}, \"name\")\n", |
| 998 1 * kPointerSize, | 1047 2 * kPointerSize, |
| 999 3, | 1048 3, |
| 1000 903, | 1049 1419, |
| 1001 { | 1050 { |
| 1002 B(Ldar), A(2, 3), // | 1051 B(Ldar), A(1, 3), // |
| 1003 B(KeyedLoadICSloppy), A(1, 3), U8((wide_idx_3 += 2)), // | 1052 B(Star), R(1), // |
| 1004 B(Star), R(0), // | 1053 B(Ldar), A(2, 3), // |
| 1005 REPEAT_127(COMMA, // | 1054 B(KeyedLoadICSloppy), R(1), U8((wide_idx_3 += 2)), // |
| 1006 B(Ldar), A(2, 3), // | 1055 B(Star), R(0), // |
| 1007 B(KeyedLoadICSloppy), A(1, 3), U8((wide_idx_3 += 2)), // | 1056 REPEAT_127(COMMA, // |
| 1008 B(Star), R(0)), // | 1057 B(Ldar), A(1, 3), // |
| 1009 B(Ldar), A(2, 3), // | 1058 B(Star), R(1), // |
| 1010 B(KeyedLoadICSloppyWide), A(1, 3), U16(wide_idx_3 + 2), // | 1059 B(Ldar), A(2, 3), // |
| 1011 B(Return), // | 1060 B(KeyedLoadICSloppy), R(1), U8((wide_idx_3 += 2)), // |
| 1061 B(Star), R(0)), // |
| 1062 B(Ldar), A(1, 3), // |
| 1063 B(Star), R(1), // |
| 1064 B(Ldar), A(2, 3), // |
| 1065 B(KeyedLoadICSloppyWide), R(1), U16(wide_idx_3 + 2), // |
| 1066 B(Return), // |
| 1012 }}, | 1067 }}, |
| 1013 {"function f(a, b) {\n" | 1068 {"function f(a, b) {\n" |
| 1014 " 'use strict'; var c;\n" | 1069 " 'use strict'; var c;\n" |
| 1015 " c = a[b];" | 1070 " c = a[b];" |
| 1016 REPEAT_127(SPACE, " c = a[b]; ") | 1071 REPEAT_127(SPACE, " c = a[b]; ") |
| 1017 " return a[b]; }\n" | 1072 " return a[b]; }\n" |
| 1018 "f({name : \"test\"}, \"name\")\n", | 1073 "f({name : \"test\"}, \"name\")\n", |
| 1019 1 * kPointerSize, | 1074 2 * kPointerSize, |
| 1020 3, | 1075 3, |
| 1021 903, | 1076 1419, |
| 1022 { | 1077 { |
| 1023 B(Ldar), A(2, 3), // | 1078 B(Ldar), A(1, 3), // |
| 1024 B(KeyedLoadICStrict), A(1, 3), U8((wide_idx_4 += 2)), // | 1079 B(Star), R(1), // |
| 1025 B(Star), R(0), // | 1080 B(Ldar), A(2, 3), // |
| 1026 REPEAT_127(COMMA, // | 1081 B(KeyedLoadICStrict), R(1), U8((wide_idx_4 += 2)), // |
| 1027 B(Ldar), A(2, 3), // | 1082 B(Star), R(0), // |
| 1028 B(KeyedLoadICStrict), A(1, 3), U8((wide_idx_4 += 2)), // | 1083 REPEAT_127(COMMA, // |
| 1029 B(Star), R(0)), // | 1084 B(Ldar), A(1, 3), // |
| 1030 B(Ldar), A(2, 3), // | 1085 B(Star), R(1), // |
| 1031 B(KeyedLoadICStrictWide), A(1, 3), U16(wide_idx_4 + 2), // | 1086 B(Ldar), A(2, 3), // |
| 1032 B(Return), // | 1087 B(KeyedLoadICStrict), R(1), U8((wide_idx_4 += 2)), // |
| 1088 B(Star), R(0)), // |
| 1089 B(Ldar), A(1, 3), // |
| 1090 B(Star), R(1), // |
| 1091 B(Ldar), A(2, 3), // |
| 1092 B(KeyedLoadICStrictWide), R(1), U16(wide_idx_4 + 2), // |
| 1093 B(Return), // |
| 1033 }}, | 1094 }}, |
| 1034 }; | 1095 }; |
| 1035 for (size_t i = 0; i < arraysize(snippets); i++) { | 1096 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 1036 Handle<BytecodeArray> bytecode_array = | 1097 Handle<BytecodeArray> bytecode_array = |
| 1037 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 1098 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 1038 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1099 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 1039 } | 1100 } |
| 1040 } | 1101 } |
| 1041 | 1102 |
| 1042 | 1103 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1053 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | 1114 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); |
| 1054 | 1115 |
| 1055 // These are a hack used by the StoreICXXXWide tests below. | 1116 // These are a hack used by the StoreICXXXWide tests below. |
| 1056 int wide_idx_1 = vector->GetIndex(slot1) - 2; | 1117 int wide_idx_1 = vector->GetIndex(slot1) - 2; |
| 1057 int wide_idx_2 = vector->GetIndex(slot1) - 2; | 1118 int wide_idx_2 = vector->GetIndex(slot1) - 2; |
| 1058 int wide_idx_3 = vector->GetIndex(slot1) - 2; | 1119 int wide_idx_3 = vector->GetIndex(slot1) - 2; |
| 1059 int wide_idx_4 = vector->GetIndex(slot1) - 2; | 1120 int wide_idx_4 = vector->GetIndex(slot1) - 2; |
| 1060 | 1121 |
| 1061 ExpectedSnippet<const char*> snippets[] = { | 1122 ExpectedSnippet<const char*> snippets[] = { |
| 1062 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", | 1123 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", |
| 1063 0, | 1124 kPointerSize, |
| 1064 2, | 1125 2, |
| 1065 8, | 1126 12, |
| 1066 { | 1127 { |
| 1067 B(LdaConstant), U8(0), // | 1128 B(Ldar), A(1, 2), // |
| 1068 B(StoreICSloppy), A(1, 2), U8(1), U8(vector->GetIndex(slot1)), // | 1129 B(Star), R(0), // |
| 1069 B(LdaUndefined), // | 1130 B(LdaConstant), U8(0), // |
| 1070 B(Return), // | 1131 B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), // |
| 1132 B(LdaUndefined), // |
| 1133 B(Return), // |
| 1071 }, | 1134 }, |
| 1072 2, | 1135 2, |
| 1073 {"val", "name"}}, | 1136 {"val", "name"}}, |
| 1074 {"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})", | 1137 {"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})", |
| 1075 0, | 1138 kPointerSize, |
| 1076 2, | 1139 2, |
| 1077 8, | 1140 12, |
| 1078 { | 1141 { |
| 1079 B(LdaConstant), U8(0), // | 1142 B(Ldar), A(1, 2), // |
| 1080 B(StoreICSloppy), A(1, 2), U8(1), U8(vector->GetIndex(slot1)), // | 1143 B(Star), R(0), // |
| 1081 B(LdaUndefined), // | 1144 B(LdaConstant), U8(0), // |
| 1082 B(Return), // | 1145 B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), // |
| 1146 B(LdaUndefined), // |
| 1147 B(Return), // |
| 1083 }, | 1148 }, |
| 1084 2, | 1149 2, |
| 1085 {"val", "key"}}, | 1150 {"val", "key"}}, |
| 1086 {"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})", | 1151 {"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})", |
| 1087 kPointerSize, | 1152 2 * kPointerSize, |
| 1088 2, | 1153 2, |
| 1089 12, | 1154 16, |
| 1090 { | 1155 { |
| 1091 B(LdaSmi8), U8(100), // | 1156 B(Ldar), A(1, 2), // |
| 1092 B(Star), R(0), // | 1157 B(Star), R(0), // |
| 1093 B(LdaConstant), U8(0), // | 1158 B(LdaSmi8), U8(100), // |
| 1094 B(KeyedStoreICSloppy), A(1, 2), R(0), // | 1159 B(Star), R(1), // |
| 1095 U8(vector->GetIndex(slot1)), // | 1160 B(LdaConstant), U8(0), // |
| 1096 B(LdaUndefined), // | 1161 B(KeyedStoreICSloppy), R(0), R(1), // |
| 1097 B(Return), // | 1162 U8(vector->GetIndex(slot1)), // |
| 1163 B(LdaUndefined), // |
| 1164 B(Return), // |
| 1098 }, | 1165 }, |
| 1099 1, | 1166 1, |
| 1100 {"val"}}, | 1167 {"val"}}, |
| 1101 {"function f(a, b) { a[b] = \"val\"; }\nf({arg : \"test\"}, \"arg\")", | 1168 {"function f(a, b) { a[b] = \"val\"; }\nf({arg : \"test\"}, \"arg\")", |
| 1102 0, | 1169 2 * kPointerSize, |
| 1103 3, | 1170 3, |
| 1104 8, | 1171 16, |
| 1105 { | 1172 { |
| 1106 B(LdaConstant), U8(0), // | 1173 B(Ldar), A(1, 3), // |
| 1107 B(KeyedStoreICSloppy), A(1, 3), A(2, 3), // | 1174 B(Star), R(0), // |
| 1108 U8(vector->GetIndex(slot1)), // | 1175 B(Ldar), A(2, 3), // |
| 1109 B(LdaUndefined), // | 1176 B(Star), R(1), // |
| 1110 B(Return), // | 1177 B(LdaConstant), U8(0), // |
| 1178 B(KeyedStoreICSloppy), R(0), R(1), // |
| 1179 U8(vector->GetIndex(slot1)), // |
| 1180 B(LdaUndefined), // |
| 1181 B(Return), // |
| 1111 }, | 1182 }, |
| 1112 1, | 1183 1, |
| 1113 {"val"}}, | 1184 {"val"}}, |
| 1114 {"function f(a) { a.name = a[-124]; }\n" | 1185 {"function f(a) { a.name = a[-124]; }\n" |
| 1115 "f({\"-124\" : \"test\", name : 123 })", | 1186 "f({\"-124\" : \"test\", name : 123 })", |
| 1116 0, | 1187 2 * kPointerSize, |
| 1117 2, | 1188 2, |
| 1118 11, | 1189 19, |
| 1119 { | 1190 { |
| 1120 B(LdaSmi8), U8(-124), // | 1191 B(Ldar), A(1, 2), // |
| 1121 B(KeyedLoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), // | 1192 B(Star), R(0), // |
| 1122 B(StoreICSloppy), A(1, 2), U8(0), U8(vector->GetIndex(slot2)), // | 1193 B(Ldar), A(1, 2), // |
| 1123 B(LdaUndefined), // | 1194 B(Star), R(1), // |
| 1124 B(Return), // | 1195 B(LdaSmi8), U8(-124), // |
| 1196 B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot1)), // |
| 1197 B(StoreICSloppy), R(0), U8(0), U8(vector->GetIndex(slot2)), // |
| 1198 B(LdaUndefined), // |
| 1199 B(Return), // |
| 1125 }, | 1200 }, |
| 1126 1, | 1201 1, |
| 1127 {"name"}}, | 1202 {"name"}}, |
| 1128 {"function f(a) { \"use strict\"; a.name = \"val\"; }\n" | 1203 {"function f(a) { \"use strict\"; a.name = \"val\"; }\n" |
| 1129 "f({name : \"test\"})", | 1204 "f({name : \"test\"})", |
| 1130 0, | 1205 kPointerSize, |
| 1131 2, | 1206 2, |
| 1132 8, | 1207 12, |
| 1133 { | 1208 { |
| 1134 B(LdaConstant), U8(0), // | 1209 B(Ldar), A(1, 2), // |
| 1135 B(StoreICStrict), A(1, 2), U8(1), U8(vector->GetIndex(slot1)), // | 1210 B(Star), R(0), // |
| 1136 B(LdaUndefined), // | 1211 B(LdaConstant), U8(0), // |
| 1137 B(Return), // | 1212 B(StoreICStrict), R(0), U8(1), U8(vector->GetIndex(slot1)), // |
| 1213 B(LdaUndefined), // |
| 1214 B(Return), // |
| 1138 }, | 1215 }, |
| 1139 2, | 1216 2, |
| 1140 {"val", "name"}}, | 1217 {"val", "name"}}, |
| 1141 {"function f(a, b) { \"use strict\"; a[b] = \"val\"; }\n" | 1218 {"function f(a, b) { \"use strict\"; a[b] = \"val\"; }\n" |
| 1142 "f({arg : \"test\"}, \"arg\")", | 1219 "f({arg : \"test\"}, \"arg\")", |
| 1143 0, | 1220 2 * kPointerSize, |
| 1144 3, | 1221 3, |
| 1145 8, | 1222 16, |
| 1146 { | 1223 { |
| 1147 B(LdaConstant), U8(0), // | 1224 B(Ldar), A(1, 3), // |
| 1148 B(KeyedStoreICStrict), A(1, 3), A(2, 3), // | 1225 B(Star), R(0), // |
| 1149 U8(vector->GetIndex(slot1)), // | 1226 B(Ldar), A(2, 3), // |
| 1150 B(LdaUndefined), // | 1227 B(Star), R(1), // |
| 1151 B(Return), // | 1228 B(LdaConstant), U8(0), // |
| 1229 B(KeyedStoreICStrict), R(0), R(1), U8(vector->GetIndex(slot1)), // |
| 1230 B(LdaUndefined), // |
| 1231 B(Return), // |
| 1152 }, | 1232 }, |
| 1153 1, | 1233 1, |
| 1154 {"val"}}, | 1234 {"val"}}, |
| 1155 {"function f(a) {\n" | 1235 {"function f(a) {\n" |
| 1156 "a.name = 1;" | 1236 "a.name = 1;" |
| 1157 REPEAT_127(SPACE, " a.name = 1; ") | 1237 REPEAT_127(SPACE, " a.name = 1; ") |
| 1158 " a.name = 2; }\n" | 1238 " a.name = 2; }\n" |
| 1159 "f({name : \"test\"})\n", | 1239 "f({name : \"test\"})\n", |
| 1160 0, | 1240 kPointerSize, |
| 1161 2, | 1241 2, |
| 1162 778, | 1242 1294, |
| 1163 { | 1243 { |
| 1164 B(LdaSmi8), U8(1), // | 1244 B(Ldar), A(1, 2), // |
| 1165 B(StoreICSloppy), A(1, 2), U8(0), U8((wide_idx_1 += 2)), // | 1245 B(Star), R(0), // |
| 1166 REPEAT_127(COMMA, // | 1246 B(LdaSmi8), U8(1), // |
| 1167 B(LdaSmi8), U8(1), // | 1247 B(StoreICSloppy), R(0), U8(0), U8((wide_idx_1 += 2)), // |
| 1168 B(StoreICSloppy), A(1, 2), U8(0), // | 1248 REPEAT_127(COMMA, // |
| 1169 U8((wide_idx_1 += 2))), // | 1249 B(Ldar), A(1, 2), // |
| 1170 B(LdaSmi8), U8(2), // | 1250 B(Star), R(0), // |
| 1171 B(StoreICSloppyWide), A(1, 2), U16(0), U16(wide_idx_1 + 2), // | 1251 B(LdaSmi8), U8(1), // |
| 1172 B(LdaUndefined), // | 1252 B(StoreICSloppy), R(0), U8(0), // |
| 1173 B(Return), // | 1253 U8((wide_idx_1 += 2))), // |
| 1254 B(Ldar), A(1, 2), // |
| 1255 B(Star), R(0), // |
| 1256 B(LdaSmi8), U8(2), // |
| 1257 B(StoreICSloppyWide), R(0), U16(0), U16(wide_idx_1 + 2), // |
| 1258 B(LdaUndefined), // |
| 1259 B(Return), // |
| 1174 }, | 1260 }, |
| 1175 1, | 1261 1, |
| 1176 {"name"}}, | 1262 {"name"}}, |
| 1177 {"function f(a) {\n" | 1263 {"function f(a) {\n" |
| 1178 " 'use strict';\n" | 1264 " 'use strict';\n" |
| 1179 " a.name = 1;" | 1265 " a.name = 1;" |
| 1180 REPEAT_127(SPACE, " a.name = 1; ") | 1266 REPEAT_127(SPACE, " a.name = 1; ") |
| 1181 " a.name = 2; }\n" | 1267 " a.name = 2; }\n" |
| 1182 "f({name : \"test\"})\n", | 1268 "f({name : \"test\"})\n", |
| 1183 0, | 1269 kPointerSize, |
| 1184 2, | 1270 2, |
| 1185 778, | 1271 1294, |
| 1186 { | 1272 { |
| 1187 B(LdaSmi8), U8(1), // | 1273 B(Ldar), A(1, 2), // |
| 1188 B(StoreICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2), // | 1274 B(Star), R(0), // |
| 1189 REPEAT_127(COMMA, // | 1275 B(LdaSmi8), U8(1), // |
| 1190 B(LdaSmi8), U8(1), // | 1276 B(StoreICStrict), R(0), U8(0), U8(wide_idx_2 += 2), // |
| 1191 B(StoreICStrict), A(1, 2), U8(0), // | 1277 REPEAT_127(COMMA, // |
| 1192 U8((wide_idx_2 += 2))), // | 1278 B(Ldar), A(1, 2), // |
| 1193 B(LdaSmi8), U8(2), // | 1279 B(Star), R(0), // |
| 1194 B(StoreICStrictWide), A(1, 2), U16(0), U16(wide_idx_2 + 2), // | 1280 B(LdaSmi8), U8(1), // |
| 1195 B(LdaUndefined), // | 1281 B(StoreICStrict), R(0), U8(0), // |
| 1196 B(Return), // | 1282 U8((wide_idx_2 += 2))), // |
| 1283 B(Ldar), A(1, 2), // |
| 1284 B(Star), R(0), // |
| 1285 B(LdaSmi8), U8(2), // |
| 1286 B(StoreICStrictWide), R(0), U16(0), U16(wide_idx_2 + 2), // |
| 1287 B(LdaUndefined), // |
| 1288 B(Return), // |
| 1197 }, | 1289 }, |
| 1198 1, | 1290 1, |
| 1199 {"name"}}, | 1291 {"name"}}, |
| 1200 {"function f(a, b) {\n" | 1292 {"function f(a, b) {\n" |
| 1201 " a[b] = 1;" | 1293 " a[b] = 1;" |
| 1202 REPEAT_127(SPACE, " a[b] = 1; ") | 1294 REPEAT_127(SPACE, " a[b] = 1; ") |
| 1203 " a[b] = 2; }\n" | 1295 " a[b] = 2; }\n" |
| 1204 "f({name : \"test\"})\n", | 1296 "f({name : \"test\"})\n", |
| 1205 0, | 1297 2 * kPointerSize, |
| 1206 3, | 1298 3, |
| 1207 777, | 1299 1809, |
| 1208 { | 1300 { |
| 1209 B(LdaSmi8), U8(1), // | 1301 B(Ldar), A(1, 3), // |
| 1210 B(KeyedStoreICSloppy), A(1, 3), A(2, 3), U8(wide_idx_3 += 2), // | 1302 B(Star), R(0), // |
| 1211 REPEAT_127(COMMA, // | 1303 B(Ldar), A(2, 3), // |
| 1212 B(LdaSmi8), U8(1), // | 1304 B(Star), R(1), // |
| 1213 B(KeyedStoreICSloppy), A(1, 3), A(2, 3), // | 1305 B(LdaSmi8), U8(1), // |
| 1214 U8((wide_idx_3 += 2))), // | 1306 B(KeyedStoreICSloppy), R(0), R(1), U8(wide_idx_3 += 2), // |
| 1215 B(LdaSmi8), U8(2), // | 1307 REPEAT_127(COMMA, // |
| 1216 B(KeyedStoreICSloppyWide), A(1, 3), A(2, 3), U16(wide_idx_3 + 2), // | 1308 B(Ldar), A(1, 3), // |
| 1217 B(LdaUndefined), // | 1309 B(Star), R(0), // |
| 1218 B(Return), // | 1310 B(Ldar), A(2, 3), // |
| 1311 B(Star), R(1), // |
| 1312 B(LdaSmi8), U8(1), // |
| 1313 B(KeyedStoreICSloppy), R(0), R(1), // |
| 1314 U8((wide_idx_3 += 2))), // |
| 1315 B(Ldar), A(1, 3), // |
| 1316 B(Star), R(0), // |
| 1317 B(Ldar), A(2, 3), // |
| 1318 B(Star), R(1), // |
| 1319 B(LdaSmi8), U8(2), // |
| 1320 B(KeyedStoreICSloppyWide), R(0), R(1), U16(wide_idx_3 + 2), // |
| 1321 B(LdaUndefined), // |
| 1322 B(Return), // |
| 1219 }}, | 1323 }}, |
| 1220 {"function f(a, b) {\n" | 1324 {"function f(a, b) {\n" |
| 1221 " 'use strict';\n" | 1325 " 'use strict';\n" |
| 1222 " a[b] = 1;" | 1326 " a[b] = 1;" |
| 1223 REPEAT_127(SPACE, " a[b] = 1; ") | 1327 REPEAT_127(SPACE, " a[b] = 1; ") |
| 1224 " a[b] = 2; }\n" | 1328 " a[b] = 2; }\n" |
| 1225 "f({name : \"test\"})\n", | 1329 "f({name : \"test\"})\n", |
| 1226 0, | 1330 2 * kPointerSize, |
| 1227 3, | 1331 3, |
| 1228 777, | 1332 1809, |
| 1229 { | 1333 { |
| 1230 B(LdaSmi8), U8(1), // | 1334 B(Ldar), A(1, 3), // |
| 1231 B(KeyedStoreICStrict), A(1, 3), A(2, 3), U8(wide_idx_4 += 2), // | 1335 B(Star), R(0), // |
| 1232 REPEAT_127(COMMA, // | 1336 B(Ldar), A(2, 3), // |
| 1233 B(LdaSmi8), U8(1), // | 1337 B(Star), R(1), // |
| 1234 B(KeyedStoreICStrict), A(1, 3), A(2, 3), // | 1338 B(LdaSmi8), U8(1), // |
| 1235 U8((wide_idx_4 += 2))), // | 1339 B(KeyedStoreICStrict), R(0), R(1), U8(wide_idx_4 += 2), // |
| 1236 B(LdaSmi8), U8(2), // | 1340 REPEAT_127(COMMA, // |
| 1237 B(KeyedStoreICStrictWide), A(1, 3), A(2, 3), U16(wide_idx_4 + 2), // | 1341 B(Ldar), A(1, 3), // |
| 1238 B(LdaUndefined), // | 1342 B(Star), R(0), // |
| 1239 B(Return), // | 1343 B(Ldar), A(2, 3), // |
| 1344 B(Star), R(1), // |
| 1345 B(LdaSmi8), U8(1), // |
| 1346 B(KeyedStoreICStrict), R(0), R(1), // |
| 1347 U8((wide_idx_4 += 2))), // |
| 1348 B(Ldar), A(1, 3), // |
| 1349 B(Star), R(0), // |
| 1350 B(Ldar), A(2, 3), // |
| 1351 B(Star), R(1), // |
| 1352 B(LdaSmi8), U8(2), // |
| 1353 B(KeyedStoreICStrictWide), R(0), R(1), U16(wide_idx_4 + 2), // |
| 1354 B(LdaUndefined), // |
| 1355 B(Return), // |
| 1240 }}}; | 1356 }}}; |
| 1241 for (size_t i = 0; i < arraysize(snippets); i++) { | 1357 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 1242 Handle<BytecodeArray> bytecode_array = | 1358 Handle<BytecodeArray> bytecode_array = |
| 1243 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 1359 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 1244 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1360 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 1245 } | 1361 } |
| 1246 } | 1362 } |
| 1247 | 1363 |
| 1248 | 1364 |
| 1249 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" | 1365 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 B(Ldar), A(3, 4), // | 1409 B(Ldar), A(3, 4), // |
| 1294 B(Star), R(3), // | 1410 B(Star), R(3), // |
| 1295 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // | 1411 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // |
| 1296 B(Return) // | 1412 B(Return) // |
| 1297 }, | 1413 }, |
| 1298 1, | 1414 1, |
| 1299 {"func"}}, | 1415 {"func"}}, |
| 1300 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", | 1416 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", |
| 1301 4 * kPointerSize, | 1417 4 * kPointerSize, |
| 1302 3, | 1418 3, |
| 1303 26, | 1419 30, |
| 1304 { | 1420 { |
| 1305 B(Ldar), A(1, 3), // | 1421 B(Ldar), A(1, 3), // |
| 1306 B(Star), R(1), // | 1422 B(Star), R(1), // |
| 1307 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1423 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
| 1308 B(Star), R(0), // | 1424 B(Star), R(0), // |
| 1309 B(Ldar), A(2, 3), // | 1425 B(Ldar), A(2, 3), // |
| 1310 B(Add), A(2, 3), // | 1426 B(Star), R(3), // |
| 1427 B(Ldar), A(2, 3), // |
| 1428 B(Add), R(3), // |
| 1311 B(Star), R(2), // | 1429 B(Star), R(2), // |
| 1312 B(Ldar), A(2, 3), // | 1430 B(Ldar), A(2, 3), // |
| 1313 B(Star), R(3), // | 1431 B(Star), R(3), // |
| 1314 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // | 1432 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // |
| 1315 B(Return), // | 1433 B(Return), // |
| 1316 }, | 1434 }, |
| 1317 1, | 1435 1, |
| 1318 {"func"}}, | 1436 {"func"}}, |
| 1319 {"function f(a) {\n" | 1437 {"function f(a) {\n" |
| 1320 " a.func;\n" | 1438 " a.func;\n" |
| 1321 REPEAT_127(SPACE, " a.func;\n") | 1439 REPEAT_127(SPACE, " a.func;\n") |
| 1322 " return a.func(); }\nf(" FUNC_ARG ")", | 1440 " return a.func(); }\nf(" FUNC_ARG ")", |
| 1323 2 * kPointerSize, | 1441 2 * kPointerSize, |
| 1324 2, | 1442 2, |
| 1325 532, | 1443 1044, |
| 1326 { | 1444 { |
| 1327 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx += 2), // | 1445 B(Ldar), A(1, 2), // |
| 1328 REPEAT_127(COMMA, // | 1446 B(Star), R(0), // |
| 1329 B(LoadICSloppy), A(1, 2), U8(0), U8((wide_idx += 2))), // | 1447 B(LoadICSloppy), R(0), U8(0), U8(wide_idx += 2), // |
| 1330 B(Ldar), A(1, 2), // | 1448 REPEAT_127(COMMA, // |
| 1331 B(Star), R(1), // | 1449 B(Ldar), A(1, 2), // |
| 1332 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), // | 1450 B(Star), R(0), // |
| 1333 B(Star), R(0), // | 1451 B(LoadICSloppy), R(0), U8(0), U8((wide_idx += 2))), // |
| 1334 B(CallWide), R(0), R(1), U16(0), U16(wide_idx + 2), // | 1452 B(Ldar), A(1, 2), // |
| 1335 B(Return), // | 1453 B(Star), R(1), // |
| 1454 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), // |
| 1455 B(Star), R(0), // |
| 1456 B(CallWide), R(0), R(1), U16(0), U16(wide_idx + 2), // |
| 1457 B(Return), // |
| 1336 }, | 1458 }, |
| 1337 1, | 1459 1, |
| 1338 {"func"}}, | 1460 {"func"}}, |
| 1339 }; | 1461 }; |
| 1340 for (size_t i = 0; i < arraysize(snippets); i++) { | 1462 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 1341 Handle<BytecodeArray> bytecode_array = | 1463 Handle<BytecodeArray> bytecode_array = |
| 1342 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 1464 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 1343 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1465 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 1344 } | 1466 } |
| 1345 } | 1467 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 B(Return) // | 1522 B(Return) // |
| 1401 }, | 1523 }, |
| 1402 1, | 1524 1, |
| 1403 {"a"}}, | 1525 {"a"}}, |
| 1404 {"a = 1;" | 1526 {"a = 1;" |
| 1405 "function f(b) {\n" | 1527 "function f(b) {\n" |
| 1406 " b.name;\n" | 1528 " b.name;\n" |
| 1407 REPEAT_127(SPACE, "b.name; ") | 1529 REPEAT_127(SPACE, "b.name; ") |
| 1408 " return a;" | 1530 " return a;" |
| 1409 "}\nf({name: 1});", | 1531 "}\nf({name: 1});", |
| 1410 0, | 1532 kPointerSize, |
| 1411 2, | 1533 2, |
| 1412 518, | 1534 1030, |
| 1413 { | 1535 { |
| 1414 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2), // | 1536 B(Ldar), A(1, 2), // |
| 1415 REPEAT_127(COMMA, // | 1537 B(Star), R(0), // |
| 1416 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2)), // | 1538 B(LoadICSloppy), R(0), U8(0), U8(wide_idx_1 += 2), // |
| 1417 B(LdaGlobalSloppyWide), U16(1), U16(wide_idx_1 + 2), // | 1539 REPEAT_127(COMMA, // |
| 1418 B(Return), // | 1540 B(Ldar), A(1, 2), // |
| 1541 B(Star), R(0), // |
| 1542 B(LoadICSloppy), R(0), U8(0), U8(wide_idx_1 += 2)), // |
| 1543 B(LdaGlobalSloppyWide), U16(1), U16(wide_idx_1 + 2), // |
| 1544 B(Return), // |
| 1419 }, | 1545 }, |
| 1420 2, | 1546 2, |
| 1421 {"name", "a"}}, | 1547 {"name", "a"}}, |
| 1422 {"a = 1;" | 1548 {"a = 1;" |
| 1423 "function f(b) {\n" | 1549 "function f(b) {\n" |
| 1424 " 'use strict';\n" | 1550 " 'use strict';\n" |
| 1425 " b.name\n" | 1551 " b.name\n" |
| 1426 REPEAT_127(SPACE, "b.name; ") | 1552 REPEAT_127(SPACE, "b.name; ") |
| 1427 " return a;" | 1553 " return a;" |
| 1428 "}\nf({name: 1});", | 1554 "}\nf({name: 1});", |
| 1429 0, | 1555 kPointerSize, |
| 1430 2, | 1556 2, |
| 1431 518, | 1557 1030, |
| 1432 { | 1558 { |
| 1433 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2), // | 1559 B(Ldar), A(1, 2), // |
| 1434 REPEAT_127(COMMA, // | 1560 B(Star), R(0), // |
| 1435 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2)), // | 1561 B(LoadICStrict), R(0), U8(0), U8(wide_idx_2 += 2), // |
| 1436 B(LdaGlobalStrictWide), U16(1), U16(wide_idx_2 + 2), // | 1562 REPEAT_127(COMMA, // |
| 1437 B(Return), // | 1563 B(Ldar), A(1, 2), // |
| 1564 B(Star), R(0), // |
| 1565 B(LoadICStrict), R(0), U8(0), U8(wide_idx_2 += 2)), // |
| 1566 B(LdaGlobalStrictWide), U16(1), U16(wide_idx_2 + 2), // |
| 1567 B(Return), // |
| 1438 }, | 1568 }, |
| 1439 2, | 1569 2, |
| 1440 {"name", "a"}}, | 1570 {"name", "a"}}, |
| 1441 }; | 1571 }; |
| 1442 | 1572 |
| 1443 for (size_t i = 0; i < arraysize(snippets); i++) { | 1573 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 1444 Handle<BytecodeArray> bytecode_array = | 1574 Handle<BytecodeArray> bytecode_array = |
| 1445 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1575 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
| 1446 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1576 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 1447 } | 1577 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 B(Return) // | 1641 B(Return) // |
| 1512 }, | 1642 }, |
| 1513 1, | 1643 1, |
| 1514 {"a"}}, | 1644 {"a"}}, |
| 1515 {"a = 1;" | 1645 {"a = 1;" |
| 1516 "function f(b) {" | 1646 "function f(b) {" |
| 1517 " b.name;\n" | 1647 " b.name;\n" |
| 1518 REPEAT_127(SPACE, "b.name; ") | 1648 REPEAT_127(SPACE, "b.name; ") |
| 1519 " a = 2; }\n" | 1649 " a = 2; }\n" |
| 1520 "f({name: 1});", | 1650 "f({name: 1});", |
| 1521 0, | 1651 kPointerSize, |
| 1522 2, | 1652 2, |
| 1523 521, | 1653 1033, |
| 1524 { | 1654 { |
| 1525 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2), // | 1655 B(Ldar), A(1, 2), // |
| 1526 REPEAT_127(COMMA, // | 1656 B(Star), R(0), // |
| 1527 B(LoadICSloppy), A(1, 2), U8(0), U8(wide_idx_1 += 2)), // | 1657 B(LoadICSloppy), R(0), U8(0), U8(wide_idx_1 += 2), // |
| 1528 B(LdaSmi8), U8(2), // | 1658 REPEAT_127(COMMA, // |
| 1529 B(StaGlobalSloppyWide), U16(1), U16(wide_idx_1 + 2), // | 1659 B(Ldar), A(1, 2), // |
| 1530 B(LdaUndefined), // | 1660 B(Star), R(0), // |
| 1531 B(Return), // | 1661 B(LoadICSloppy), R(0), U8(0), U8(wide_idx_1 += 2)), // |
| 1662 B(LdaSmi8), U8(2), // |
| 1663 B(StaGlobalSloppyWide), U16(1), U16(wide_idx_1 + 2), // |
| 1664 B(LdaUndefined), // |
| 1665 B(Return), // |
| 1532 }, | 1666 }, |
| 1533 2, | 1667 2, |
| 1534 {"name", "a"}}, | 1668 {"name", "a"}}, |
| 1535 {"a = 1;" | 1669 {"a = 1;" |
| 1536 "function f(b) {\n" | 1670 "function f(b) {\n" |
| 1537 " 'use strict';\n" | 1671 " 'use strict';\n" |
| 1538 " b.name;\n" | 1672 " b.name;\n" |
| 1539 REPEAT_127(SPACE, "b.name; ") | 1673 REPEAT_127(SPACE, "b.name; ") |
| 1540 " a = 2; }\n" | 1674 " a = 2; }\n" |
| 1541 "f({name: 1});", | 1675 "f({name: 1});", |
| 1542 0, | 1676 kPointerSize, |
| 1543 2, | 1677 2, |
| 1544 521, | 1678 1033, |
| 1545 { | 1679 { |
| 1546 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2), // | 1680 B(Ldar), A(1, 2), // |
| 1547 REPEAT_127(COMMA, // | 1681 B(Star), R(0), // |
| 1548 B(LoadICStrict), A(1, 2), U8(0), U8(wide_idx_2 += 2)), // | 1682 B(LoadICStrict), R(0), U8(0), U8(wide_idx_2 += 2), // |
| 1549 B(LdaSmi8), U8(2), // | 1683 REPEAT_127(COMMA, // |
| 1550 B(StaGlobalStrictWide), U16(1), U16(wide_idx_2 + 2), // | 1684 B(Ldar), A(1, 2), // |
| 1551 B(LdaUndefined), // | 1685 B(Star), R(0), // |
| 1552 B(Return), // | 1686 B(LoadICStrict), R(0), U8(0), U8(wide_idx_2 += 2)), // |
| 1687 B(LdaSmi8), U8(2), // |
| 1688 B(StaGlobalStrictWide), U16(1), U16(wide_idx_2 + 2), // |
| 1689 B(LdaUndefined), // |
| 1690 B(Return), // |
| 1553 }, | 1691 }, |
| 1554 2, | 1692 2, |
| 1555 {"name", "a"}}, | 1693 {"name", "a"}}, |
| 1556 }; | 1694 }; |
| 1557 | 1695 |
| 1558 for (size_t i = 0; i < arraysize(snippets); i++) { | 1696 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 1559 Handle<BytecodeArray> bytecode_array = | 1697 Handle<BytecodeArray> bytecode_array = |
| 1560 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1698 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
| 1561 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1699 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 1562 } | 1700 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1731 0, | 1869 0, |
| 1732 1, | 1870 1, |
| 1733 2, | 1871 2, |
| 1734 { | 1872 { |
| 1735 B(LdaUndefined), // | 1873 B(LdaUndefined), // |
| 1736 B(Return), // | 1874 B(Return), // |
| 1737 }, | 1875 }, |
| 1738 0, | 1876 0, |
| 1739 {unused, unused, unused, unused, unused, unused}}, | 1877 {unused, unused, unused, unused, unused, unused}}, |
| 1740 {"function f() { var a = 1; if (a) { a += 1; } else { return 2; } } f();", | 1878 {"function f() { var a = 1; if (a) { a += 1; } else { return 2; } } f();", |
| 1741 1 * kPointerSize, | 1879 2 * kPointerSize, |
| 1742 1, | 1880 1, |
| 1743 19, | 1881 23, |
| 1744 { | 1882 { |
| 1745 B(LdaSmi8), U8(1), // | 1883 B(LdaSmi8), U8(1), // |
| 1746 B(Star), R(0), // | 1884 B(Star), R(0), // |
| 1747 B(JumpIfToBooleanFalse), U8(10), // | 1885 B(JumpIfToBooleanFalse), U8(14), // |
| 1886 B(Ldar), R(0), // |
| 1887 B(Star), R(1), // |
| 1748 B(LdaSmi8), U8(1), // | 1888 B(LdaSmi8), U8(1), // |
| 1749 B(Add), R(0), // | 1889 B(Add), R(1), // |
| 1750 B(Star), R(0), // | 1890 B(Star), R(0), // |
| 1751 B(Jump), U8(5), // | 1891 B(Jump), U8(5), // |
| 1752 B(LdaSmi8), U8(2), // | 1892 B(LdaSmi8), U8(2), // |
| 1753 B(Return), // | 1893 B(Return), // |
| 1754 B(LdaUndefined), // | 1894 B(LdaUndefined), // |
| 1755 B(Return), // | 1895 B(Return), // |
| 1756 }, | 1896 }, |
| 1757 0, | 1897 0, |
| 1758 {unused, unused, unused, unused, unused, unused}}, | 1898 {unused, unused, unused, unused, unused, unused}}, |
| 1759 {"function f(a) { if (a <= 0) { return 200; } else { return -200; } }" | 1899 {"function f(a) { if (a <= 0) { return 200; } else { return -200; } }" |
| 1760 "f(99);", | 1900 "f(99);", |
| 1761 0, | 1901 kPointerSize, |
| 1762 2, | 1902 2, |
| 1763 13, | 1903 17, |
| 1764 { | 1904 { |
| 1765 B(LdaZero), // | 1905 B(Ldar), A(1, 2), // |
| 1766 B(TestLessThanOrEqual), A(1, 2), // | 1906 B(Star), R(0), // |
| 1767 B(JumpIfFalse), U8(5), // | 1907 B(LdaZero), // |
| 1768 B(LdaConstant), U8(0), // | 1908 B(TestLessThanOrEqual), R(0), // |
| 1769 B(Return), // | 1909 B(JumpIfFalse), U8(5), // |
| 1770 B(LdaConstant), U8(1), // | 1910 B(LdaConstant), U8(0), // |
| 1771 B(Return), // | 1911 B(Return), // |
| 1772 B(LdaUndefined), // | 1912 B(LdaConstant), U8(1), // |
| 1773 B(Return), // | 1913 B(Return), // |
| 1914 B(LdaUndefined), // |
| 1915 B(Return), // |
| 1774 }, | 1916 }, |
| 1775 2, | 1917 2, |
| 1776 {helper.factory()->NewNumberFromInt(200), | 1918 {helper.factory()->NewNumberFromInt(200), |
| 1777 helper.factory()->NewNumberFromInt(-200), unused, unused, unused, | 1919 helper.factory()->NewNumberFromInt(-200), unused, unused, unused, |
| 1778 unused}}, | 1920 unused}}, |
| 1779 {"function f(a, b) { if (a in b) { return 200; } }" | 1921 {"function f(a, b) { if (a in b) { return 200; } }" |
| 1780 "f('prop', { prop: 'yes'});", | 1922 "f('prop', { prop: 'yes'});", |
| 1781 0, | 1923 kPointerSize, |
| 1782 3, | 1924 3, |
| 1783 11, | 1925 15, |
| 1784 { | 1926 { |
| 1927 B(Ldar), A(1, 3), // |
| 1928 B(Star), R(0), // |
| 1785 B(Ldar), A(2, 3), // | 1929 B(Ldar), A(2, 3), // |
| 1786 B(TestIn), A(1, 3), // | 1930 B(TestIn), R(0), // |
| 1787 B(JumpIfFalse), U8(5), // | 1931 B(JumpIfFalse), U8(5), // |
| 1788 B(LdaConstant), U8(0), // | 1932 B(LdaConstant), U8(0), // |
| 1789 B(Return), // | 1933 B(Return), // |
| 1790 B(LdaUndefined), // | 1934 B(LdaUndefined), // |
| 1791 B(Return), // | 1935 B(Return), // |
| 1792 }, | 1936 }, |
| 1793 1, | 1937 1, |
| 1794 {helper.factory()->NewNumberFromInt(200), unused, unused, unused, unused, | 1938 {helper.factory()->NewNumberFromInt(200), unused, unused, unused, unused, |
| 1795 unused}}, | 1939 unused}}, |
| 1796 {"function f(z) { var a = 0; var b = 0; if (a === 0.01) { " | 1940 {"function f(z) { var a = 0; var b = 0; if (a === 0.01) { " |
| 1797 REPEAT_64(SPACE, "b = a; a = b; ") | 1941 REPEAT_64(SPACE, "b = a; a = b; ") |
| 1798 " return 200; } else { return -200; } } f(0.001)", | 1942 " return 200; } else { return -200; } } f(0.001)", |
| 1799 2 * kPointerSize, | 1943 3 * kPointerSize, |
| 1800 2, | 1944 2, |
| 1801 278, | 1945 282, |
| 1802 { | 1946 { |
| 1803 B(LdaZero), // | 1947 B(LdaZero), // |
| 1804 B(Star), R(0), // | 1948 B(Star), R(0), // |
| 1805 B(LdaZero), // | 1949 B(LdaZero), // |
| 1806 B(Star), R(1), // | 1950 B(Star), R(1), // |
| 1951 B(Ldar), R(0), // |
| 1952 B(Star), R(2), // |
| 1807 B(LdaConstant), U8(0), // | 1953 B(LdaConstant), U8(0), // |
| 1808 B(TestEqualStrict), R(0), // | 1954 B(TestEqualStrict), R(2), // |
| 1809 B(JumpIfFalseConstant), U8(2), // | 1955 B(JumpIfFalseConstant), U8(2), // |
| 1810 B(Ldar), R(0), // | 1956 B(Ldar), R(0), // |
| 1811 REPEAT_64(COMMA, // | 1957 REPEAT_64(COMMA, // |
| 1812 B(Star), R(1), // | 1958 B(Star), R(1), // |
| 1813 B(Star), R(0)), // | 1959 B(Star), R(0)), // |
| 1814 B(LdaConstant), U8(1), // | 1960 B(LdaConstant), U8(1), // |
| 1815 B(Return), // | 1961 B(Return), // |
| 1816 B(LdaConstant), U8(3), // | 1962 B(LdaConstant), U8(3), // |
| 1817 B(Return), // | 1963 B(Return), // |
| 1818 B(LdaUndefined), // | 1964 B(LdaUndefined), // |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 " if (a == b) { return 1; }\n" | 2000 " if (a == b) { return 1; }\n" |
| 1855 " if (a === b) { return 1; }\n" | 2001 " if (a === b) { return 1; }\n" |
| 1856 " if (a < b) { return 1; }\n" | 2002 " if (a < b) { return 1; }\n" |
| 1857 " if (a > b) { return 1; }\n" | 2003 " if (a > b) { return 1; }\n" |
| 1858 " if (a <= b) { return 1; }\n" | 2004 " if (a <= b) { return 1; }\n" |
| 1859 " if (a >= b) { return 1; }\n" | 2005 " if (a >= b) { return 1; }\n" |
| 1860 " if (a in b) { return 1; }\n" | 2006 " if (a in b) { return 1; }\n" |
| 1861 " if (a instanceof b) { return 1; }\n" | 2007 " if (a instanceof b) { return 1; }\n" |
| 1862 " return 0;\n" | 2008 " return 0;\n" |
| 1863 "} f(1, 1);", | 2009 "} f(1, 1);", |
| 1864 0, | 2010 kPointerSize, |
| 1865 3, | 2011 3, |
| 1866 74, | 2012 106, |
| 1867 { | 2013 { |
| 1868 #define IF_CONDITION_RETURN(condition) \ | 2014 #define IF_CONDITION_RETURN(condition) \ |
| 2015 B(Ldar), A(1, 3), \ |
| 2016 B(Star), R(0), \ |
| 1869 B(Ldar), A(2, 3), \ | 2017 B(Ldar), A(2, 3), \ |
| 1870 B(condition), A(1, 3), \ | 2018 B(condition), R(0), \ |
| 1871 B(JumpIfFalse), U8(5), \ | 2019 B(JumpIfFalse), U8(5), \ |
| 1872 B(LdaSmi8), U8(1), \ | 2020 B(LdaSmi8), U8(1), \ |
| 1873 B(Return), | 2021 B(Return), |
| 1874 IF_CONDITION_RETURN(TestEqual) // | 2022 IF_CONDITION_RETURN(TestEqual) // |
| 1875 IF_CONDITION_RETURN(TestEqualStrict) // | 2023 IF_CONDITION_RETURN(TestEqualStrict) // |
| 1876 IF_CONDITION_RETURN(TestLessThan) // | 2024 IF_CONDITION_RETURN(TestLessThan) // |
| 1877 IF_CONDITION_RETURN(TestGreaterThan) // | 2025 IF_CONDITION_RETURN(TestGreaterThan) // |
| 1878 IF_CONDITION_RETURN(TestLessThanOrEqual) // | 2026 IF_CONDITION_RETURN(TestLessThanOrEqual) // |
| 1879 IF_CONDITION_RETURN(TestGreaterThanOrEqual) // | 2027 IF_CONDITION_RETURN(TestGreaterThanOrEqual) // |
| 1880 IF_CONDITION_RETURN(TestIn) // | 2028 IF_CONDITION_RETURN(TestIn) // |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 BytecodeGeneratorHelper helper; | 2189 BytecodeGeneratorHelper helper; |
| 2042 | 2190 |
| 2043 ExpectedSnippet<int> snippets[] = { | 2191 ExpectedSnippet<int> snippets[] = { |
| 2044 {"var x = 0;\n" | 2192 {"var x = 0;\n" |
| 2045 "label: {\n" | 2193 "label: {\n" |
| 2046 " x = x + 1;\n" | 2194 " x = x + 1;\n" |
| 2047 " break label;\n" | 2195 " break label;\n" |
| 2048 " x = x + 1;\n" | 2196 " x = x + 1;\n" |
| 2049 "}\n" | 2197 "}\n" |
| 2050 "return x;", | 2198 "return x;", |
| 2051 1 * kPointerSize, | 2199 2 * kPointerSize, |
| 2052 1, | 2200 1, |
| 2053 14, | 2201 16, |
| 2054 { | 2202 { |
| 2055 B(LdaZero), // | 2203 B(LdaZero), // |
| 2056 B(Star), R(0), // | 2204 B(Star), R(0), // |
| 2205 B(Star), R(1), // |
| 2057 B(LdaSmi8), U8(1), // | 2206 B(LdaSmi8), U8(1), // |
| 2058 B(Add), R(0), // | 2207 B(Add), R(1), // |
| 2059 B(Star), R(0), // | 2208 B(Star), R(0), // |
| 2060 B(Jump), U8(2), // | 2209 B(Jump), U8(2), // |
| 2061 B(Ldar), R(0), // | 2210 B(Ldar), R(0), // |
| 2062 B(Return) // | 2211 B(Return) // |
| 2063 }}, | 2212 }}, |
| 2064 {"var sum = 0;\n" | 2213 {"var sum = 0;\n" |
| 2065 "outer: {\n" | 2214 "outer: {\n" |
| 2066 " for (var x = 0; x < 10; ++x) {\n" | 2215 " for (var x = 0; x < 10; ++x) {\n" |
| 2067 " for (var y = 0; y < 3; ++y) {\n" | 2216 " for (var y = 0; y < 3; ++y) {\n" |
| 2068 " ++sum;\n" | 2217 " ++sum;\n" |
| 2069 " if (x + y == 12) { break outer; }\n" | 2218 " if (x + y == 12) { break outer; }\n" |
| 2070 " }\n" | 2219 " }\n" |
| 2071 " }\n" | 2220 " }\n" |
| 2072 "}\n" | 2221 "}\n" |
| 2073 "return sum;", | 2222 "return sum;", |
| 2074 4 * kPointerSize, | 2223 5 * kPointerSize, |
| 2075 1, | 2224 1, |
| 2076 60, | 2225 72, |
| 2077 { | 2226 { |
| 2078 B(LdaZero), // | 2227 B(LdaZero), // |
| 2079 B(Star), R(0), // | 2228 B(Star), R(0), // |
| 2080 B(LdaZero), // | 2229 B(LdaZero), // |
| 2081 B(Star), R(1), // | 2230 B(Star), R(1), // |
| 2231 B(Ldar), R(1), // |
| 2232 B(Star), R(3), // |
| 2082 B(LdaSmi8), U8(10), // | 2233 B(LdaSmi8), U8(10), // |
| 2083 B(TestLessThan), R(1), // | 2234 B(TestLessThan), R(3), // |
| 2084 B(JumpIfFalse), U8(47), // | 2235 B(JumpIfFalse), U8(55), // |
| 2085 B(LdaZero), // | 2236 B(LdaZero), // |
| 2086 B(Star), R(2), // | 2237 B(Star), R(2), // |
| 2238 B(Ldar), R(2), // |
| 2239 B(Star), R(3), // |
| 2087 B(LdaSmi8), U8(3), // | 2240 B(LdaSmi8), U8(3), // |
| 2088 B(TestLessThan), R(2), // | 2241 B(TestLessThan), R(3), // |
| 2089 B(JumpIfFalse), U8(30), // | 2242 B(JumpIfFalse), U8(34), // |
| 2090 B(Ldar), R(0), // | 2243 B(Ldar), R(0), // |
| 2091 B(ToNumber), // | 2244 B(ToNumber), // |
| 2092 B(Inc), // | 2245 B(Inc), // |
| 2093 B(Star), R(0), // | 2246 B(Star), R(0), // |
| 2247 B(Ldar), R(1), // |
| 2248 B(Star), R(3), // |
| 2094 B(Ldar), R(2), // | 2249 B(Ldar), R(2), // |
| 2095 B(Add), R(1), // | 2250 B(Add), R(3), // |
| 2096 B(Star), R(3), // | 2251 B(Star), R(4), // |
| 2097 B(LdaSmi8), U8(12), // | 2252 B(LdaSmi8), U8(12), // |
| 2098 B(TestEqual), R(3), // | 2253 B(TestEqual), R(4), // |
| 2099 B(JumpIfFalse), U8(4), // | 2254 B(JumpIfFalse), U8(4), // |
| 2100 B(Jump), U8(18), // | 2255 B(Jump), U8(18), // |
| 2101 B(Ldar), R(2), // | 2256 B(Ldar), R(2), // |
| 2102 B(ToNumber), // | 2257 B(ToNumber), // |
| 2103 B(Inc), // | 2258 B(Inc), // |
| 2104 B(Star), R(2), // | 2259 B(Star), R(2), // |
| 2105 B(Jump), U8(-32), // | 2260 B(Jump), U8(-40), // |
| 2106 B(Ldar), R(1), // | 2261 B(Ldar), R(1), // |
| 2107 B(ToNumber), // | 2262 B(ToNumber), // |
| 2108 B(Inc), // | 2263 B(Inc), // |
| 2109 B(Star), R(1), // | 2264 B(Star), R(1), // |
| 2110 B(Jump), U8(-49), // | 2265 B(Jump), U8(-61), // |
| 2111 B(Ldar), R(0), // | 2266 B(Ldar), R(0), // |
| 2112 B(Return), // | 2267 B(Return), // |
| 2113 }}, | 2268 }}, |
| 2114 }; | 2269 }; |
| 2115 | 2270 |
| 2116 for (size_t i = 0; i < arraysize(snippets); i++) { | 2271 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 2117 Handle<BytecodeArray> bytecode_array = | 2272 Handle<BytecodeArray> bytecode_array = |
| 2118 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 2273 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 2119 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 2274 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 2120 } | 2275 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 0}, | 2308 0}, |
| 2154 {"var x = 0;" | 2309 {"var x = 0;" |
| 2155 "var y = 1;" | 2310 "var y = 1;" |
| 2156 "while (x < 10) {" | 2311 "while (x < 10) {" |
| 2157 " y = y * 12;" | 2312 " y = y * 12;" |
| 2158 " x = x + 1;" | 2313 " x = x + 1;" |
| 2159 " if (x == 3) continue;" | 2314 " if (x == 3) continue;" |
| 2160 " if (x == 4) break;" | 2315 " if (x == 4) break;" |
| 2161 "}" | 2316 "}" |
| 2162 "return y;", | 2317 "return y;", |
| 2163 2 * kPointerSize, | 2318 3 * kPointerSize, |
| 2164 1, | 2319 1, |
| 2165 46, | 2320 64, |
| 2166 { | 2321 { |
| 2167 B(LdaZero), // | 2322 B(LdaZero), // |
| 2168 B(Star), R(0), // | 2323 B(Star), R(0), // |
| 2169 B(LdaSmi8), U8(1), // | 2324 B(LdaSmi8), U8(1), // |
| 2170 B(Star), R(1), // | 2325 B(Star), R(1), // |
| 2326 B(Ldar), R(0), // |
| 2327 B(Star), R(2), // |
| 2171 B(LdaSmi8), U8(10), // | 2328 B(LdaSmi8), U8(10), // |
| 2172 B(TestLessThan), R(0), // | 2329 B(TestLessThan), R(2), // |
| 2173 B(JumpIfFalse), U8(32), // | 2330 B(JumpIfFalse), U8(46), // |
| 2331 B(Ldar), R(1), // |
| 2332 B(Star), R(2), // |
| 2174 B(LdaSmi8), U8(12), // | 2333 B(LdaSmi8), U8(12), // |
| 2175 B(Mul), R(1), // | 2334 B(Mul), R(2), // |
| 2176 B(Star), R(1), // | 2335 B(Star), R(1), // |
| 2336 B(Ldar), R(0), // |
| 2337 B(Star), R(2), // |
| 2177 B(LdaSmi8), U8(1), // | 2338 B(LdaSmi8), U8(1), // |
| 2178 B(Add), R(0), // | 2339 B(Add), R(2), // |
| 2179 B(Star), R(0), // | 2340 B(Star), R(0), // |
| 2341 B(Star), R(2), // |
| 2180 B(LdaSmi8), U8(3), // | 2342 B(LdaSmi8), U8(3), // |
| 2181 B(TestEqual), R(0), // | 2343 B(TestEqual), R(2), // |
| 2182 B(JumpIfFalse), U8(4), // | 2344 B(JumpIfFalse), U8(4), // |
| 2183 B(Jump), U8(-24), // | 2345 B(Jump), U8(-38), // |
| 2346 B(Ldar), R(0), // |
| 2347 B(Star), R(2), // |
| 2184 B(LdaSmi8), U8(4), // | 2348 B(LdaSmi8), U8(4), // |
| 2185 B(TestEqual), R(0), // | 2349 B(TestEqual), R(2), // |
| 2186 B(JumpIfFalse), U8(4), // | 2350 B(JumpIfFalse), U8(4), // |
| 2187 B(Jump), U8(4), // | 2351 B(Jump), U8(4), // |
| 2188 B(Jump), U8(-34), // | 2352 B(Jump), U8(-52), // |
| 2189 B(Ldar), R(1), // | 2353 B(Ldar), R(1), // |
| 2190 B(Return), // | 2354 B(Return), // |
| 2191 }, | 2355 }, |
| 2192 0}, | 2356 0}, |
| 2193 {"var i = 0;" | 2357 {"var i = 0;" |
| 2194 "while (true) {" | 2358 "while (true) {" |
| 2195 " if (i < 0) continue;" | 2359 " if (i < 0) continue;" |
| 2196 " if (i == 3) break;" | 2360 " if (i == 3) break;" |
| 2197 " if (i == 4) break;" | 2361 " if (i == 4) break;" |
| 2198 " if (i == 10) continue;" | 2362 " if (i == 10) continue;" |
| 2199 " if (i == 5) break;" | 2363 " if (i == 5) break;" |
| 2200 " i = i + 1;" | 2364 " i = i + 1;" |
| 2201 "}" | 2365 "}" |
| 2202 "return i;", | 2366 "return i;", |
| 2203 1 * kPointerSize, | 2367 2 * kPointerSize, |
| 2204 1, | 2368 1, |
| 2205 53, | 2369 77, |
| 2206 { | 2370 { |
| 2207 B(LdaZero), // | 2371 B(LdaZero), // |
| 2208 B(Star), R(0), // | 2372 B(Star), R(0), // |
| 2373 B(Ldar), R(0), // |
| 2374 B(Star), R(1), // |
| 2209 B(LdaZero), // | 2375 B(LdaZero), // |
| 2210 B(TestLessThan), R(0), // | 2376 B(TestLessThan), R(1), // |
| 2211 B(JumpIfFalse), U8(4), // | 2377 B(JumpIfFalse), U8(4), // |
| 2212 B(Jump), U8(-5), // | 2378 B(Jump), U8(-9), // |
| 2379 B(Ldar), R(0), // |
| 2380 B(Star), R(1), // |
| 2213 B(LdaSmi8), U8(3), // | 2381 B(LdaSmi8), U8(3), // |
| 2214 B(TestEqual), R(0), // | 2382 B(TestEqual), R(1), // |
| 2215 B(JumpIfFalse), U8(4), // | 2383 B(JumpIfFalse), U8(4), // |
| 2216 B(Jump), U8(34), // | 2384 B(Jump), U8(50), // |
| 2385 B(Ldar), R(0), // |
| 2386 B(Star), R(1), // |
| 2217 B(LdaSmi8), U8(4), // | 2387 B(LdaSmi8), U8(4), // |
| 2218 B(TestEqual), R(0), // | 2388 B(TestEqual), R(1), // |
| 2219 B(JumpIfFalse), U8(4), // | 2389 B(JumpIfFalse), U8(4), // |
| 2220 B(Jump), U8(26), // | 2390 B(Jump), U8(38), // |
| 2391 B(Ldar), R(0), // |
| 2392 B(Star), R(1), // |
| 2221 B(LdaSmi8), U8(10), // | 2393 B(LdaSmi8), U8(10), // |
| 2222 B(TestEqual), R(0), // | 2394 B(TestEqual), R(1), // |
| 2223 B(JumpIfFalse), U8(4), // | 2395 B(JumpIfFalse), U8(4), // |
| 2224 B(Jump), U8(-29), // | 2396 B(Jump), U8(-45), // |
| 2397 B(Ldar), R(0), // |
| 2398 B(Star), R(1), // |
| 2225 B(LdaSmi8), U8(5), // | 2399 B(LdaSmi8), U8(5), // |
| 2226 B(TestEqual), R(0), // | 2400 B(TestEqual), R(1), // |
| 2227 B(JumpIfFalse), U8(4), // | 2401 B(JumpIfFalse), U8(4), // |
| 2228 B(Jump), U8(10), // | 2402 B(Jump), U8(14), // |
| 2403 B(Ldar), R(0), // |
| 2404 B(Star), R(1), // |
| 2229 B(LdaSmi8), U8(1), // | 2405 B(LdaSmi8), U8(1), // |
| 2230 B(Add), R(0), // | 2406 B(Add), R(1), // |
| 2231 B(Star), R(0), // | 2407 B(Star), R(0), // |
| 2232 B(Jump), U8(-45), // | 2408 B(Jump), U8(-69), // |
| 2233 B(Ldar), R(0), // | 2409 B(Ldar), R(0), // |
| 2234 B(Return), // | 2410 B(Return), // |
| 2235 }, | 2411 }, |
| 2236 0}, | 2412 0}, |
| 2237 {"var i = 0;" | 2413 {"var i = 0;" |
| 2238 "while (true) {" | 2414 "while (true) {" |
| 2239 " while (i < 3) {" | 2415 " while (i < 3) {" |
| 2240 " if (i == 2) break;" | 2416 " if (i == 2) break;" |
| 2241 " i = i + 1;" | 2417 " i = i + 1;" |
| 2242 " }" | 2418 " }" |
| 2243 " i = i + 1;" | 2419 " i = i + 1;" |
| 2244 " break;" | 2420 " break;" |
| 2245 "}" | 2421 "}" |
| 2246 "return i;", | 2422 "return i;", |
| 2247 1 * kPointerSize, | 2423 2 * kPointerSize, |
| 2248 1, | 2424 1, |
| 2249 38, | 2425 54, |
| 2250 { | 2426 { |
| 2251 B(LdaZero), // | 2427 B(LdaZero), // |
| 2252 B(Star), R(0), // | 2428 B(Star), R(0), // |
| 2429 B(Ldar), R(0), // |
| 2430 B(Star), R(1), // |
| 2253 B(LdaSmi8), U8(3), // | 2431 B(LdaSmi8), U8(3), // |
| 2254 B(TestLessThan), R(0), // | 2432 B(TestLessThan), R(1), // |
| 2255 B(JumpIfFalse), U8(18), // | 2433 B(JumpIfFalse), U8(26), // |
| 2434 B(Ldar), R(0), // |
| 2435 B(Star), R(1), // |
| 2256 B(LdaSmi8), U8(2), // | 2436 B(LdaSmi8), U8(2), // |
| 2257 B(TestEqual), R(0), // | 2437 B(TestEqual), R(1), // |
| 2258 B(JumpIfFalse), U8(4), // | 2438 B(JumpIfFalse), U8(4), // |
| 2259 B(Jump), U8(10), // | 2439 B(Jump), U8(14), // |
| 2440 B(Ldar), R(0), // |
| 2441 B(Star), R(1), // |
| 2260 B(LdaSmi8), U8(1), // | 2442 B(LdaSmi8), U8(1), // |
| 2261 B(Add), R(0), // | 2443 B(Add), R(1), // |
| 2262 B(Star), R(0), // | 2444 B(Star), R(0), // |
| 2263 B(Jump), U8(-20), // | 2445 B(Jump), U8(-32), // |
| 2446 B(Ldar), R(0), // |
| 2447 B(Star), R(1), // |
| 2264 B(LdaSmi8), U8(1), // | 2448 B(LdaSmi8), U8(1), // |
| 2265 B(Add), R(0), // | 2449 B(Add), R(1), // |
| 2266 B(Star), R(0), // | 2450 B(Star), R(0), // |
| 2267 B(Jump), U8(4), // | 2451 B(Jump), U8(4), // |
| 2268 B(Jump), U8(-30), // | 2452 B(Jump), U8(-46), // |
| 2269 B(Ldar), R(0), // | 2453 B(Ldar), R(0), // |
| 2270 B(Return), // | 2454 B(Return), // |
| 2271 }, | 2455 }, |
| 2272 0}, | 2456 0}, |
| 2273 {"var x = 10;" | 2457 {"var x = 10;" |
| 2274 "var y = 1;" | 2458 "var y = 1;" |
| 2275 "while (x) {" | 2459 "while (x) {" |
| 2276 " y = y * 12;" | 2460 " y = y * 12;" |
| 2277 " x = x - 1;" | 2461 " x = x - 1;" |
| 2278 "}" | 2462 "}" |
| 2279 "return y;", | 2463 "return y;", |
| 2280 2 * kPointerSize, | 2464 3 * kPointerSize, |
| 2281 1, | 2465 1, |
| 2282 29, | 2466 37, |
| 2283 { | 2467 { |
| 2284 B(LdaSmi8), U8(10), // | 2468 B(LdaSmi8), U8(10), // |
| 2285 B(Star), R(0), // | 2469 B(Star), R(0), // |
| 2286 B(LdaSmi8), U8(1), // | 2470 B(LdaSmi8), U8(1), // |
| 2287 B(Star), R(1), // | 2471 B(Star), R(1), // |
| 2288 B(Ldar), R(0), // | 2472 B(Ldar), R(0), // |
| 2289 B(JumpIfToBooleanFalse), U8(16), // | 2473 B(JumpIfToBooleanFalse), U8(24), // |
| 2474 B(Ldar), R(1), // |
| 2475 B(Star), R(2), // |
| 2290 B(LdaSmi8), U8(12), // | 2476 B(LdaSmi8), U8(12), // |
| 2291 B(Mul), R(1), // | 2477 B(Mul), R(2), // |
| 2292 B(Star), R(1), // | 2478 B(Star), R(1), // |
| 2479 B(Ldar), R(0), // |
| 2480 B(Star), R(2), // |
| 2293 B(LdaSmi8), U8(1), // | 2481 B(LdaSmi8), U8(1), // |
| 2294 B(Sub), R(0), // | 2482 B(Sub), R(2), // |
| 2295 B(Star), R(0), // | 2483 B(Star), R(0), // |
| 2296 B(Jump), U8(-16), // | 2484 B(Jump), U8(-24), // |
| 2297 B(Ldar), R(1), // | 2485 B(Ldar), R(1), // |
| 2298 B(Return), // | 2486 B(Return), // |
| 2299 }, | 2487 }, |
| 2300 0}, | 2488 0}, |
| 2301 {"var x = 0; var y = 1;" | 2489 {"var x = 0; var y = 1;" |
| 2302 "do {" | 2490 "do {" |
| 2303 " y = y * 10;" | 2491 " y = y * 10;" |
| 2304 " if (x == 5) break;" | 2492 " if (x == 5) break;" |
| 2305 " if (x == 6) continue;" | 2493 " if (x == 6) continue;" |
| 2306 " x = x + 1;" | 2494 " x = x + 1;" |
| 2307 "} while (x < 10);" | 2495 "} while (x < 10);" |
| 2308 "return y;", | 2496 "return y;", |
| 2309 2 * kPointerSize, | 2497 3 * kPointerSize, |
| 2310 1, | 2498 1, |
| 2311 44, | 2499 64, |
| 2312 { | 2500 { |
| 2313 B(LdaZero), // | 2501 B(LdaZero), // |
| 2314 B(Star), R(0), // | 2502 B(Star), R(0), // |
| 2315 B(LdaSmi8), U8(1), // | 2503 B(LdaSmi8), U8(1), // |
| 2316 B(Star), R(1), // | 2504 B(Star), R(1), // |
| 2505 B(Ldar), R(1), // |
| 2506 B(Star), R(2), // |
| 2317 B(LdaSmi8), U8(10), // | 2507 B(LdaSmi8), U8(10), // |
| 2318 B(Mul), R(1), // | 2508 B(Mul), R(2), // |
| 2319 B(Star), R(1), // | 2509 B(Star), R(1), // |
| 2510 B(Ldar), R(0), // |
| 2511 B(Star), R(2), // |
| 2320 B(LdaSmi8), U8(5), // | 2512 B(LdaSmi8), U8(5), // |
| 2321 B(TestEqual), R(0), // | 2513 B(TestEqual), R(2), // |
| 2322 B(JumpIfFalse), U8(4), // | 2514 B(JumpIfFalse), U8(4), // |
| 2323 B(Jump), U8(22), // | 2515 B(Jump), U8(34), // |
| 2516 B(Ldar), R(0), // |
| 2517 B(Star), R(2), // |
| 2324 B(LdaSmi8), U8(6), // | 2518 B(LdaSmi8), U8(6), // |
| 2325 B(TestEqual), R(0), // | 2519 B(TestEqual), R(2), // |
| 2326 B(JumpIfFalse), U8(4), // | 2520 B(JumpIfFalse), U8(4), // |
| 2327 B(Jump), U8(8), // | 2521 B(Jump), U8(12), // |
| 2522 B(Ldar), R(0), // |
| 2523 B(Star), R(2), // |
| 2328 B(LdaSmi8), U8(1), // | 2524 B(LdaSmi8), U8(1), // |
| 2329 B(Add), R(0), // | 2525 B(Add), R(2), // |
| 2330 B(Star), R(0), // | 2526 B(Star), R(0), // |
| 2527 B(Ldar), R(0), // |
| 2528 B(Star), R(2), // |
| 2331 B(LdaSmi8), U8(10), // | 2529 B(LdaSmi8), U8(10), // |
| 2332 B(TestLessThan), R(0), // | 2530 B(TestLessThan), R(2), // |
| 2333 B(JumpIfTrue), U8(-32), // | 2531 B(JumpIfTrue), U8(-52), // |
| 2334 B(Ldar), R(1), // | 2532 B(Ldar), R(1), // |
| 2335 B(Return), // | 2533 B(Return), // |
| 2336 }, | 2534 }, |
| 2337 0}, | 2535 0}, |
| 2338 {"var x = 10;" | 2536 {"var x = 10;" |
| 2339 "var y = 1;" | 2537 "var y = 1;" |
| 2340 "do {" | 2538 "do {" |
| 2341 " y = y * 12;" | 2539 " y = y * 12;" |
| 2342 " x = x - 1;" | 2540 " x = x - 1;" |
| 2343 "} while (x);" | 2541 "} while (x);" |
| 2344 "return y;", | 2542 "return y;", |
| 2345 2 * kPointerSize, | 2543 3 * kPointerSize, |
| 2346 1, | 2544 1, |
| 2347 27, | 2545 35, |
| 2348 { | 2546 { |
| 2349 B(LdaSmi8), U8(10), // | 2547 B(LdaSmi8), U8(10), // |
| 2350 B(Star), R(0), // | 2548 B(Star), R(0), // |
| 2351 B(LdaSmi8), U8(1), // | 2549 B(LdaSmi8), U8(1), // |
| 2352 B(Star), R(1), // | 2550 B(Star), R(1), // |
| 2551 B(Ldar), R(1), // |
| 2552 B(Star), R(2), // |
| 2353 B(LdaSmi8), U8(12), // | 2553 B(LdaSmi8), U8(12), // |
| 2354 B(Mul), R(1), // | 2554 B(Mul), R(2), // |
| 2355 B(Star), R(1), // | 2555 B(Star), R(1), // |
| 2556 B(Ldar), R(0), // |
| 2557 B(Star), R(2), // |
| 2356 B(LdaSmi8), U8(1), // | 2558 B(LdaSmi8), U8(1), // |
| 2357 B(Sub), R(0), // | 2559 B(Sub), R(2), // |
| 2358 B(Star), R(0), // | 2560 B(Star), R(0), // |
| 2359 B(Ldar), R(0), // | 2561 B(Ldar), R(0), // |
| 2360 B(JumpIfToBooleanTrue), U8(-14), // | 2562 B(JumpIfToBooleanTrue), U8(-22), // |
| 2361 B(Ldar), R(1), // | 2563 B(Ldar), R(1), // |
| 2362 B(Return), // | 2564 B(Return), // |
| 2363 }, | 2565 }, |
| 2364 0}, | 2566 0}, |
| 2365 {"var x = 0; var y = 1;" | 2567 {"var x = 0; var y = 1;" |
| 2366 "do {" | 2568 "do {" |
| 2367 " y = y * 10;" | 2569 " y = y * 10;" |
| 2368 " if (x == 5) break;" | 2570 " if (x == 5) break;" |
| 2369 " x = x + 1;" | 2571 " x = x + 1;" |
| 2370 " if (x == 6) continue;" | 2572 " if (x == 6) continue;" |
| 2371 "} while (false);" | 2573 "} while (false);" |
| 2372 "return y;", | 2574 "return y;", |
| 2373 2 * kPointerSize, | 2575 3 * kPointerSize, |
| 2374 1, | 2576 1, |
| 2375 38, | 2577 52, |
| 2376 { | 2578 { |
| 2377 B(LdaZero), // | 2579 B(LdaZero), // |
| 2378 B(Star), R(0), // | 2580 B(Star), R(0), // |
| 2379 B(LdaSmi8), U8(1), // | 2581 B(LdaSmi8), U8(1), // |
| 2380 B(Star), R(1), // | 2582 B(Star), R(1), // |
| 2583 B(Ldar), R(1), // |
| 2584 B(Star), R(2), // |
| 2381 B(LdaSmi8), U8(10), // | 2585 B(LdaSmi8), U8(10), // |
| 2382 B(Mul), R(1), // | 2586 B(Mul), R(2), // |
| 2383 B(Star), R(1), // | 2587 B(Star), R(1), // |
| 2588 B(Ldar), R(0), // |
| 2589 B(Star), R(2), // |
| 2384 B(LdaSmi8), U8(5), // | 2590 B(LdaSmi8), U8(5), // |
| 2385 B(TestEqual), R(0), // | 2591 B(TestEqual), R(2), // |
| 2386 B(JumpIfFalse), U8(4), // | 2592 B(JumpIfFalse), U8(4), // |
| 2387 B(Jump), U8(16), // | 2593 B(Jump), U8(22), // |
| 2594 B(Ldar), R(0), // |
| 2595 B(Star), R(2), // |
| 2388 B(LdaSmi8), U8(1), // | 2596 B(LdaSmi8), U8(1), // |
| 2389 B(Add), R(0), // | 2597 B(Add), R(2), // |
| 2390 B(Star), R(0), // | 2598 B(Star), R(0), // |
| 2599 B(Star), R(2), // |
| 2391 B(LdaSmi8), U8(6), // | 2600 B(LdaSmi8), U8(6), // |
| 2392 B(TestEqual), R(0), // | 2601 B(TestEqual), R(2), // |
| 2393 B(JumpIfFalse), U8(4), // | 2602 B(JumpIfFalse), U8(4), // |
| 2394 B(Jump), U8(2), // | 2603 B(Jump), U8(2), // |
| 2395 B(Ldar), R(1), // | 2604 B(Ldar), R(1), // |
| 2396 B(Return), // | 2605 B(Return), // |
| 2397 }, | 2606 }, |
| 2398 0}, | 2607 0}, |
| 2399 {"var x = 0; var y = 1;" | 2608 {"var x = 0; var y = 1;" |
| 2400 "do {" | 2609 "do {" |
| 2401 " y = y * 10;" | 2610 " y = y * 10;" |
| 2402 " if (x == 5) break;" | 2611 " if (x == 5) break;" |
| 2403 " x = x + 1;" | 2612 " x = x + 1;" |
| 2404 " if (x == 6) continue;" | 2613 " if (x == 6) continue;" |
| 2405 "} while (true);" | 2614 "} while (true);" |
| 2406 "return y;", | 2615 "return y;", |
| 2407 2 * kPointerSize, | 2616 3 * kPointerSize, |
| 2408 1, | 2617 1, |
| 2409 40, | 2618 54, |
| 2410 { | 2619 { |
| 2411 B(LdaZero), // | 2620 B(LdaZero), // |
| 2412 B(Star), R(0), // | 2621 B(Star), R(0), // |
| 2413 B(LdaSmi8), U8(1), // | 2622 B(LdaSmi8), U8(1), // |
| 2414 B(Star), R(1), // | 2623 B(Star), R(1), // |
| 2624 B(Ldar), R(1), // |
| 2625 B(Star), R(2), // |
| 2415 B(LdaSmi8), U8(10), // | 2626 B(LdaSmi8), U8(10), // |
| 2416 B(Mul), R(1), // | 2627 B(Mul), R(2), // |
| 2417 B(Star), R(1), // | 2628 B(Star), R(1), // |
| 2629 B(Ldar), R(0), // |
| 2630 B(Star), R(2), // |
| 2418 B(LdaSmi8), U8(5), // | 2631 B(LdaSmi8), U8(5), // |
| 2419 B(TestEqual), R(0), // | 2632 B(TestEqual), R(2), // |
| 2420 B(JumpIfFalse), U8(4), // | 2633 B(JumpIfFalse), U8(4), // |
| 2421 B(Jump), U8(18), // | 2634 B(Jump), U8(24), // |
| 2635 B(Ldar), R(0), // |
| 2636 B(Star), R(2), // |
| 2422 B(LdaSmi8), U8(1), // | 2637 B(LdaSmi8), U8(1), // |
| 2423 B(Add), R(0), // | 2638 B(Add), R(2), // |
| 2424 B(Star), R(0), // | 2639 B(Star), R(0), // |
| 2640 B(Star), R(2), // |
| 2425 B(LdaSmi8), U8(6), // | 2641 B(LdaSmi8), U8(6), // |
| 2426 B(TestEqual), R(0), // | 2642 B(TestEqual), R(2), // |
| 2427 B(JumpIfFalse), U8(4), // | 2643 B(JumpIfFalse), U8(4), // |
| 2428 B(Jump), U8(-26), // | 2644 B(Jump), U8(-40), // |
| 2429 B(Jump), U8(-28), // | 2645 B(Jump), U8(-42), // |
| 2430 B(Ldar), R(1), // | 2646 B(Ldar), R(1), // |
| 2431 B(Return), // | 2647 B(Return), // |
| 2432 }, | 2648 }, |
| 2433 0}, | 2649 0}, |
| 2434 {"var x = 0; " | 2650 {"var x = 0; " |
| 2435 "for (;;) {" | 2651 "for (;;) {" |
| 2436 " if (x == 1) break;" | 2652 " if (x == 1) break;" |
| 2437 " if (x == 2) continue;" | 2653 " if (x == 2) continue;" |
| 2438 " x = x + 1;" | 2654 " x = x + 1;" |
| 2439 "}", | 2655 "}", |
| 2440 1 * kPointerSize, | 2656 2 * kPointerSize, |
| 2441 1, | 2657 1, |
| 2442 29, | 2658 41, |
| 2443 { | 2659 { |
| 2444 B(LdaZero), // | 2660 B(LdaZero), // |
| 2445 B(Star), R(0), // | 2661 B(Star), R(0), // |
| 2662 B(Ldar), R(0), // |
| 2663 B(Star), R(1), // |
| 2446 B(LdaSmi8), U8(1), // | 2664 B(LdaSmi8), U8(1), // |
| 2447 B(TestEqual), R(0), // | 2665 B(TestEqual), R(1), // |
| 2448 B(JumpIfFalse), U8(4), // | 2666 B(JumpIfFalse), U8(4), // |
| 2449 B(Jump), U8(18), // | 2667 B(Jump), U8(26), // |
| 2668 B(Ldar), R(0), // |
| 2669 B(Star), R(1), // |
| 2450 B(LdaSmi8), U8(2), // | 2670 B(LdaSmi8), U8(2), // |
| 2451 B(TestEqual), R(0), // | 2671 B(TestEqual), R(1), // |
| 2452 B(JumpIfFalse), U8(4), // | 2672 B(JumpIfFalse), U8(4), // |
| 2453 B(Jump), U8(-14), // | 2673 B(Jump), U8(-22), // |
| 2674 B(Ldar), R(0), // |
| 2675 B(Star), R(1), // |
| 2454 B(LdaSmi8), U8(1), // | 2676 B(LdaSmi8), U8(1), // |
| 2455 B(Add), R(0), // | 2677 B(Add), R(1), // |
| 2456 B(Star), R(0), // | 2678 B(Star), R(0), // |
| 2457 B(Jump), U8(-22), // | 2679 B(Jump), U8(-34), // |
| 2458 B(LdaUndefined), // | 2680 B(LdaUndefined), // |
| 2459 B(Return), // | 2681 B(Return), // |
| 2460 }, | 2682 }, |
| 2461 0}, | 2683 0}, |
| 2462 {"for (var x = 0;;) {" | 2684 {"for (var x = 0;;) {" |
| 2463 " if (x == 1) break;" | 2685 " if (x == 1) break;" |
| 2464 " if (x == 2) continue;" | 2686 " if (x == 2) continue;" |
| 2465 " x = x + 1;" | 2687 " x = x + 1;" |
| 2466 "}", | 2688 "}", |
| 2467 1 * kPointerSize, | 2689 2 * kPointerSize, |
| 2468 1, | 2690 1, |
| 2469 29, | 2691 41, |
| 2470 { | 2692 { |
| 2471 B(LdaZero), // | 2693 B(LdaZero), // |
| 2472 B(Star), R(0), // | 2694 B(Star), R(0), // |
| 2695 B(Ldar), R(0), // |
| 2696 B(Star), R(1), // |
| 2473 B(LdaSmi8), U8(1), // | 2697 B(LdaSmi8), U8(1), // |
| 2474 B(TestEqual), R(0), // | 2698 B(TestEqual), R(1), // |
| 2475 B(JumpIfFalse), U8(4), // | 2699 B(JumpIfFalse), U8(4), // |
| 2476 B(Jump), U8(18), // | 2700 B(Jump), U8(26), // |
| 2701 B(Ldar), R(0), // |
| 2702 B(Star), R(1), // |
| 2477 B(LdaSmi8), U8(2), // | 2703 B(LdaSmi8), U8(2), // |
| 2478 B(TestEqual), R(0), // | 2704 B(TestEqual), R(1), // |
| 2479 B(JumpIfFalse), U8(4), // | 2705 B(JumpIfFalse), U8(4), // |
| 2480 B(Jump), U8(-14), // | 2706 B(Jump), U8(-22), // |
| 2707 B(Ldar), R(0), // |
| 2708 B(Star), R(1), // |
| 2481 B(LdaSmi8), U8(1), // | 2709 B(LdaSmi8), U8(1), // |
| 2482 B(Add), R(0), // | 2710 B(Add), R(1), // |
| 2483 B(Star), R(0), // | 2711 B(Star), R(0), // |
| 2484 B(Jump), U8(-22), // | 2712 B(Jump), U8(-34), // |
| 2485 B(LdaUndefined), // | 2713 B(LdaUndefined), // |
| 2486 B(Return), // | 2714 B(Return), // |
| 2487 }, | 2715 }, |
| 2488 0}, | 2716 0}, |
| 2489 {"var x = 0; " | 2717 {"var x = 0; " |
| 2490 "for (;; x = x + 1) {" | 2718 "for (;; x = x + 1) {" |
| 2491 " if (x == 1) break;" | 2719 " if (x == 1) break;" |
| 2492 " if (x == 2) continue;" | 2720 " if (x == 2) continue;" |
| 2493 "}", | 2721 "}", |
| 2494 1 * kPointerSize, | 2722 2 * kPointerSize, |
| 2495 1, | 2723 1, |
| 2496 29, | 2724 41, |
| 2497 { | 2725 { |
| 2498 B(LdaZero), // | 2726 B(LdaZero), // |
| 2499 B(Star), R(0), // | 2727 B(Star), R(0), // |
| 2728 B(Ldar), R(0), // |
| 2729 B(Star), R(1), // |
| 2500 B(LdaSmi8), U8(1), // | 2730 B(LdaSmi8), U8(1), // |
| 2501 B(TestEqual), R(0), // | 2731 B(TestEqual), R(1), // |
| 2502 B(JumpIfFalse), U8(4), // | 2732 B(JumpIfFalse), U8(4), // |
| 2503 B(Jump), U8(18), // | 2733 B(Jump), U8(26), // |
| 2734 B(Ldar), R(0), // |
| 2735 B(Star), R(1), // |
| 2504 B(LdaSmi8), U8(2), // | 2736 B(LdaSmi8), U8(2), // |
| 2505 B(TestEqual), R(0), // | 2737 B(TestEqual), R(1), // |
| 2506 B(JumpIfFalse), U8(4), // | 2738 B(JumpIfFalse), U8(4), // |
| 2507 B(Jump), U8(2), // | 2739 B(Jump), U8(2), // |
| 2740 B(Ldar), R(0), // |
| 2741 B(Star), R(1), // |
| 2508 B(LdaSmi8), U8(1), // | 2742 B(LdaSmi8), U8(1), // |
| 2509 B(Add), R(0), // | 2743 B(Add), R(1), // |
| 2510 B(Star), R(0), // | 2744 B(Star), R(0), // |
| 2511 B(Jump), U8(-22), // | 2745 B(Jump), U8(-34), // |
| 2512 B(LdaUndefined), // | 2746 B(LdaUndefined), // |
| 2513 B(Return), // | 2747 B(Return), // |
| 2514 }, | 2748 }, |
| 2515 0}, | 2749 0}, |
| 2516 {"for (var x = 0;; x = x + 1) {" | 2750 {"for (var x = 0;; x = x + 1) {" |
| 2517 " if (x == 1) break;" | 2751 " if (x == 1) break;" |
| 2518 " if (x == 2) continue;" | 2752 " if (x == 2) continue;" |
| 2519 "}", | 2753 "}", |
| 2520 1 * kPointerSize, | 2754 2 * kPointerSize, |
| 2521 1, | 2755 1, |
| 2522 29, | 2756 41, |
| 2523 { | 2757 { |
| 2524 B(LdaZero), // | 2758 B(LdaZero), // |
| 2525 B(Star), R(0), // | 2759 B(Star), R(0), // |
| 2760 B(Ldar), R(0), // |
| 2761 B(Star), R(1), // |
| 2526 B(LdaSmi8), U8(1), // | 2762 B(LdaSmi8), U8(1), // |
| 2527 B(TestEqual), R(0), // | 2763 B(TestEqual), R(1), // |
| 2528 B(JumpIfFalse), U8(4), // | 2764 B(JumpIfFalse), U8(4), // |
| 2529 B(Jump), U8(18), // | 2765 B(Jump), U8(26), // |
| 2766 B(Ldar), R(0), // |
| 2767 B(Star), R(1), // |
| 2530 B(LdaSmi8), U8(2), // | 2768 B(LdaSmi8), U8(2), // |
| 2531 B(TestEqual), R(0), // | 2769 B(TestEqual), R(1), // |
| 2532 B(JumpIfFalse), U8(4), // | 2770 B(JumpIfFalse), U8(4), // |
| 2533 B(Jump), U8(2), // | 2771 B(Jump), U8(2), // |
| 2772 B(Ldar), R(0), // |
| 2773 B(Star), R(1), // |
| 2534 B(LdaSmi8), U8(1), // | 2774 B(LdaSmi8), U8(1), // |
| 2535 B(Add), R(0), // | 2775 B(Add), R(1), // |
| 2536 B(Star), R(0), // | 2776 B(Star), R(0), // |
| 2537 B(Jump), U8(-22), // | 2777 B(Jump), U8(-34), // |
| 2538 B(LdaUndefined), // | 2778 B(LdaUndefined), // |
| 2539 B(Return), // | 2779 B(Return), // |
| 2540 }, | 2780 }, |
| 2541 0}, | 2781 0}, |
| 2542 {"var u = 0;" | 2782 {"var u = 0;" |
| 2543 "for (var i = 0; i < 100; i = i + 1) {" | 2783 "for (var i = 0; i < 100; i = i + 1) {" |
| 2544 " u = u + 1;" | 2784 " u = u + 1;" |
| 2545 " continue;" | 2785 " continue;" |
| 2546 "}", | 2786 "}", |
| 2547 2 * kPointerSize, | 2787 3 * kPointerSize, |
| 2548 1, | 2788 1, |
| 2549 30, | 2789 42, |
| 2550 { | 2790 { |
| 2551 B(LdaZero), // | 2791 B(LdaZero), // |
| 2552 B(Star), R(0), // | 2792 B(Star), R(0), // |
| 2553 B(LdaZero), // | 2793 B(LdaZero), // |
| 2554 B(Star), R(1), // | 2794 B(Star), R(1), // |
| 2795 B(Ldar), R(1), // |
| 2796 B(Star), R(2), // |
| 2555 B(LdaSmi8), U8(100), // | 2797 B(LdaSmi8), U8(100), // |
| 2556 B(TestLessThan), R(1), // | 2798 B(TestLessThan), R(2), // |
| 2557 B(JumpIfFalse), U8(18), // | 2799 B(JumpIfFalse), U8(26), // |
| 2800 B(Ldar), R(0), // |
| 2801 B(Star), R(2), // |
| 2558 B(LdaSmi8), U8(1), // | 2802 B(LdaSmi8), U8(1), // |
| 2559 B(Add), R(0), // | 2803 B(Add), R(2), // |
| 2560 B(Star), R(0), // | 2804 B(Star), R(0), // |
| 2561 B(Jump), U8(2), // | 2805 B(Jump), U8(2), // |
| 2806 B(Ldar), R(1), // |
| 2807 B(Star), R(2), // |
| 2562 B(LdaSmi8), U8(1), // | 2808 B(LdaSmi8), U8(1), // |
| 2563 B(Add), R(1), // | 2809 B(Add), R(2), // |
| 2564 B(Star), R(1), // | 2810 B(Star), R(1), // |
| 2565 B(Jump), U8(-20), // | 2811 B(Jump), U8(-32), // |
| 2566 B(LdaUndefined), // | 2812 B(LdaUndefined), // |
| 2567 B(Return), // | 2813 B(Return), // |
| 2568 }, | 2814 }, |
| 2569 0}, | 2815 0}, |
| 2570 {"var y = 1;" | 2816 {"var y = 1;" |
| 2571 "for (var x = 10; x; --x) {" | 2817 "for (var x = 10; x; --x) {" |
| 2572 " y = y * 12;" | 2818 " y = y * 12;" |
| 2573 "}" | 2819 "}" |
| 2574 "return y;", | 2820 "return y;", |
| 2575 2 * kPointerSize, | 2821 3 * kPointerSize, |
| 2576 1, | 2822 1, |
| 2577 29, | 2823 33, |
| 2578 { | 2824 { |
| 2579 B(LdaSmi8), U8(1), // | 2825 B(LdaSmi8), U8(1), // |
| 2580 B(Star), R(0), // | 2826 B(Star), R(0), // |
| 2581 B(LdaSmi8), U8(10), // | 2827 B(LdaSmi8), U8(10), // |
| 2582 B(Star), R(1), // | 2828 B(Star), R(1), // |
| 2583 B(Ldar), R(1), // | 2829 B(Ldar), R(1), // |
| 2584 B(JumpIfToBooleanFalse), U8(16), // | 2830 B(JumpIfToBooleanFalse), U8(20), // |
| 2831 B(Ldar), R(0), // |
| 2832 B(Star), R(2), // |
| 2585 B(LdaSmi8), U8(12), // | 2833 B(LdaSmi8), U8(12), // |
| 2586 B(Mul), R(0), // | 2834 B(Mul), R(2), // |
| 2587 B(Star), R(0), // | 2835 B(Star), R(0), // |
| 2588 B(Ldar), R(1), // | 2836 B(Ldar), R(1), // |
| 2589 B(ToNumber), // | 2837 B(ToNumber), // |
| 2590 B(Dec), // | 2838 B(Dec), // |
| 2591 B(Star), R(1), // | 2839 B(Star), R(1), // |
| 2592 B(Jump), U8(-16), // | 2840 B(Jump), U8(-20), // |
| 2593 B(Ldar), R(0), // | 2841 B(Ldar), R(0), // |
| 2594 B(Return), // | 2842 B(Return), // |
| 2595 }, | 2843 }, |
| 2596 0}, | 2844 0}, |
| 2597 {"var x = 0;" | 2845 {"var x = 0;" |
| 2598 "for (var i = 0; false; i++) {" | 2846 "for (var i = 0; false; i++) {" |
| 2599 " x = x + 1;" | 2847 " x = x + 1;" |
| 2600 "};" | 2848 "};" |
| 2601 "return x;", | 2849 "return x;", |
| 2602 2 * kPointerSize, | 2850 2 * kPointerSize, |
| 2603 1, | 2851 1, |
| 2604 9, | 2852 9, |
| 2605 { | 2853 { |
| 2606 B(LdaZero), // | 2854 B(LdaZero), // |
| 2607 B(Star), R(0), // | 2855 B(Star), R(0), // |
| 2608 B(LdaZero), // | 2856 B(LdaZero), // |
| 2609 B(Star), R(1), // | 2857 B(Star), R(1), // |
| 2610 B(Ldar), R(0), // | 2858 B(Ldar), R(0), // |
| 2611 B(Return), // | 2859 B(Return), // |
| 2612 }, | 2860 }, |
| 2613 0}, | 2861 0}, |
| 2614 {"var x = 0;" | 2862 {"var x = 0;" |
| 2615 "for (var i = 0; true; ++i) {" | 2863 "for (var i = 0; true; ++i) {" |
| 2616 " x = x + 1;" | 2864 " x = x + 1;" |
| 2617 " if (x == 20) break;" | 2865 " if (x == 20) break;" |
| 2618 "};" | 2866 "};" |
| 2619 "return x;", | 2867 "return x;", |
| 2620 2 * kPointerSize, | 2868 3 * kPointerSize, |
| 2621 1, | 2869 1, |
| 2622 31, | 2870 37, |
| 2623 { | 2871 { |
| 2624 B(LdaZero), // | 2872 B(LdaZero), // |
| 2625 B(Star), R(0), // | 2873 B(Star), R(0), // |
| 2626 B(LdaZero), // | 2874 B(LdaZero), // |
| 2627 B(Star), R(1), // | 2875 B(Star), R(1), // |
| 2876 B(Ldar), R(0), // |
| 2877 B(Star), R(2), // |
| 2628 B(LdaSmi8), U8(1), // | 2878 B(LdaSmi8), U8(1), // |
| 2629 B(Add), R(0), // | 2879 B(Add), R(2), // |
| 2630 B(Star), R(0), // | 2880 B(Star), R(0), // |
| 2881 B(Star), R(2), // |
| 2631 B(LdaSmi8), U8(20), // | 2882 B(LdaSmi8), U8(20), // |
| 2632 B(TestEqual), R(0), // | 2883 B(TestEqual), R(2), // |
| 2633 B(JumpIfFalse), U8(4), // | 2884 B(JumpIfFalse), U8(4), // |
| 2634 B(Jump), U8(10), // | 2885 B(Jump), U8(10), // |
| 2635 B(Ldar), R(1), // | 2886 B(Ldar), R(1), // |
| 2636 B(ToNumber), // | 2887 B(ToNumber), // |
| 2637 B(Inc), // | 2888 B(Inc), // |
| 2638 B(Star), R(1), // | 2889 B(Star), R(1), // |
| 2639 B(Jump), U8(-20), // | 2890 B(Jump), U8(-26), // |
| 2640 B(Ldar), R(0), // | 2891 B(Ldar), R(0), // |
| 2641 B(Return), // | 2892 B(Return), // |
| 2642 }, | 2893 }, |
| 2643 0}, | 2894 0}, |
| 2644 }; | 2895 }; |
| 2645 | 2896 |
| 2646 for (size_t i = 0; i < arraysize(snippets); i++) { | 2897 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 2647 Handle<BytecodeArray> bytecode_array = | 2898 Handle<BytecodeArray> bytecode_array = |
| 2648 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 2899 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 2649 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 2900 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 2650 } | 2901 } |
| 2651 } | 2902 } |
| 2652 | 2903 |
| 2653 | 2904 |
| 2654 TEST(JumpsRequiringConstantWideOperands) { | 2905 TEST(JumpsRequiringConstantWideOperands) { |
| 2655 InitializedHandleScope handle_scope; | 2906 InitializedHandleScope handle_scope; |
| 2656 BytecodeGeneratorHelper helper; | 2907 BytecodeGeneratorHelper helper; |
| 2657 | 2908 |
| 2658 int constant_count = 0; | 2909 int constant_count = 0; |
| 2659 ExpectedSnippet<Handle<Object>, 315> snippets[] = { | 2910 ExpectedSnippet<Handle<Object>, 316> snippets[] = { |
| 2660 { | 2911 { |
| 2661 REPEAT_256(SPACE, "var x = 0.1;") | 2912 REPEAT_256(SPACE, "var x = 0.1;") |
| 2662 REPEAT_32(SPACE, "var x = 0.2;") | 2913 REPEAT_32(SPACE, "var x = 0.2;") |
| 2663 REPEAT_16(SPACE, "var x = 0.3;") | 2914 REPEAT_16(SPACE, "var x = 0.3;") |
| 2664 REPEAT_8(SPACE, "var x = 0.4;") | 2915 REPEAT_8(SPACE, "var x = 0.4;") |
| 2665 "for (var i = 0; i < 3; i++) {\n" | 2916 "for (var i = 0; i < 3; i++) {\n" |
| 2666 " if (i == 1) continue;\n" | 2917 " if (i == 1) continue;\n" |
| 2667 " if (i == 2) break;\n" | 2918 " if (i == 2) break;\n" |
| 2668 "}\n" | 2919 "}\n" |
| 2669 "return 3;", | 2920 "return 3;", |
| 2670 kPointerSize * 3, | 2921 kPointerSize * 3, |
| 2671 1, | 2922 1, |
| 2672 1347, | 2923 1359, |
| 2673 { | 2924 { |
| 2674 #define L(c) B(LdaConstant), U8(c), B(Star), R(0) | 2925 #define L(c) B(LdaConstant), U8(c), B(Star), R(0) |
| 2675 REPEAT_256(COMMA, L(constant_count++)), | 2926 REPEAT_256(COMMA, L(constant_count++)), |
| 2676 #undef L | 2927 #undef L |
| 2677 #define LW(c) B(LdaConstantWide), U16I(c), B(Star), R(0) | 2928 #define LW(c) B(LdaConstantWide), U16I(c), B(Star), R(0) |
| 2678 REPEAT_32(COMMA, LW(constant_count)), | 2929 REPEAT_32(COMMA, LW(constant_count)), |
| 2679 REPEAT_16(COMMA, LW(constant_count)), | 2930 REPEAT_16(COMMA, LW(constant_count)), |
| 2680 REPEAT_8(COMMA, LW(constant_count)), | 2931 REPEAT_8(COMMA, LW(constant_count)), |
| 2681 #undef LW | 2932 #undef LW |
| 2682 B(LdaZero), // | 2933 B(LdaZero), // |
| 2683 B(Star), R(1), // | 2934 B(Star), R(1), // |
| 2935 B(Ldar), R(1), // |
| 2936 B(Star), R(2), // |
| 2684 B(LdaSmi8), U8(3), // | 2937 B(LdaSmi8), U8(3), // |
| 2685 B(TestLessThan), R(1), // | 2938 B(TestLessThan), R(2), // |
| 2686 B(JumpIfFalseConstantWide), U16(313), // | 2939 B(JumpIfFalseConstantWide), U16(313), // |
| 2940 B(Ldar), R(1), // |
| 2941 B(Star), R(2), // |
| 2687 B(LdaSmi8), U8(1), // | 2942 B(LdaSmi8), U8(1), // |
| 2688 B(TestEqual), R(1), // | 2943 B(TestEqual), R(2), // |
| 2689 B(JumpIfFalseConstantWide), U16(312), // | 2944 B(JumpIfFalseConstantWide), U16(312), // |
| 2690 B(JumpConstantWide), U16(314), // | 2945 B(JumpConstantWide), U16(315), // |
| 2946 B(Ldar), R(1), // |
| 2947 B(Star), R(2), // |
| 2691 B(LdaSmi8), U8(2), // | 2948 B(LdaSmi8), U8(2), // |
| 2692 B(TestEqual), R(1), // | 2949 B(TestEqual), R(2), // |
| 2693 B(JumpIfFalseConstantWide), U16(312), // | 2950 B(JumpIfFalseConstantWide), U16(312), // |
| 2694 B(JumpConstantWide), U16(314), // | 2951 B(JumpConstantWide), U16(314), // |
| 2695 B(Ldar), R(1), // | 2952 B(Ldar), R(1), // |
| 2696 B(ToNumber), // | 2953 B(ToNumber), // |
| 2697 B(Star), R(2), // | 2954 B(Star), R(2), // |
| 2698 B(Inc), // | 2955 B(Inc), // |
| 2699 B(Star), R(1), // | 2956 B(Star), R(1), // |
| 2700 B(Jump), U8(-35), // | 2957 B(Jump), U8(-47), // |
| 2701 B(LdaSmi8), U8(3), // | 2958 B(LdaSmi8), U8(3), // |
| 2702 B(Return) // | 2959 B(Return) // |
| 2703 }, | 2960 }, |
| 2704 315, | 2961 316, |
| 2705 { | 2962 { |
| 2706 #define S(x) CcTest::i_isolate()->factory()->NewNumber(x) | 2963 #define S(x) CcTest::i_isolate()->factory()->NewNumber(x) |
| 2707 REPEAT_256(COMMA, S(0.1)), | 2964 REPEAT_256(COMMA, S(0.1)), |
| 2708 REPEAT_32(COMMA, S(0.2)), | 2965 REPEAT_32(COMMA, S(0.2)), |
| 2709 REPEAT_16(COMMA, S(0.3)), | 2966 REPEAT_16(COMMA, S(0.3)), |
| 2710 REPEAT_8(COMMA, S(0.4)), | 2967 REPEAT_8(COMMA, S(0.4)), |
| 2711 #undef S | 2968 #undef S |
| 2712 #define N(x) CcTest::i_isolate()->factory()->NewNumberFromInt(x) | 2969 #define N(x) CcTest::i_isolate()->factory()->NewNumberFromInt(x) |
| 2713 N(6), N(33), N(13), | 2970 N(6), N(41), N(13), N(17) |
| 2714 #undef N | 2971 #undef N |
| 2715 }}}; | 2972 }}}; |
| 2716 | 2973 |
| 2717 for (size_t i = 0; i < arraysize(snippets); i++) { | 2974 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 2718 Handle<BytecodeArray> bytecode_array = | 2975 Handle<BytecodeArray> bytecode_array = |
| 2719 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 2976 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 2720 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 2977 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 2721 } | 2978 } |
| 2722 } | 2979 } |
| 2723 | 2980 |
| 2724 | 2981 |
| 2725 TEST(UnaryOperators) { | 2982 TEST(UnaryOperators) { |
| 2726 InitializedHandleScope handle_scope; | 2983 InitializedHandleScope handle_scope; |
| 2727 BytecodeGeneratorHelper helper; | 2984 BytecodeGeneratorHelper helper; |
| 2728 | 2985 |
| 2729 ExpectedSnippet<int> snippets[] = { | 2986 ExpectedSnippet<int> snippets[] = { |
| 2730 {"var x = 0;" | 2987 {"var x = 0;" |
| 2731 "while (x != 10) {" | 2988 "while (x != 10) {" |
| 2732 " x = x + 10;" | 2989 " x = x + 10;" |
| 2733 "}" | 2990 "}" |
| 2734 "return x;", | 2991 "return x;", |
| 2735 kPointerSize, | 2992 2 * kPointerSize, |
| 2736 1, | 2993 1, |
| 2737 21, | 2994 29, |
| 2738 { | 2995 { |
| 2739 B(LdaZero), // | 2996 B(LdaZero), // |
| 2740 B(Star), R(0), // | 2997 B(Star), R(0), // |
| 2998 B(Ldar), R(0), // |
| 2999 B(Star), R(1), // |
| 2741 B(LdaSmi8), U8(10), // | 3000 B(LdaSmi8), U8(10), // |
| 2742 B(TestEqual), R(0), // | 3001 B(TestEqual), R(1), // |
| 2743 B(LogicalNot), // | 3002 B(LogicalNot), // |
| 2744 B(JumpIfFalse), U8(10), // | 3003 B(JumpIfFalse), U8(14), // |
| 3004 B(Ldar), R(0), // |
| 3005 B(Star), R(1), // |
| 2745 B(LdaSmi8), U8(10), // | 3006 B(LdaSmi8), U8(10), // |
| 2746 B(Add), R(0), // | 3007 B(Add), R(1), // |
| 2747 B(Star), R(0), // | 3008 B(Star), R(0), // |
| 2748 B(Jump), U8(-13), // | 3009 B(Jump), U8(-21), // |
| 2749 B(Ldar), R(0), // | 3010 B(Ldar), R(0), // |
| 2750 B(Return), // | 3011 B(Return), // |
| 2751 }, | 3012 }, |
| 2752 0}, | 3013 0}, |
| 2753 {"var x = false;" | 3014 {"var x = false;" |
| 2754 "do {" | 3015 "do {" |
| 2755 " x = !x;" | 3016 " x = !x;" |
| 2756 "} while(x == false);" | 3017 "} while(x == false);" |
| 2757 "return x;", | 3018 "return x;", |
| 2758 kPointerSize, | 3019 2 * kPointerSize, |
| 2759 1, | 3020 1, |
| 2760 16, | 3021 20, |
| 2761 { | 3022 { |
| 2762 B(LdaFalse), // | 3023 B(LdaFalse), // |
| 2763 B(Star), R(0), // | 3024 B(Star), R(0), // |
| 2764 B(Ldar), R(0), // | 3025 B(Ldar), R(0), // |
| 2765 B(LogicalNot), // | 3026 B(LogicalNot), // |
| 2766 B(Star), R(0), // | 3027 B(Star), R(0), // |
| 3028 B(Ldar), R(0), // |
| 3029 B(Star), R(1), // |
| 2767 B(LdaFalse), // | 3030 B(LdaFalse), // |
| 2768 B(TestEqual), R(0), // | 3031 B(TestEqual), R(1), // |
| 2769 B(JumpIfTrue), U8(-8), // | 3032 B(JumpIfTrue), U8(-12), // |
| 2770 B(Ldar), R(0), // | 3033 B(Ldar), R(0), // |
| 2771 B(Return), // | 3034 B(Return), // |
| 2772 }, | 3035 }, |
| 2773 0}, | 3036 0}, |
| 2774 {"var x = 101;" | 3037 {"var x = 101;" |
| 2775 "return void(x * 3);", | 3038 "return void(x * 3);", |
| 2776 kPointerSize, | 3039 2 * kPointerSize, |
| 2777 1, | 3040 1, |
| 2778 10, | 3041 12, |
| 2779 { | 3042 { |
| 2780 B(LdaSmi8), U8(101), // | 3043 B(LdaSmi8), U8(101), // |
| 2781 B(Star), R(0), // | 3044 B(Star), R(0), // |
| 3045 B(Star), R(1), // |
| 2782 B(LdaSmi8), U8(3), // | 3046 B(LdaSmi8), U8(3), // |
| 2783 B(Mul), R(0), // | 3047 B(Mul), R(1), // |
| 2784 B(LdaUndefined), // | 3048 B(LdaUndefined), // |
| 2785 B(Return), // | 3049 B(Return), // |
| 2786 }, | 3050 }, |
| 2787 0}, | 3051 0}, |
| 2788 {"var x = 1234;" | 3052 {"var x = 1234;" |
| 2789 "var y = void (x * x - 1);" | 3053 "var y = void (x * x - 1);" |
| 2790 "return y;", | 3054 "return y;", |
| 2791 3 * kPointerSize, | 3055 4 * kPointerSize, |
| 2792 1, | 3056 1, |
| 2793 16, | 3057 20, |
| 2794 { | 3058 { |
| 2795 B(LdaConstant), U8(0), // | 3059 B(LdaConstant), U8(0), // |
| 2796 B(Star), R(0), // | 3060 B(Star), R(0), // |
| 2797 B(Mul), R(0), // | |
| 2798 B(Star), R(2), // | 3061 B(Star), R(2), // |
| 3062 B(Ldar), R(0), // |
| 3063 B(Mul), R(2), // |
| 3064 B(Star), R(3), // |
| 2799 B(LdaSmi8), U8(1), // | 3065 B(LdaSmi8), U8(1), // |
| 2800 B(Sub), R(2), // | 3066 B(Sub), R(3), // |
| 2801 B(LdaUndefined), // | 3067 B(LdaUndefined), // |
| 2802 B(Star), R(1), // | 3068 B(Star), R(1), // |
| 2803 B(Return), // | 3069 B(Return), // |
| 2804 }, | 3070 }, |
| 2805 1, | 3071 1, |
| 2806 {1234}}, | 3072 {1234}}, |
| 2807 {"var x = 13;" | 3073 {"var x = 13;" |
| 2808 "return ~x;", | 3074 "return ~x;", |
| 2809 1 * kPointerSize, | 3075 2 * kPointerSize, |
| 2810 1, | 3076 1, |
| 2811 9, | 3077 11, |
| 2812 { | 3078 { |
| 2813 B(LdaSmi8), U8(13), // | 3079 B(LdaSmi8), U8(13), // |
| 2814 B(Star), R(0), // | 3080 B(Star), R(0), // |
| 3081 B(Star), R(1), // |
| 2815 B(LdaSmi8), U8(-1), // | 3082 B(LdaSmi8), U8(-1), // |
| 2816 B(BitwiseXor), R(0), // | 3083 B(BitwiseXor), R(1), // |
| 2817 B(Return), // | 3084 B(Return), // |
| 2818 }, | 3085 }, |
| 2819 0}, | 3086 0}, |
| 2820 {"var x = 13;" | 3087 {"var x = 13;" |
| 2821 "return +x;", | 3088 "return +x;", |
| 2822 1 * kPointerSize, | 3089 2 * kPointerSize, |
| 2823 1, | 3090 1, |
| 2824 9, | 3091 11, |
| 2825 { | 3092 { |
| 2826 B(LdaSmi8), U8(13), // | 3093 B(LdaSmi8), U8(13), // |
| 2827 B(Star), R(0), // | 3094 B(Star), R(0), // |
| 3095 B(Star), R(1), // |
| 2828 B(LdaSmi8), U8(1), // | 3096 B(LdaSmi8), U8(1), // |
| 2829 B(Mul), R(0), // | 3097 B(Mul), R(1), // |
| 2830 B(Return), // | 3098 B(Return), // |
| 2831 }, | 3099 }, |
| 2832 0}, | 3100 0}, |
| 2833 {"var x = 13;" | 3101 {"var x = 13;" |
| 2834 "return -x;", | 3102 "return -x;", |
| 2835 1 * kPointerSize, | 3103 2 * kPointerSize, |
| 2836 1, | 3104 1, |
| 2837 9, | 3105 11, |
| 2838 { | 3106 { |
| 2839 B(LdaSmi8), U8(13), // | 3107 B(LdaSmi8), U8(13), // |
| 2840 B(Star), R(0), // | 3108 B(Star), R(0), // |
| 3109 B(Star), R(1), // |
| 2841 B(LdaSmi8), U8(-1), // | 3110 B(LdaSmi8), U8(-1), // |
| 2842 B(Mul), R(0), // | 3111 B(Mul), R(1), // |
| 2843 B(Return), // | 3112 B(Return), // |
| 2844 }, | 3113 }, |
| 2845 0}}; | 3114 0}}; |
| 2846 | 3115 |
| 2847 for (size_t i = 0; i < arraysize(snippets); i++) { | 3116 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 2848 Handle<BytecodeArray> bytecode_array = | 3117 Handle<BytecodeArray> bytecode_array = |
| 2849 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 3118 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 2850 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 3119 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 2851 } | 3120 } |
| 2852 } | 3121 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 InitializedHandleScope handle_scope; | 3191 InitializedHandleScope handle_scope; |
| 2923 BytecodeGeneratorHelper helper; | 3192 BytecodeGeneratorHelper helper; |
| 2924 | 3193 |
| 2925 int deep_elements_flags = | 3194 int deep_elements_flags = |
| 2926 ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos; | 3195 ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos; |
| 2927 int closure = Register::function_closure().index(); | 3196 int closure = Register::function_closure().index(); |
| 2928 int first_context_slot = Context::MIN_CONTEXT_SLOTS; | 3197 int first_context_slot = Context::MIN_CONTEXT_SLOTS; |
| 2929 | 3198 |
| 2930 ExpectedSnippet<InstanceType> snippets[] = { | 3199 ExpectedSnippet<InstanceType> snippets[] = { |
| 2931 {"var a = {x:13, y:14}; return delete a.x;", | 3200 {"var a = {x:13, y:14}; return delete a.x;", |
| 2932 1 * kPointerSize, | 3201 2 * kPointerSize, |
| 2933 1, | 3202 1, |
| 2934 11, | 3203 13, |
| 2935 { | 3204 { |
| 2936 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // | 3205 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
| 2937 B(Star), R(0), // | 3206 B(Star), R(0), // |
| 3207 B(Star), R(1), // |
| 2938 B(LdaConstant), U8(1), // | 3208 B(LdaConstant), U8(1), // |
| 2939 B(DeletePropertySloppy), R(0), // | 3209 B(DeletePropertySloppy), R(1), // |
| 2940 B(Return) | 3210 B(Return) |
| 2941 }, | 3211 }, |
| 2942 2, | 3212 2, |
| 2943 {InstanceType::FIXED_ARRAY_TYPE, | 3213 {InstanceType::FIXED_ARRAY_TYPE, |
| 2944 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 3214 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 2945 {"'use strict'; var a = {x:13, y:14}; return delete a.x;", | 3215 {"'use strict'; var a = {x:13, y:14}; return delete a.x;", |
| 2946 1 * kPointerSize, | 3216 2 * kPointerSize, |
| 2947 1, | 3217 1, |
| 2948 11, | 3218 13, |
| 2949 { | 3219 { |
| 2950 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // | 3220 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
| 2951 B(Star), R(0), // | 3221 B(Star), R(0), // |
| 3222 B(Star), R(1), // |
| 2952 B(LdaConstant), U8(1), // | 3223 B(LdaConstant), U8(1), // |
| 2953 B(DeletePropertyStrict), R(0), // | 3224 B(DeletePropertyStrict), R(1), // |
| 2954 B(Return) | 3225 B(Return) |
| 2955 }, | 3226 }, |
| 2956 2, | 3227 2, |
| 2957 {InstanceType::FIXED_ARRAY_TYPE, | 3228 {InstanceType::FIXED_ARRAY_TYPE, |
| 2958 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 3229 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 2959 {"var a = {1:13, 2:14}; return delete a[2];", | 3230 {"var a = {1:13, 2:14}; return delete a[2];", |
| 2960 1 * kPointerSize, | 3231 2 * kPointerSize, |
| 2961 1, | 3232 1, |
| 2962 11, | 3233 13, |
| 2963 { | 3234 { |
| 2964 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // | 3235 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
| 2965 B(Star), R(0), // | 3236 B(Star), R(0), // |
| 3237 B(Star), R(1), // |
| 2966 B(LdaSmi8), U8(2), // | 3238 B(LdaSmi8), U8(2), // |
| 2967 B(DeletePropertySloppy), R(0), // | 3239 B(DeletePropertySloppy), R(1), // |
| 2968 B(Return) | 3240 B(Return) |
| 2969 }, | 3241 }, |
| 2970 1, | 3242 1, |
| 2971 {InstanceType::FIXED_ARRAY_TYPE}}, | 3243 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 2972 {"var a = 10; return delete a;", | 3244 {"var a = 10; return delete a;", |
| 2973 1 * kPointerSize, | 3245 1 * kPointerSize, |
| 2974 1, | 3246 1, |
| 2975 6, | 3247 6, |
| 2976 { | 3248 { |
| 2977 B(LdaSmi8), U8(10), // | 3249 B(LdaSmi8), U8(10), // |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3271 0, | 3543 0, |
| 3272 1, | 3544 1, |
| 3273 5, | 3545 5, |
| 3274 { | 3546 { |
| 3275 B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // | 3547 B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // |
| 3276 B(Return) // | 3548 B(Return) // |
| 3277 }, | 3549 }, |
| 3278 1, | 3550 1, |
| 3279 {InstanceType::FIXED_ARRAY_TYPE}}, | 3551 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 3280 {"var a = 1; return [ a, a + 1 ];", | 3552 {"var a = 1; return [ a, a + 1 ];", |
| 3281 3 * kPointerSize, | 3553 4 * kPointerSize, |
| 3282 1, | 3554 1, |
| 3283 34, | 3555 38, |
| 3284 { | 3556 { |
| 3285 B(LdaSmi8), U8(1), // | 3557 B(LdaSmi8), U8(1), // |
| 3286 B(Star), R(0), // | 3558 B(Star), R(0), // |
| 3287 B(CreateArrayLiteral), U8(0), U8(0), U8(3), // | 3559 B(CreateArrayLiteral), U8(0), U8(0), U8(3), // |
| 3288 B(Star), R(2), // | 3560 B(Star), R(2), // |
| 3289 B(LdaZero), // | 3561 B(LdaZero), // |
| 3290 B(Star), R(1), // | 3562 B(Star), R(1), // |
| 3291 B(Ldar), R(0), // | 3563 B(Ldar), R(0), // |
| 3292 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), // | 3564 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), // |
| 3293 B(LdaSmi8), U8(1), // | 3565 B(LdaSmi8), U8(1), // |
| 3294 B(Star), R(1), // | 3566 B(Star), R(1), // |
| 3567 B(Ldar), R(0), // |
| 3568 B(Star), R(3), // |
| 3295 B(LdaSmi8), U8(1), // | 3569 B(LdaSmi8), U8(1), // |
| 3296 B(Add), R(0), // | 3570 B(Add), R(3), // |
| 3297 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), // | 3571 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), // |
| 3298 B(Ldar), R(2), // | 3572 B(Ldar), R(2), // |
| 3299 B(Return), // | 3573 B(Return), // |
| 3300 }, | 3574 }, |
| 3301 1, | 3575 1, |
| 3302 {InstanceType::FIXED_ARRAY_TYPE}}, | 3576 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 3303 {"return [ [ 1, 2 ], [ 3 ] ];", | 3577 {"return [ [ 1, 2 ], [ 3 ] ];", |
| 3304 0, | 3578 0, |
| 3305 1, | 3579 1, |
| 3306 5, | 3580 5, |
| 3307 { | 3581 { |
| 3308 B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), // | 3582 B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), // |
| 3309 B(Return) // | 3583 B(Return) // |
| 3310 }, | 3584 }, |
| 3311 1, | 3585 1, |
| 3312 {InstanceType::FIXED_ARRAY_TYPE}}, | 3586 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 3313 {"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];", | 3587 {"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];", |
| 3314 5 * kPointerSize, | 3588 6 * kPointerSize, |
| 3315 1, | 3589 1, |
| 3316 64, | 3590 68, |
| 3317 { | 3591 { |
| 3318 B(LdaSmi8), U8(1), // | 3592 B(LdaSmi8), U8(1), // |
| 3319 B(Star), R(0), // | 3593 B(Star), R(0), // |
| 3320 B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), // | 3594 B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), // |
| 3321 B(Star), R(2), // | 3595 B(Star), R(2), // |
| 3322 B(LdaZero), // | 3596 B(LdaZero), // |
| 3323 B(Star), R(1), // | 3597 B(Star), R(1), // |
| 3324 B(CreateArrayLiteral), U8(1), U8(0), U8(simple_flags), // | 3598 B(CreateArrayLiteral), U8(1), U8(0), U8(simple_flags), // |
| 3325 B(Star), R(4), // | 3599 B(Star), R(4), // |
| 3326 B(LdaZero), // | 3600 B(LdaZero), // |
| 3327 B(Star), R(3), // | 3601 B(Star), R(3), // |
| 3328 B(Ldar), R(0), // | 3602 B(Ldar), R(0), // |
| 3329 B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot1)), // | 3603 B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot1)), // |
| 3330 B(Ldar), R(4), // | 3604 B(Ldar), R(4), // |
| 3331 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), // | 3605 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), // |
| 3332 B(LdaSmi8), U8(1), // | 3606 B(LdaSmi8), U8(1), // |
| 3333 B(Star), R(1), // | 3607 B(Star), R(1), // |
| 3334 B(CreateArrayLiteral), U8(2), U8(1), U8(simple_flags), // | 3608 B(CreateArrayLiteral), U8(2), U8(1), U8(simple_flags), // |
| 3335 B(Star), R(4), // | 3609 B(Star), R(4), // |
| 3336 B(LdaZero), // | 3610 B(LdaZero), // |
| 3337 B(Star), R(3), // | 3611 B(Star), R(3), // |
| 3612 B(Ldar), R(0), // |
| 3613 B(Star), R(5), // |
| 3338 B(LdaSmi8), U8(2), // | 3614 B(LdaSmi8), U8(2), // |
| 3339 B(Add), R(0), // | 3615 B(Add), R(5), // |
| 3340 B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot2)), // | 3616 B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot2)), // |
| 3341 B(Ldar), R(4), // | 3617 B(Ldar), R(4), // |
| 3342 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), // | 3618 B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), // |
| 3343 B(Ldar), R(2), // | 3619 B(Ldar), R(2), // |
| 3344 B(Return), // | 3620 B(Return), // |
| 3345 }, | 3621 }, |
| 3346 3, | 3622 3, |
| 3347 {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE, | 3623 {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE, |
| 3348 InstanceType::FIXED_ARRAY_TYPE}}, | 3624 InstanceType::FIXED_ARRAY_TYPE}}, |
| 3349 }; | 3625 }; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3438 B(Star), R(1), // | 3714 B(Star), R(1), // |
| 3439 B(Ldar), R(0), // | 3715 B(Ldar), R(0), // |
| 3440 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // | 3716 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 3441 B(Ldar), R(1), // | 3717 B(Ldar), R(1), // |
| 3442 B(Return), // | 3718 B(Return), // |
| 3443 }, | 3719 }, |
| 3444 2, | 3720 2, |
| 3445 {InstanceType::FIXED_ARRAY_TYPE, | 3721 {InstanceType::FIXED_ARRAY_TYPE, |
| 3446 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 3722 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 3447 {"var a = 1; return { val: a, val: a + 1 };", | 3723 {"var a = 1; return { val: a, val: a + 1 };", |
| 3448 2 * kPointerSize, | 3724 3 * kPointerSize, |
| 3449 1, | 3725 1, |
| 3450 21, | 3726 25, |
| 3451 { | 3727 { |
| 3452 B(LdaSmi8), U8(1), // | 3728 B(LdaSmi8), U8(1), // |
| 3453 B(Star), R(0), // | 3729 B(Star), R(0), // |
| 3454 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // | 3730 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
| 3455 B(Star), R(1), // | 3731 B(Star), R(1), // |
| 3732 B(Ldar), R(0), // |
| 3733 B(Star), R(2), // |
| 3456 B(LdaSmi8), U8(1), // | 3734 B(LdaSmi8), U8(1), // |
| 3457 B(Add), R(0), // | 3735 B(Add), R(2), // |
| 3458 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // | 3736 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 3459 B(Ldar), R(1), // | 3737 B(Ldar), R(1), // |
| 3460 B(Return), // | 3738 B(Return), // |
| 3461 }, | 3739 }, |
| 3462 2, | 3740 2, |
| 3463 {InstanceType::FIXED_ARRAY_TYPE, | 3741 {InstanceType::FIXED_ARRAY_TYPE, |
| 3464 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 3742 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 3465 {"return { func: function() { } };", | 3743 {"return { func: function() { } };", |
| 3466 1 * kPointerSize, | 3744 1 * kPointerSize, |
| 3467 1, | 3745 1, |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4391 B(LdaSmi8), U8(1), // | 4669 B(LdaSmi8), U8(1), // |
| 4392 B(Star), R(0), // | 4670 B(Star), R(0), // |
| 4393 B(ToNumber), // | 4671 B(ToNumber), // |
| 4394 B(Star), R(1), // | 4672 B(Star), R(1), // |
| 4395 B(Dec), // | 4673 B(Dec), // |
| 4396 B(Star), R(0), // | 4674 B(Star), R(0), // |
| 4397 B(Ldar), R(1), // | 4675 B(Ldar), R(1), // |
| 4398 B(Return), // | 4676 B(Return), // |
| 4399 }}, | 4677 }}, |
| 4400 {"var a = { val: 1 }; return a.val++;", | 4678 {"var a = { val: 1 }; return a.val++;", |
| 4401 2 * kPointerSize, | 4679 3 * kPointerSize, |
| 4402 1, | 4680 1, |
| 4403 21, | 4681 23, |
| 4404 { | 4682 { |
| 4405 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // | 4683 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // |
| 4406 B(Star), R(0), // | 4684 B(Star), R(0), // |
| 4407 B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), // | 4685 B(Star), R(1), // |
| 4686 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 4408 B(ToNumber), // | 4687 B(ToNumber), // |
| 4409 B(Star), R(1), // | 4688 B(Star), R(2), // |
| 4410 B(Inc), // | 4689 B(Inc), // |
| 4411 B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), // | 4690 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // |
| 4412 B(Ldar), R(1), // | 4691 B(Ldar), R(2), // |
| 4413 B(Return), // | 4692 B(Return), // |
| 4414 }, | 4693 }, |
| 4415 2, | 4694 2, |
| 4416 {InstanceType::FIXED_ARRAY_TYPE, | 4695 {InstanceType::FIXED_ARRAY_TYPE, |
| 4417 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 4696 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 4418 {"var a = { val: 1 }; return --a.val;", | 4697 {"var a = { val: 1 }; return --a.val;", |
| 4419 1 * kPointerSize, | 4698 2 * kPointerSize, |
| 4420 1, | 4699 1, |
| 4421 17, | 4700 19, |
| 4422 { | 4701 { |
| 4423 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // | 4702 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // |
| 4424 B(Star), R(0), // | 4703 B(Star), R(0), // |
| 4425 B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), // | 4704 B(Star), R(1), // |
| 4705 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 4426 B(ToNumber), // | 4706 B(ToNumber), // |
| 4427 B(Dec), // | 4707 B(Dec), // |
| 4428 B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), // | 4708 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // |
| 4429 B(Return), // | 4709 B(Return), // |
| 4430 }, | 4710 }, |
| 4431 2, | 4711 2, |
| 4432 {InstanceType::FIXED_ARRAY_TYPE, | 4712 {InstanceType::FIXED_ARRAY_TYPE, |
| 4433 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 4713 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 4434 {"var name = 'var'; var a = { val: 1 }; return a[name]--;", | 4714 {"var name = 'var'; var a = { val: 1 }; return a[name]--;", |
| 4435 4 * kPointerSize, | 4715 5 * kPointerSize, |
| 4436 1, | 4716 1, |
| 4437 28, | 4717 30, |
| 4438 { | 4718 { |
| 4439 B(LdaConstant), U8(0), // | 4719 B(LdaConstant), U8(0), // |
| 4440 B(Star), R(0), // | 4720 B(Star), R(0), // |
| 4441 B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), // | 4721 B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), // |
| 4442 B(Star), R(1), // | 4722 B(Star), R(1), // |
| 4723 B(Star), R(2), // |
| 4443 B(Ldar), R(0), // | 4724 B(Ldar), R(0), // |
| 4444 B(Star), R(2), // | 4725 B(Star), R(3), // |
| 4445 B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot1)), // | 4726 B(KeyedLoadICSloppy), R(2), U8(vector->GetIndex(slot1)), // |
| 4446 B(ToNumber), // | 4727 B(ToNumber), // |
| 4447 B(Star), R(3), // | 4728 B(Star), R(4), // |
| 4448 B(Dec), // | 4729 B(Dec), // |
| 4449 B(KeyedStoreICSloppy), R(1), R(2), U8(vector->GetIndex(slot2)), // | 4730 B(KeyedStoreICSloppy), R(2), R(3), U8(vector->GetIndex(slot2)), // |
| 4450 B(Ldar), R(3), // | 4731 B(Ldar), R(4), // |
| 4451 B(Return), // | 4732 B(Return), // |
| 4452 }, | 4733 }, |
| 4453 2, | 4734 2, |
| 4454 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 4735 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
| 4455 InstanceType::FIXED_ARRAY_TYPE}}, | 4736 InstanceType::FIXED_ARRAY_TYPE}}, |
| 4456 {"var name = 'var'; var a = { val: 1 }; return ++a[name];", | 4737 {"var name = 'var'; var a = { val: 1 }; return ++a[name];", |
| 4457 3 * kPointerSize, | 4738 4 * kPointerSize, |
| 4458 1, | 4739 1, |
| 4459 24, | 4740 26, |
| 4460 { | 4741 { |
| 4461 B(LdaConstant), U8(0), // | 4742 B(LdaConstant), U8(0), // |
| 4462 B(Star), R(0), // | 4743 B(Star), R(0), // |
| 4463 B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), // | 4744 B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), // |
| 4464 B(Star), R(1), // | 4745 B(Star), R(1), // |
| 4746 B(Star), R(2), // |
| 4465 B(Ldar), R(0), // | 4747 B(Ldar), R(0), // |
| 4466 B(Star), R(2), // | 4748 B(Star), R(3), // |
| 4467 B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot1)), // | 4749 B(KeyedLoadICSloppy), R(2), U8(vector->GetIndex(slot1)), // |
| 4468 B(ToNumber), // | 4750 B(ToNumber), // |
| 4469 B(Inc), // | 4751 B(Inc), // |
| 4470 B(KeyedStoreICSloppy), R(1), R(2), U8(vector->GetIndex(slot2)), // | 4752 B(KeyedStoreICSloppy), R(2), R(3), U8(vector->GetIndex(slot2)), // |
| 4471 B(Return), // | 4753 B(Return), // |
| 4472 }, | 4754 }, |
| 4473 2, | 4755 2, |
| 4474 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 4756 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
| 4475 InstanceType::FIXED_ARRAY_TYPE}}, | 4757 InstanceType::FIXED_ARRAY_TYPE}}, |
| 4476 {"var a = 1; var b = function() { return a }; return ++a;", | 4758 {"var a = 1; var b = function() { return a }; return ++a;", |
| 4477 2 * kPointerSize, | 4759 2 * kPointerSize, |
| 4478 1, | 4760 1, |
| 4479 26, | 4761 26, |
| 4480 { | 4762 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4509 B(ToNumber), // | 4791 B(ToNumber), // |
| 4510 B(Star), R(2), // | 4792 B(Star), R(2), // |
| 4511 B(Dec), // | 4793 B(Dec), // |
| 4512 B(StaContextSlot), R(1), U8(first_context_slot), // | 4794 B(StaContextSlot), R(1), U8(first_context_slot), // |
| 4513 B(Ldar), R(2), // | 4795 B(Ldar), R(2), // |
| 4514 B(Return), // | 4796 B(Return), // |
| 4515 }, | 4797 }, |
| 4516 1, | 4798 1, |
| 4517 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 4799 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 4518 {"var idx = 1; var a = [1, 2]; return a[idx++] = 2;", | 4800 {"var idx = 1; var a = [1, 2]; return a[idx++] = 2;", |
| 4519 3 * kPointerSize, | 4801 4 * kPointerSize, |
| 4520 1, | 4802 1, |
| 4521 25, | 4803 27, |
| 4522 { | 4804 { |
| 4523 B(LdaSmi8), U8(1), // | 4805 B(LdaSmi8), U8(1), // |
| 4524 B(Star), R(0), // | 4806 B(Star), R(0), // |
| 4525 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // | 4807 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // |
| 4526 B(Star), R(1), // | 4808 B(Star), R(1), // |
| 4809 B(Star), R(2), // |
| 4527 B(Ldar), R(0), // | 4810 B(Ldar), R(0), // |
| 4528 B(ToNumber), // | 4811 B(ToNumber), // |
| 4529 B(Star), R(2), // | 4812 B(Star), R(3), // |
| 4530 B(Inc), // | 4813 B(Inc), // |
| 4531 B(Star), R(0), // | 4814 B(Star), R(0), // |
| 4532 B(LdaSmi8), U8(2), // | 4815 B(LdaSmi8), U8(2), // |
| 4533 B(KeyedStoreICSloppy), R(1), R(2), // | 4816 B(KeyedStoreICSloppy), R(2), R(3), // |
| 4534 U8(store_vector->GetIndex(store_slot)), // | 4817 U8(store_vector->GetIndex(store_slot)), // |
| 4535 B(Return), // | 4818 B(Return), // |
| 4536 }, | 4819 }, |
| 4537 1, | 4820 1, |
| 4538 {InstanceType::FIXED_ARRAY_TYPE}}, | 4821 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 4539 }; | 4822 }; |
| 4540 | 4823 |
| 4541 for (size_t i = 0; i < arraysize(snippets); i++) { | 4824 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 4542 Handle<BytecodeArray> bytecode_array = | 4825 Handle<BytecodeArray> bytecode_array = |
| 4543 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 4826 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4638 FeedbackVectorSlot slot1 = feedback_spec.AddLoadICSlot(); | 4921 FeedbackVectorSlot slot1 = feedback_spec.AddLoadICSlot(); |
| 4639 FeedbackVectorSlot slot2 = feedback_spec.AddStoreICSlot(); | 4922 FeedbackVectorSlot slot2 = feedback_spec.AddStoreICSlot(); |
| 4640 | 4923 |
| 4641 Handle<i::TypeFeedbackVector> vector = | 4924 Handle<i::TypeFeedbackVector> vector = |
| 4642 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | 4925 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); |
| 4643 | 4926 |
| 4644 int object_literal_flags = | 4927 int object_literal_flags = |
| 4645 ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos; | 4928 ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos; |
| 4646 ExpectedSnippet<InstanceType> snippets[] = { | 4929 ExpectedSnippet<InstanceType> snippets[] = { |
| 4647 {"var a = 1; a += 2;", | 4930 {"var a = 1; a += 2;", |
| 4648 1 * kPointerSize, | 4931 2 * kPointerSize, |
| 4649 1, | 4932 1, |
| 4650 12, | 4933 14, |
| 4651 { | 4934 { |
| 4652 B(LdaSmi8), U8(1), // | 4935 B(LdaSmi8), U8(1), // |
| 4653 B(Star), R(0), // | 4936 B(Star), R(0), // |
| 4937 B(Star), R(1), // |
| 4654 B(LdaSmi8), U8(2), // | 4938 B(LdaSmi8), U8(2), // |
| 4655 B(Add), R(0), // | 4939 B(Add), R(1), // |
| 4656 B(Star), R(0), // | 4940 B(Star), R(0), // |
| 4657 B(LdaUndefined), // | 4941 B(LdaUndefined), // |
| 4658 B(Return), // | 4942 B(Return), // |
| 4659 }}, | 4943 }}, |
| 4660 {"var a = 1; a /= 2;", | 4944 {"var a = 1; a /= 2;", |
| 4661 1 * kPointerSize, | 4945 2 * kPointerSize, |
| 4662 1, | 4946 1, |
| 4663 12, | 4947 14, |
| 4664 { | 4948 { |
| 4665 B(LdaSmi8), U8(1), // | 4949 B(LdaSmi8), U8(1), // |
| 4666 B(Star), R(0), // | 4950 B(Star), R(0), // |
| 4951 B(Star), R(1), // |
| 4667 B(LdaSmi8), U8(2), // | 4952 B(LdaSmi8), U8(2), // |
| 4668 B(Div), R(0), // | 4953 B(Div), R(1), // |
| 4669 B(Star), R(0), // | 4954 B(Star), R(0), // |
| 4670 B(LdaUndefined), // | 4955 B(LdaUndefined), // |
| 4671 B(Return), // | 4956 B(Return), // |
| 4672 }}, | 4957 }}, |
| 4673 {"var a = { val: 2 }; a.name *= 2;", | 4958 {"var a = { val: 2 }; a.name *= 2;", |
| 4674 2 * kPointerSize, | 4959 3 * kPointerSize, |
| 4675 1, | 4960 1, |
| 4676 22, | 4961 24, |
| 4677 { | 4962 { |
| 4678 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // | 4963 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // |
| 4679 B(Star), R(0), // | 4964 B(Star), R(0), // |
| 4680 B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), // | |
| 4681 B(Star), R(1), // | 4965 B(Star), R(1), // |
| 4966 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 4967 B(Star), R(2), // |
| 4682 B(LdaSmi8), U8(2), // | 4968 B(LdaSmi8), U8(2), // |
| 4683 B(Mul), R(1), // | 4969 B(Mul), R(2), // |
| 4684 B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), // | 4970 B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // |
| 4685 B(LdaUndefined), // | 4971 B(LdaUndefined), // |
| 4686 B(Return), // | 4972 B(Return), // |
| 4687 }, | 4973 }, |
| 4688 2, | 4974 2, |
| 4689 {InstanceType::FIXED_ARRAY_TYPE, | 4975 {InstanceType::FIXED_ARRAY_TYPE, |
| 4690 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 4976 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 4691 {"var a = { 1: 2 }; a[1] ^= 2;", | 4977 {"var a = { 1: 2 }; a[1] ^= 2;", |
| 4692 3 * kPointerSize, | 4978 4 * kPointerSize, |
| 4693 1, | 4979 1, |
| 4694 25, | 4980 27, |
| 4695 { | 4981 { |
| 4696 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // | 4982 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // |
| 4697 B(Star), R(0), // | 4983 B(Star), R(0), // |
| 4984 B(Star), R(1), // |
| 4698 B(LdaSmi8), U8(1), // | 4985 B(LdaSmi8), U8(1), // |
| 4699 B(Star), R(1), // | |
| 4700 B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot1)), // | |
| 4701 B(Star), R(2), // | 4986 B(Star), R(2), // |
| 4987 B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot1)), // |
| 4988 B(Star), R(3), // |
| 4702 B(LdaSmi8), U8(2), // | 4989 B(LdaSmi8), U8(2), // |
| 4703 B(BitwiseXor), R(2), // | 4990 B(BitwiseXor), R(3), // |
| 4704 B(KeyedStoreICSloppy), R(0), R(1), U8(vector->GetIndex(slot2)), // | 4991 B(KeyedStoreICSloppy), R(1), R(2), U8(vector->GetIndex(slot2)), // |
| 4705 B(LdaUndefined), // | 4992 B(LdaUndefined), // |
| 4706 B(Return), // | 4993 B(Return), // |
| 4707 }, | 4994 }, |
| 4708 1, | 4995 1, |
| 4709 {InstanceType::FIXED_ARRAY_TYPE}}, | 4996 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 4710 {"var a = 1; (function f() { return a; }); a |= 24;", | 4997 {"var a = 1; (function f() { return a; }); a |= 24;", |
| 4711 2 * kPointerSize, | 4998 2 * kPointerSize, |
| 4712 1, | 4999 1, |
| 4713 29, | 5000 29, |
| 4714 { | 5001 { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4807 {"function f() { return arguments; }", | 5094 {"function f() { return arguments; }", |
| 4808 1 * kPointerSize, | 5095 1 * kPointerSize, |
| 4809 1, | 5096 1, |
| 4810 4, | 5097 4, |
| 4811 { | 5098 { |
| 4812 B(CreateMappedArguments), // | 5099 B(CreateMappedArguments), // |
| 4813 B(Star), R(0), // | 5100 B(Star), R(0), // |
| 4814 B(Return), // | 5101 B(Return), // |
| 4815 }}, | 5102 }}, |
| 4816 {"function f() { return arguments[0]; }", | 5103 {"function f() { return arguments[0]; }", |
| 4817 1 * kPointerSize, | 5104 2 * kPointerSize, |
| 4818 1, | 5105 1, |
| 4819 8, | 5106 10, |
| 4820 { | 5107 { |
| 4821 B(CreateMappedArguments), // | 5108 B(CreateMappedArguments), // |
| 4822 B(Star), R(0), // | 5109 B(Star), R(0), // |
| 5110 B(Star), R(1), // |
| 4823 B(LdaZero), // | 5111 B(LdaZero), // |
| 4824 B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot)), // | 5112 B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot)), // |
| 4825 B(Return), // | 5113 B(Return), // |
| 4826 }}, | 5114 }}, |
| 4827 {"function f() { 'use strict'; return arguments; }", | 5115 {"function f() { 'use strict'; return arguments; }", |
| 4828 1 * kPointerSize, | 5116 1 * kPointerSize, |
| 4829 1, | 5117 1, |
| 4830 4, | 5118 4, |
| 4831 { | 5119 { |
| 4832 B(CreateUnmappedArguments), // | 5120 B(CreateUnmappedArguments), // |
| 4833 B(Star), R(0), // | 5121 B(Star), R(0), // |
| 4834 B(Return), // | 5122 B(Return), // |
| 4835 }}, | 5123 }}, |
| 4836 {"function f(a) { return arguments[0]; }", | 5124 {"function f(a) { return arguments[0]; }", |
| 4837 2 * kPointerSize, | 5125 3 * kPointerSize, |
| 4838 2, | 5126 2, |
| 4839 20, | 5127 22, |
| 4840 { | 5128 { |
| 4841 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 5129 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 4842 U8(1), // | 5130 U8(1), // |
| 4843 B(PushContext), R(1), // | 5131 B(PushContext), R(1), // |
| 4844 B(Ldar), R(BytecodeGeneratorHelper::kLastParamIndex), // | 5132 B(Ldar), R(BytecodeGeneratorHelper::kLastParamIndex), // |
| 4845 B(StaContextSlot), R(1), U8(first_context_slot), // | 5133 B(StaContextSlot), R(1), U8(first_context_slot), // |
| 4846 B(CreateMappedArguments), // | 5134 B(CreateMappedArguments), // |
| 4847 B(Star), R(0), // | 5135 B(Star), R(0), // |
| 5136 B(Star), R(2), // |
| 4848 B(LdaZero), // | 5137 B(LdaZero), // |
| 4849 B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot)), // | 5138 B(KeyedLoadICSloppy), R(2), U8(vector->GetIndex(slot)), // |
| 4850 B(Return), // | 5139 B(Return), // |
| 4851 }}, | 5140 }}, |
| 4852 {"function f(a, b, c) { return arguments; }", | 5141 {"function f(a, b, c) { return arguments; }", |
| 4853 2 * kPointerSize, | 5142 2 * kPointerSize, |
| 4854 4, | 5143 4, |
| 4855 26, | 5144 26, |
| 4856 { | 5145 { |
| 4857 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 5146 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 4858 U8(1), // | 5147 U8(1), // |
| 4859 B(PushContext), R(1), // | 5148 B(PushContext), R(1), // |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4982 B(ForInStep), R(7), // | 5271 B(ForInStep), R(7), // |
| 4983 B(Star), R(7), // | 5272 B(Star), R(7), // |
| 4984 B(Jump), U8(-21), // | 5273 B(Jump), U8(-21), // |
| 4985 B(LdaUndefined), // | 5274 B(LdaUndefined), // |
| 4986 B(Return), // | 5275 B(Return), // |
| 4987 }, | 5276 }, |
| 4988 1, | 5277 1, |
| 4989 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 5278 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 4990 {"var x = 0;\n" | 5279 {"var x = 0;\n" |
| 4991 "for (var p in [1,2,3]) { x += p; }", | 5280 "for (var p in [1,2,3]) { x += p; }", |
| 4992 8 * kPointerSize, | 5281 9 * kPointerSize, |
| 4993 1, | 5282 1, |
| 4994 51, | 5283 57, |
| 4995 { | 5284 { |
| 4996 B(LdaZero), // | 5285 B(LdaZero), // |
| 4997 B(Star), R(1), // | 5286 B(Star), R(1), // |
| 4998 B(CreateArrayLiteral), U8(0), U8(0), U8(3), // | 5287 B(CreateArrayLiteral), U8(0), U8(0), U8(3), // |
| 4999 B(JumpIfUndefined), U8(42), // | 5288 B(JumpIfUndefined), U8(48), // |
| 5000 B(JumpIfNull), U8(40), // | 5289 B(JumpIfNull), U8(46), // |
| 5001 B(ToObject), // | 5290 B(ToObject), // |
| 5002 B(JumpIfNull), U8(37), // | 5291 B(JumpIfNull), U8(43), // |
| 5003 B(Star), R(3), // | 5292 B(Star), R(3), // |
| 5004 B(ForInPrepare), R(4), R(5), R(6), // | 5293 B(ForInPrepare), R(4), R(5), R(6), // |
| 5005 B(LdaZero), // | 5294 B(LdaZero), // |
| 5006 B(Star), R(7), // | 5295 B(Star), R(7), // |
| 5007 B(ForInDone), R(7), R(6), // | 5296 B(ForInDone), R(7), R(6), // |
| 5008 B(JumpIfTrue), U8(23), // | 5297 B(JumpIfTrue), U8(29), // |
| 5009 B(ForInNext), R(3), R(4), R(5), R(7), // | 5298 B(ForInNext), R(3), R(4), R(5), R(7), // |
| 5010 B(JumpIfUndefined), U8(10), // | 5299 B(JumpIfUndefined), U8(16), // |
| 5011 B(Star), R(0), // | 5300 B(Star), R(0), // |
| 5012 B(Star), R(2), // | 5301 B(Star), R(2), // |
| 5013 B(Add), R(1), // | 5302 B(Ldar), R(1), // |
| 5303 B(Star), R(8), // |
| 5304 B(Ldar), R(2), // |
| 5305 B(Add), R(8), // |
| 5014 B(Star), R(1), // | 5306 B(Star), R(1), // |
| 5015 B(ForInStep), R(7), // | 5307 B(ForInStep), R(7), // |
| 5016 B(Star), R(7), // | 5308 B(Star), R(7), // |
| 5017 B(Jump), U8(-24), // | 5309 B(Jump), U8(-30), // |
| 5018 B(LdaUndefined), // | 5310 B(LdaUndefined), // |
| 5019 B(Return), // | 5311 B(Return), // |
| 5020 }, | 5312 }, |
| 5021 1, | 5313 1, |
| 5022 {InstanceType::FIXED_ARRAY_TYPE}}, | 5314 {InstanceType::FIXED_ARRAY_TYPE}}, |
| 5023 {"var x = { 'a': 1, 'b': 2 };\n" | 5315 {"var x = { 'a': 1, 'b': 2 };\n" |
| 5024 "for (x['a'] in [10, 20, 30]) {\n" | 5316 "for (x['a'] in [10, 20, 30]) {\n" |
| 5025 " if (x['a'] == 10) continue;\n" | 5317 " if (x['a'] == 10) continue;\n" |
| 5026 " if (x['a'] == 20) break;\n" | 5318 " if (x['a'] == 20) break;\n" |
| 5027 "}", | 5319 "}", |
| 5028 7 * kPointerSize, | 5320 9 * kPointerSize, |
| 5029 1, | 5321 1, |
| 5030 80, | 5322 94, |
| 5031 { | 5323 { |
| 5032 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // | 5324 B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), // |
| 5033 B(Star), R(0), // | 5325 B(Star), R(0), // |
| 5034 B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // | 5326 B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // |
| 5035 B(JumpIfUndefined), U8(68), // | 5327 B(JumpIfUndefined), U8(82), // |
| 5036 B(JumpIfNull), U8(66), // | 5328 B(JumpIfNull), U8(80), // |
| 5037 B(ToObject), // | 5329 B(ToObject), // |
| 5038 B(JumpIfNull), U8(63), // | 5330 B(JumpIfNull), U8(77), // |
| 5039 B(Star), R(1), // | 5331 B(Star), R(1), // |
| 5040 B(ForInPrepare), R(2), R(3), R(4), // | 5332 B(ForInPrepare), R(2), R(3), R(4), // |
| 5041 B(LdaZero), // | 5333 B(LdaZero), // |
| 5042 B(Star), R(5), // | 5334 B(Star), R(5), // |
| 5043 B(ForInDone), R(5), R(4), // | 5335 B(ForInDone), R(5), R(4), // |
| 5044 B(JumpIfTrue), U8(49), // | 5336 B(JumpIfTrue), U8(63), // |
| 5045 B(ForInNext), R(1), R(2), R(3), R(5), // | 5337 B(ForInNext), R(1), R(2), R(3), R(5), // |
| 5046 B(JumpIfUndefined), U8(36), // | 5338 B(JumpIfUndefined), U8(50), // |
| 5047 B(Star), R(6), // | 5339 B(Star), R(6), // |
| 5048 B(StoreICSloppy), R(0), U8(2), U8(vector->GetIndex(slot4)), // | 5340 B(Ldar), R(0), // |
| 5049 B(LoadICSloppy), R(0), U8(2), U8(vector->GetIndex(slot2)), // | 5341 B(Star), R(7), // |
| 5342 B(Ldar), R(6), // |
| 5343 B(StoreICSloppy), R(7), U8(2), U8(vector->GetIndex(slot4)), // |
| 5344 B(Ldar), R(0), // |
| 5050 B(Star), R(6), // | 5345 B(Star), R(6), // |
| 5346 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot2)), // |
| 5347 B(Star), R(8), // |
| 5051 B(LdaSmi8), U8(10), // | 5348 B(LdaSmi8), U8(10), // |
| 5052 B(TestEqual), R(6), // | 5349 B(TestEqual), R(8), // |
| 5053 B(JumpIfFalse), U8(4), // | 5350 B(JumpIfFalse), U8(4), // |
| 5054 B(Jump), U8(16), // | 5351 B(Jump), U8(20), // |
| 5055 B(LoadICSloppy), R(0), U8(2), U8(vector->GetIndex(slot3)), // | 5352 B(Ldar), R(0), // |
| 5056 B(Star), R(6), // | 5353 B(Star), R(6), // |
| 5354 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot3)), // |
| 5355 B(Star), R(8), // |
| 5057 B(LdaSmi8), U8(20), // | 5356 B(LdaSmi8), U8(20), // |
| 5058 B(TestEqual), R(6), // | 5357 B(TestEqual), R(8), // |
| 5059 B(JumpIfFalse), U8(4), // | 5358 B(JumpIfFalse), U8(4), // |
| 5060 B(Jump), U8(8), // | 5359 B(Jump), U8(8), // |
| 5061 B(ForInStep), R(5), // | 5360 B(ForInStep), R(5), // |
| 5062 B(Star), R(5), // | 5361 B(Star), R(5), // |
| 5063 B(Jump), U8(-50), // | 5362 B(Jump), U8(-64), // |
| 5064 B(LdaUndefined), // | 5363 B(LdaUndefined), // |
| 5065 B(Return), // | 5364 B(Return), // |
| 5066 }, | 5365 }, |
| 5067 3, | 5366 3, |
| 5068 {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE, | 5367 {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE, |
| 5069 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 5368 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 5070 {"var x = [ 10, 11, 12 ] ;\n" | 5369 {"var x = [ 10, 11, 12 ] ;\n" |
| 5071 "for (x[0] in [1,2,3]) { return x[3]; }", | 5370 "for (x[0] in [1,2,3]) { return x[3]; }", |
| 5072 8 * kPointerSize, | 5371 9 * kPointerSize, |
| 5073 1, | 5372 1, |
| 5074 63, | 5373 71, |
| 5075 { | 5374 { |
| 5076 B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // | 5375 B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), // |
| 5077 B(Star), R(0), // | 5376 B(Star), R(0), // |
| 5078 B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // | 5377 B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), // |
| 5079 B(JumpIfUndefined), U8(51), // | 5378 B(JumpIfUndefined), U8(59), // |
| 5080 B(JumpIfNull), U8(49), // | 5379 B(JumpIfNull), U8(57), // |
| 5081 B(ToObject), // | 5380 B(ToObject), // |
| 5082 B(JumpIfNull), U8(46), // | 5381 B(JumpIfNull), U8(54), // |
| 5083 B(Star), R(1), // | 5382 B(Star), R(1), // |
| 5084 B(ForInPrepare), R(2), R(3), R(4), // | 5383 B(ForInPrepare), R(2), R(3), R(4), // |
| 5085 B(LdaZero), // | 5384 B(LdaZero), // |
| 5086 B(Star), R(5), // | 5385 B(Star), R(5), // |
| 5087 B(ForInDone), R(5), R(4), // | 5386 B(ForInDone), R(5), R(4), // |
| 5088 B(JumpIfTrue), U8(32), // | 5387 B(JumpIfTrue), U8(40), // |
| 5089 B(ForInNext), R(1), R(2), R(3), R(5), // | 5388 B(ForInNext), R(1), R(2), R(3), R(5), // |
| 5090 B(JumpIfUndefined), U8(19), // | 5389 B(JumpIfUndefined), U8(27), // |
| 5091 B(Star), R(6), // | 5390 B(Star), R(6), // |
| 5391 B(Ldar), R(0), // |
| 5392 B(Star), R(7), // |
| 5092 B(LdaZero), // | 5393 B(LdaZero), // |
| 5093 B(Star), R(7), // | 5394 B(Star), R(8), // |
| 5094 B(Ldar), R(6), // | 5395 B(Ldar), R(6), // |
| 5095 B(KeyedStoreICSloppy), R(0), R(7), U8(vector->GetIndex(slot3)), // | 5396 B(KeyedStoreICSloppy), R(7), R(8), U8(vector->GetIndex(slot3)), // |
| 5397 B(Ldar), R(0), // |
| 5398 B(Star), R(6), // |
| 5096 B(LdaSmi8), U8(3), // | 5399 B(LdaSmi8), U8(3), // |
| 5097 B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot2)), // | 5400 B(KeyedLoadICSloppy), R(6), U8(vector->GetIndex(slot2)), // |
| 5098 B(Return), // | 5401 B(Return), // |
| 5099 B(ForInStep), R(5), // | 5402 B(ForInStep), R(5), // |
| 5100 B(Star), R(5), // | 5403 B(Star), R(5), // |
| 5101 B(Jump), U8(-33), // | 5404 B(Jump), U8(-41), // |
| 5102 B(LdaUndefined), // | 5405 B(LdaUndefined), // |
| 5103 B(Return), // | 5406 B(Return), // |
| 5104 }, | 5407 }, |
| 5105 2, | 5408 2, |
| 5106 {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE}}, | 5409 {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE}}, |
| 5107 }; | 5410 }; |
| 5108 | 5411 |
| 5109 for (size_t i = 0; i < arraysize(snippets); i++) { | 5412 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5110 Handle<BytecodeArray> bytecode_array = | 5413 Handle<BytecodeArray> bytecode_array = |
| 5111 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5414 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5160 TEST(Switch) { | 5463 TEST(Switch) { |
| 5161 InitializedHandleScope handle_scope; | 5464 InitializedHandleScope handle_scope; |
| 5162 BytecodeGeneratorHelper helper; | 5465 BytecodeGeneratorHelper helper; |
| 5163 | 5466 |
| 5164 ExpectedSnippet<int> snippets[] = { | 5467 ExpectedSnippet<int> snippets[] = { |
| 5165 {"var a = 1;\n" | 5468 {"var a = 1;\n" |
| 5166 "switch(a) {\n" | 5469 "switch(a) {\n" |
| 5167 " case 1: return 2;\n" | 5470 " case 1: return 2;\n" |
| 5168 " case 2: return 3;\n" | 5471 " case 2: return 3;\n" |
| 5169 "}\n", | 5472 "}\n", |
| 5170 2 * kPointerSize, | 5473 3 * kPointerSize, |
| 5171 1, | 5474 1, |
| 5172 28, | 5475 30, |
| 5173 { | 5476 { |
| 5174 B(LdaSmi8), U8(1), // | 5477 B(LdaSmi8), U8(1), // |
| 5175 B(Star), R(1), // The tag variable is allocated as a | 5478 B(Star), R(1), // The tag variable is allocated as a |
| 5176 B(Star), R(0), // local by the parser, hence the store | 5479 B(Star), R(0), // local by the parser, hence the store |
| 5177 B(LdaSmi8), U8(1), // to another local register. | 5480 B(Star), R(2), // to another local register. |
| 5178 B(TestEqualStrict), R(0), // | 5481 B(LdaSmi8), U8(1), // |
| 5482 B(TestEqualStrict), R(2), // |
| 5179 B(JumpIfTrue), U8(10), // | 5483 B(JumpIfTrue), U8(10), // |
| 5180 B(LdaSmi8), U8(2), // | 5484 B(LdaSmi8), U8(2), // |
| 5181 B(TestEqualStrict), R(0), // | 5485 B(TestEqualStrict), R(2), // |
| 5182 B(JumpIfTrue), U8(7), // | 5486 B(JumpIfTrue), U8(7), // |
| 5183 B(Jump), U8(8), // | 5487 B(Jump), U8(8), // |
| 5184 B(LdaSmi8), U8(2), // | 5488 B(LdaSmi8), U8(2), // |
| 5185 B(Return), // | 5489 B(Return), // |
| 5186 B(LdaSmi8), U8(3), // | 5490 B(LdaSmi8), U8(3), // |
| 5187 B(Return), // | 5491 B(Return), // |
| 5188 B(LdaUndefined), // | 5492 B(LdaUndefined), // |
| 5189 B(Return), // | 5493 B(Return), // |
| 5190 }}, | 5494 }}, |
| 5191 {"var a = 1;\n" | 5495 {"var a = 1;\n" |
| 5192 "switch(a) {\n" | 5496 "switch(a) {\n" |
| 5193 " case 1: a = 2; break;\n" | 5497 " case 1: a = 2; break;\n" |
| 5194 " case 2: a = 3; break;\n" | 5498 " case 2: a = 3; break;\n" |
| 5195 "}\n", | 5499 "}\n", |
| 5196 2 * kPointerSize, | 5500 3 * kPointerSize, |
| 5197 1, | 5501 1, |
| 5198 34, | 5502 36, |
| 5199 { | 5503 { |
| 5200 B(LdaSmi8), U8(1), // | 5504 B(LdaSmi8), U8(1), // |
| 5201 B(Star), R(1), // | 5505 B(Star), R(1), // |
| 5202 B(Star), R(0), // | 5506 B(Star), R(0), // |
| 5507 B(Star), R(2), // |
| 5203 B(LdaSmi8), U8(1), // | 5508 B(LdaSmi8), U8(1), // |
| 5204 B(TestEqualStrict), R(0), // | 5509 B(TestEqualStrict), R(2), // |
| 5205 B(JumpIfTrue), U8(10), // | 5510 B(JumpIfTrue), U8(10), // |
| 5206 B(LdaSmi8), U8(2), // | 5511 B(LdaSmi8), U8(2), // |
| 5207 B(TestEqualStrict), R(0), // | 5512 B(TestEqualStrict), R(2), // |
| 5208 B(JumpIfTrue), U8(10), // | 5513 B(JumpIfTrue), U8(10), // |
| 5209 B(Jump), U8(14), // | 5514 B(Jump), U8(14), // |
| 5210 B(LdaSmi8), U8(2), // | 5515 B(LdaSmi8), U8(2), // |
| 5211 B(Star), R(1), // | 5516 B(Star), R(1), // |
| 5212 B(Jump), U8(8), // | 5517 B(Jump), U8(8), // |
| 5213 B(LdaSmi8), U8(3), // | 5518 B(LdaSmi8), U8(3), // |
| 5214 B(Star), R(1), // | 5519 B(Star), R(1), // |
| 5215 B(Jump), U8(2), // | 5520 B(Jump), U8(2), // |
| 5216 B(LdaUndefined), // | 5521 B(LdaUndefined), // |
| 5217 B(Return), // | 5522 B(Return), // |
| 5218 }}, | 5523 }}, |
| 5219 {"var a = 1;\n" | 5524 {"var a = 1;\n" |
| 5220 "switch(a) {\n" | 5525 "switch(a) {\n" |
| 5221 " case 1: a = 2; // fall-through\n" | 5526 " case 1: a = 2; // fall-through\n" |
| 5222 " case 2: a = 3; break;\n" | 5527 " case 2: a = 3; break;\n" |
| 5223 "}\n", | 5528 "}\n", |
| 5224 2 * kPointerSize, | 5529 3 * kPointerSize, |
| 5225 1, | 5530 1, |
| 5226 32, | 5531 34, |
| 5227 { | 5532 { |
| 5228 B(LdaSmi8), U8(1), // | 5533 B(LdaSmi8), U8(1), // |
| 5229 B(Star), R(1), // | 5534 B(Star), R(1), // |
| 5230 B(Star), R(0), // | 5535 B(Star), R(0), // |
| 5536 B(Star), R(2), // |
| 5231 B(LdaSmi8), U8(1), // | 5537 B(LdaSmi8), U8(1), // |
| 5232 B(TestEqualStrict), R(0), // | 5538 B(TestEqualStrict), R(2), // |
| 5233 B(JumpIfTrue), U8(10), // | 5539 B(JumpIfTrue), U8(10), // |
| 5234 B(LdaSmi8), U8(2), // | 5540 B(LdaSmi8), U8(2), // |
| 5235 B(TestEqualStrict), R(0), // | 5541 B(TestEqualStrict), R(2), // |
| 5236 B(JumpIfTrue), U8(8), // | 5542 B(JumpIfTrue), U8(8), // |
| 5237 B(Jump), U8(12), // | 5543 B(Jump), U8(12), // |
| 5238 B(LdaSmi8), U8(2), // | 5544 B(LdaSmi8), U8(2), // |
| 5239 B(Star), R(1), // | 5545 B(Star), R(1), // |
| 5240 B(LdaSmi8), U8(3), // | 5546 B(LdaSmi8), U8(3), // |
| 5241 B(Star), R(1), // | 5547 B(Star), R(1), // |
| 5242 B(Jump), U8(2), // | 5548 B(Jump), U8(2), // |
| 5243 B(LdaUndefined), // | 5549 B(LdaUndefined), // |
| 5244 B(Return), // | 5550 B(Return), // |
| 5245 }}, | 5551 }}, |
| 5246 {"var a = 1;\n" | 5552 {"var a = 1;\n" |
| 5247 "switch(a) {\n" | 5553 "switch(a) {\n" |
| 5248 " case 2: break;\n" | 5554 " case 2: break;\n" |
| 5249 " case 3: break;\n" | 5555 " case 3: break;\n" |
| 5250 " default: a = 1; break;\n" | 5556 " default: a = 1; break;\n" |
| 5251 "}\n", | 5557 "}\n", |
| 5252 2 * kPointerSize, | 5558 3 * kPointerSize, |
| 5253 1, | 5559 1, |
| 5254 32, | 5560 34, |
| 5255 { | 5561 { |
| 5256 B(LdaSmi8), U8(1), // | 5562 B(LdaSmi8), U8(1), // |
| 5257 B(Star), R(1), // | 5563 B(Star), R(1), // |
| 5258 B(Star), R(0), // | 5564 B(Star), R(0), // |
| 5565 B(Star), R(2), // |
| 5259 B(LdaSmi8), U8(2), // | 5566 B(LdaSmi8), U8(2), // |
| 5260 B(TestEqualStrict), R(0), // | 5567 B(TestEqualStrict), R(2), // |
| 5261 B(JumpIfTrue), U8(10), // | 5568 B(JumpIfTrue), U8(10), // |
| 5262 B(LdaSmi8), U8(3), // | 5569 B(LdaSmi8), U8(3), // |
| 5263 B(TestEqualStrict), R(0), // | 5570 B(TestEqualStrict), R(2), // |
| 5264 B(JumpIfTrue), U8(6), // | 5571 B(JumpIfTrue), U8(6), // |
| 5265 B(Jump), U8(6), // | 5572 B(Jump), U8(6), // |
| 5266 B(Jump), U8(10), // | 5573 B(Jump), U8(10), // |
| 5267 B(Jump), U8(8), // | 5574 B(Jump), U8(8), // |
| 5268 B(LdaSmi8), U8(1), // | 5575 B(LdaSmi8), U8(1), // |
| 5269 B(Star), R(1), // | 5576 B(Star), R(1), // |
| 5270 B(Jump), U8(2), // | 5577 B(Jump), U8(2), // |
| 5271 B(LdaUndefined), // | 5578 B(LdaUndefined), // |
| 5272 B(Return), // | 5579 B(Return), // |
| 5273 }}, | 5580 }}, |
| 5274 {"var a = 1;\n" | 5581 {"var a = 1;\n" |
| 5275 "switch(typeof(a)) {\n" | 5582 "switch(typeof(a)) {\n" |
| 5276 " case 2: a = 1; break;\n" | 5583 " case 2: a = 1; break;\n" |
| 5277 " case 3: a = 2; break;\n" | 5584 " case 3: a = 2; break;\n" |
| 5278 " default: a = 3; break;\n" | 5585 " default: a = 3; break;\n" |
| 5279 "}\n", | 5586 "}\n", |
| 5280 2 * kPointerSize, | 5587 3 * kPointerSize, |
| 5281 1, | 5588 1, |
| 5282 41, | 5589 43, |
| 5283 { | 5590 { |
| 5284 B(LdaSmi8), U8(1), // | 5591 B(LdaSmi8), U8(1), // |
| 5285 B(Star), R(1), // | 5592 B(Star), R(1), // |
| 5286 B(TypeOf), // | 5593 B(TypeOf), // |
| 5287 B(Star), R(0), // | 5594 B(Star), R(0), // |
| 5595 B(Star), R(2), // |
| 5288 B(LdaSmi8), U8(2), // | 5596 B(LdaSmi8), U8(2), // |
| 5289 B(TestEqualStrict), R(0), // | 5597 B(TestEqualStrict), R(2), // |
| 5290 B(JumpIfTrue), U8(10), // | 5598 B(JumpIfTrue), U8(10), // |
| 5291 B(LdaSmi8), U8(3), // | 5599 B(LdaSmi8), U8(3), // |
| 5292 B(TestEqualStrict), R(0), // | 5600 B(TestEqualStrict), R(2), // |
| 5293 B(JumpIfTrue), U8(10), // | 5601 B(JumpIfTrue), U8(10), // |
| 5294 B(Jump), U8(14), // | 5602 B(Jump), U8(14), // |
| 5295 B(LdaSmi8), U8(1), // | 5603 B(LdaSmi8), U8(1), // |
| 5296 B(Star), R(1), // | 5604 B(Star), R(1), // |
| 5297 B(Jump), U8(14), // | 5605 B(Jump), U8(14), // |
| 5298 B(LdaSmi8), U8(2), // | 5606 B(LdaSmi8), U8(2), // |
| 5299 B(Star), R(1), // | 5607 B(Star), R(1), // |
| 5300 B(Jump), U8(8), // | 5608 B(Jump), U8(8), // |
| 5301 B(LdaSmi8), U8(3), // | 5609 B(LdaSmi8), U8(3), // |
| 5302 B(Star), R(1), // | 5610 B(Star), R(1), // |
| 5303 B(Jump), U8(2), // | 5611 B(Jump), U8(2), // |
| 5304 B(LdaUndefined), // | 5612 B(LdaUndefined), // |
| 5305 B(Return), // | 5613 B(Return), // |
| 5306 }}, | 5614 }}, |
| 5307 {"var a = 1;\n" | 5615 {"var a = 1;\n" |
| 5308 "switch(a) {\n" | 5616 "switch(a) {\n" |
| 5309 " case typeof(a): a = 1; break;\n" | 5617 " case typeof(a): a = 1; break;\n" |
| 5310 " default: a = 2; break;\n" | 5618 " default: a = 2; break;\n" |
| 5311 "}\n", | 5619 "}\n", |
| 5312 2 * kPointerSize, | 5620 3 * kPointerSize, |
| 5313 1, | 5621 1, |
| 5314 29, | 5622 31, |
| 5315 { | 5623 { |
| 5316 B(LdaSmi8), U8(1), // | 5624 B(LdaSmi8), U8(1), // |
| 5317 B(Star), R(1), // | 5625 B(Star), R(1), // |
| 5318 B(Star), R(0), // | 5626 B(Star), R(0), // |
| 5627 B(Star), R(2), // |
| 5319 B(Ldar), R(1), // | 5628 B(Ldar), R(1), // |
| 5320 B(TypeOf), // | 5629 B(TypeOf), // |
| 5321 B(TestEqualStrict), R(0), // | 5630 B(TestEqualStrict), R(2), // |
| 5322 B(JumpIfTrue), U8(4), // | 5631 B(JumpIfTrue), U8(4), // |
| 5323 B(Jump), U8(8), // | 5632 B(Jump), U8(8), // |
| 5324 B(LdaSmi8), U8(1), // | 5633 B(LdaSmi8), U8(1), // |
| 5325 B(Star), R(1), // | 5634 B(Star), R(1), // |
| 5326 B(Jump), U8(8), // | 5635 B(Jump), U8(8), // |
| 5327 B(LdaSmi8), U8(2), // | 5636 B(LdaSmi8), U8(2), // |
| 5328 B(Star), R(1), // | 5637 B(Star), R(1), // |
| 5329 B(Jump), U8(2), // | 5638 B(Jump), U8(2), // |
| 5330 B(LdaUndefined), // | 5639 B(LdaUndefined), // |
| 5331 B(Return), // | 5640 B(Return), // |
| 5332 }}, | 5641 }}, |
| 5333 {"var a = 1;\n" | 5642 {"var a = 1;\n" |
| 5334 "switch(a) {\n" | 5643 "switch(a) {\n" |
| 5335 " case 1:\n" REPEAT_64(SPACE, " a = 2;") | 5644 " case 1:\n" REPEAT_64(SPACE, " a = 2;") |
| 5336 "break;\n" | 5645 "break;\n" |
| 5337 " case 2: a = 3; break;" | 5646 " case 2: a = 3; break;" |
| 5338 "}\n", | 5647 "}\n", |
| 5339 2 * kPointerSize, | 5648 3 * kPointerSize, |
| 5340 1, | 5649 1, |
| 5341 286, | 5650 288, |
| 5342 { | 5651 { |
| 5343 B(LdaSmi8), U8(1), // | 5652 B(LdaSmi8), U8(1), // |
| 5344 B(Star), R(1), // | 5653 B(Star), R(1), // |
| 5345 B(Star), R(0), // | 5654 B(Star), R(0), // |
| 5655 B(Star), R(2), // |
| 5346 B(LdaSmi8), U8(1), // | 5656 B(LdaSmi8), U8(1), // |
| 5347 B(TestEqualStrict), R(0), // | 5657 B(TestEqualStrict), R(2), // |
| 5348 B(JumpIfTrue), U8(10), // | 5658 B(JumpIfTrue), U8(10), // |
| 5349 B(LdaSmi8), U8(2), // | 5659 B(LdaSmi8), U8(2), // |
| 5350 B(TestEqualStrict), R(0), // | 5660 B(TestEqualStrict), R(2), // |
| 5351 B(JumpIfTrueConstant), U8(0), // | 5661 B(JumpIfTrueConstant), U8(0), // |
| 5352 B(JumpConstant), U8(1), // | 5662 B(JumpConstant), U8(1), // |
| 5353 REPEAT_64(COMMA, // | 5663 REPEAT_64(COMMA, // |
| 5354 B(LdaSmi8), U8(2), // | 5664 B(LdaSmi8), U8(2), // |
| 5355 B(Star), R(1)), // | 5665 B(Star), R(1)), // |
| 5356 B(Jump), U8(8), // | 5666 B(Jump), U8(8), // |
| 5357 B(LdaSmi8), U8(3), // | 5667 B(LdaSmi8), U8(3), // |
| 5358 B(Star), R(1), // | 5668 B(Star), R(1), // |
| 5359 B(Jump), U8(2), // | 5669 B(Jump), U8(2), // |
| 5360 B(LdaUndefined), // | 5670 B(LdaUndefined), // |
| 5361 B(Return), // | 5671 B(Return), // |
| 5362 }, | 5672 }, |
| 5363 2, | 5673 2, |
| 5364 {262, 266}}, | 5674 {262, 266}}, |
| 5365 {"var a = 1;\n" | 5675 {"var a = 1;\n" |
| 5366 "switch(a) {\n" | 5676 "switch(a) {\n" |
| 5367 " case 1: \n" | 5677 " case 1: \n" |
| 5368 " switch(a + 1) {\n" | 5678 " switch(a + 1) {\n" |
| 5369 " case 2 : a = 1; break;\n" | 5679 " case 2 : a = 1; break;\n" |
| 5370 " default : a = 2; break;\n" | 5680 " default : a = 2; break;\n" |
| 5371 " } // fall-through\n" | 5681 " } // fall-through\n" |
| 5372 " case 2: a = 3;\n" | 5682 " case 2: a = 3;\n" |
| 5373 "}\n", | 5683 "}\n", |
| 5374 3 * kPointerSize, | 5684 5 * kPointerSize, |
| 5375 1, | 5685 1, |
| 5376 52, | 5686 60, |
| 5377 { | 5687 { |
| 5378 B(LdaSmi8), U8(1), // | 5688 B(LdaSmi8), U8(1), // |
| 5379 B(Star), R(2), // | 5689 B(Star), R(2), // |
| 5380 B(Star), R(0), // | 5690 B(Star), R(0), // |
| 5691 B(Star), R(3), // |
| 5381 B(LdaSmi8), U8(1), // | 5692 B(LdaSmi8), U8(1), // |
| 5382 B(TestEqualStrict), R(0), // | 5693 B(TestEqualStrict), R(3), // |
| 5383 B(JumpIfTrue), U8(10), // | 5694 B(JumpIfTrue), U8(10), // |
| 5384 B(LdaSmi8), U8(2), // | 5695 B(LdaSmi8), U8(2), // |
| 5385 B(TestEqualStrict), R(0), // | 5696 B(TestEqualStrict), R(3), // |
| 5386 B(JumpIfTrue), U8(30), // | 5697 B(JumpIfTrue), U8(36), // |
| 5387 B(Jump), U8(32), // | 5698 B(Jump), U8(38), // |
| 5699 B(Ldar), R(2), // |
| 5700 B(Star), R(4), // |
| 5388 B(LdaSmi8), U8(1), // | 5701 B(LdaSmi8), U8(1), // |
| 5389 B(Add), R(2), // | 5702 B(Add), R(4), // |
| 5390 B(Star), R(1), // | 5703 B(Star), R(1), // |
| 5704 B(Star), R(4), // |
| 5391 B(LdaSmi8), U8(2), // | 5705 B(LdaSmi8), U8(2), // |
| 5392 B(TestEqualStrict), R(1), // | 5706 B(TestEqualStrict), R(4), // |
| 5393 B(JumpIfTrue), U8(4), // | 5707 B(JumpIfTrue), U8(4), // |
| 5394 B(Jump), U8(8), // | 5708 B(Jump), U8(8), // |
| 5395 B(LdaSmi8), U8(1), // | 5709 B(LdaSmi8), U8(1), // |
| 5396 B(Star), R(2), // | 5710 B(Star), R(2), // |
| 5397 B(Jump), U8(8), // | 5711 B(Jump), U8(8), // |
| 5398 B(LdaSmi8), U8(2), // | 5712 B(LdaSmi8), U8(2), // |
| 5399 B(Star), R(2), // | 5713 B(Star), R(2), // |
| 5400 B(Jump), U8(2), // | 5714 B(Jump), U8(2), // |
| 5401 B(LdaSmi8), U8(3), // | 5715 B(LdaSmi8), U8(3), // |
| 5402 B(Star), R(2), // | 5716 B(Star), R(2), // |
| 5403 B(LdaUndefined), // | 5717 B(LdaUndefined), // |
| 5404 B(Return), // | 5718 B(Return), // |
| 5405 }}, | 5719 }}, |
| 5406 }; | 5720 }; |
| 5407 | 5721 |
| 5408 for (size_t i = 0; i < arraysize(snippets); i++) { | 5722 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5409 Handle<BytecodeArray> bytecode_array = | 5723 Handle<BytecodeArray> bytecode_array = |
| 5410 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 5724 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5411 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 5725 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5412 } | 5726 } |
| 5413 } | 5727 } |
| 5414 | 5728 |
| 5415 | 5729 |
| 5416 TEST(BasicBlockToBoolean) { | 5730 TEST(BasicBlockToBoolean) { |
| 5417 InitializedHandleScope handle_scope; | 5731 InitializedHandleScope handle_scope; |
| 5418 BytecodeGeneratorHelper helper; | 5732 BytecodeGeneratorHelper helper; |
| 5419 | 5733 |
| 5420 // Check that we don't omit ToBoolean calls if they are at the start of basic | 5734 // Check that we generate JumpIfToBoolean if they are at the start of basic |
| 5421 // blocks. | 5735 // blocks. |
| 5422 ExpectedSnippet<int> snippets[] = { | 5736 ExpectedSnippet<int> snippets[] = { |
| 5423 {"var a = 1; if (a || a < 0) { return 1; }", | 5737 {"var a = 1; if (a || a < 0) { return 1; }", |
| 5424 1 * kPointerSize, | 5738 2 * kPointerSize, |
| 5425 1, | 5739 1, |
| 5426 16, | 5740 20, |
| 5427 { | 5741 { |
| 5428 B(LdaSmi8), U8(1), // | 5742 B(LdaSmi8), U8(1), // |
| 5429 B(Star), R(0), // | 5743 B(Star), R(0), // |
| 5430 B(JumpIfToBooleanTrue), U8(5), // | 5744 B(JumpIfToBooleanTrue), U8(9), // |
| 5745 B(Ldar), R(0), // |
| 5746 B(Star), R(1), // |
| 5431 B(LdaZero), // | 5747 B(LdaZero), // |
| 5432 B(TestLessThan), R(0), // | 5748 B(TestLessThan), R(1), // |
| 5433 B(JumpIfToBooleanFalse), U8(5), // | 5749 B(JumpIfToBooleanFalse), U8(5), // |
| 5434 B(LdaSmi8), U8(1), // | 5750 B(LdaSmi8), U8(1), // |
| 5435 B(Return), // | 5751 B(Return), // |
| 5436 B(LdaUndefined), // | 5752 B(LdaUndefined), // |
| 5437 B(Return), // | 5753 B(Return), // |
| 5438 }}, | 5754 }}, |
| 5439 {"var a = 1; if (a && a < 0) { return 1; }", | 5755 {"var a = 1; if (a && a < 0) { return 1; }", |
| 5440 1 * kPointerSize, | 5756 2 * kPointerSize, |
| 5441 1, | 5757 1, |
| 5442 16, | 5758 20, |
| 5443 { | 5759 { |
| 5444 B(LdaSmi8), U8(1), // | 5760 B(LdaSmi8), U8(1), // |
| 5445 B(Star), R(0), // | 5761 B(Star), R(0), // |
| 5446 B(JumpIfToBooleanFalse), U8(5), // | 5762 B(JumpIfToBooleanFalse), U8(9), // |
| 5763 B(Ldar), R(0), // |
| 5764 B(Star), R(1), // |
| 5447 B(LdaZero), // | 5765 B(LdaZero), // |
| 5448 B(TestLessThan), R(0), // | 5766 B(TestLessThan), R(1), // |
| 5449 B(JumpIfToBooleanFalse), U8(5), // | 5767 B(JumpIfToBooleanFalse), U8(5), // |
| 5450 B(LdaSmi8), U8(1), // | 5768 B(LdaSmi8), U8(1), // |
| 5451 B(Return), // | 5769 B(Return), // |
| 5452 B(LdaUndefined), // | 5770 B(LdaUndefined), // |
| 5453 B(Return), // | 5771 B(Return), // |
| 5454 }}, | 5772 }}, |
| 5455 {"var a = 1; a = (a || a < 0) ? 2 : 3;", | 5773 {"var a = 1; a = (a || a < 0) ? 2 : 3;", |
| 5456 1 * kPointerSize, | 5774 2 * kPointerSize, |
| 5457 1, | 5775 1, |
| 5458 21, | 5776 25, |
| 5459 { | 5777 { |
| 5460 B(LdaSmi8), U8(1), // | 5778 B(LdaSmi8), U8(1), // |
| 5461 B(Star), R(0), // | 5779 B(Star), R(0), // |
| 5462 B(JumpIfToBooleanTrue), U8(5), // | 5780 B(JumpIfToBooleanTrue), U8(9), // |
| 5781 B(Ldar), R(0), // |
| 5782 B(Star), R(1), // |
| 5463 B(LdaZero), // | 5783 B(LdaZero), // |
| 5464 B(TestLessThan), R(0), // | 5784 B(TestLessThan), R(1), // |
| 5465 B(JumpIfToBooleanFalse), U8(6), // | 5785 B(JumpIfToBooleanFalse), U8(6), // |
| 5466 B(LdaSmi8), U8(2), // | 5786 B(LdaSmi8), U8(2), // |
| 5467 B(Jump), U8(4), // | 5787 B(Jump), U8(4), // |
| 5468 B(LdaSmi8), U8(3), // | 5788 B(LdaSmi8), U8(3), // |
| 5469 B(Star), R(0), // | 5789 B(Star), R(0), // |
| 5470 B(LdaUndefined), // | 5790 B(LdaUndefined), // |
| 5471 B(Return), // | 5791 B(Return), // |
| 5472 }}, | 5792 }}, |
| 5473 }; | 5793 }; |
| 5474 | 5794 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5614 InitializedHandleScope handle_scope; | 5934 InitializedHandleScope handle_scope; |
| 5615 BytecodeGeneratorHelper helper; | 5935 BytecodeGeneratorHelper helper; |
| 5616 | 5936 |
| 5617 ExpectedSnippet<int> snippets[] = { | 5937 ExpectedSnippet<int> snippets[] = { |
| 5618 {"var ld_a = 1;\n" // This test is to check Ldar does not | 5938 {"var ld_a = 1;\n" // This test is to check Ldar does not |
| 5619 "while(true) {\n" // get removed if the preceding Star is | 5939 "while(true) {\n" // get removed if the preceding Star is |
| 5620 " ld_a = ld_a + ld_a;\n" // in a different basicblock. | 5940 " ld_a = ld_a + ld_a;\n" // in a different basicblock. |
| 5621 " if (ld_a > 10) break;\n" | 5941 " if (ld_a > 10) break;\n" |
| 5622 "}\n" | 5942 "}\n" |
| 5623 "return ld_a;", | 5943 "return ld_a;", |
| 5624 1 * kPointerSize, | 5944 2 * kPointerSize, |
| 5625 1, | 5945 1, |
| 5626 23, | 5946 29, |
| 5627 {B(LdaSmi8), U8(1), // | 5947 {B(LdaSmi8), U8(1), // |
| 5628 B(Star), R(0), // | 5948 B(Star), R(0), // |
| 5629 B(Ldar), R(0), // This load should not be removed as it | 5949 B(Ldar), R(0), // This load should not be removed as it |
| 5630 B(Add), R(0), // is the target of the branch. | 5950 B(Star), R(1), // is the target of the branch. |
| 5951 B(Ldar), R(0), // |
| 5952 B(Add), R(1), // |
| 5631 B(Star), R(0), // | 5953 B(Star), R(0), // |
| 5954 B(Star), R(1), // |
| 5632 B(LdaSmi8), U8(10), // | 5955 B(LdaSmi8), U8(10), // |
| 5633 B(TestGreaterThan), R(0), // | 5956 B(TestGreaterThan), R(1), // |
| 5634 B(JumpIfFalse), U8(4), // | 5957 B(JumpIfFalse), U8(4), // |
| 5635 B(Jump), U8(4), // | 5958 B(Jump), U8(4), // |
| 5636 B(Jump), U8(-14), // | 5959 B(Jump), U8(-20), // |
| 5637 B(Ldar), R(0), // | 5960 B(Ldar), R(0), // |
| 5638 B(Return)}}, | 5961 B(Return)}}, |
| 5639 {"var ld_a = 1;\n" | 5962 {"var ld_a = 1;\n" |
| 5640 "do {\n" | 5963 "do {\n" |
| 5641 " ld_a = ld_a + ld_a;\n" | 5964 " ld_a = ld_a + ld_a;\n" |
| 5642 " if (ld_a > 10) continue;\n" | 5965 " if (ld_a > 10) continue;\n" |
| 5643 "} while(false);\n" | 5966 "} while(false);\n" |
| 5644 "return ld_a;", | 5967 "return ld_a;", |
| 5645 1 * kPointerSize, | 5968 2 * kPointerSize, |
| 5646 1, | 5969 1, |
| 5647 21, | 5970 27, |
| 5648 {B(LdaSmi8), U8(1), // | 5971 {B(LdaSmi8), U8(1), // |
| 5649 B(Star), R(0), // | 5972 B(Star), R(0), // |
| 5650 B(Ldar), R(0), // | 5973 B(Ldar), R(0), // |
| 5651 B(Add), R(0), // | 5974 B(Star), R(1), // |
| 5975 B(Ldar), R(0), // |
| 5976 B(Add), R(1), // |
| 5652 B(Star), R(0), // | 5977 B(Star), R(0), // |
| 5978 B(Star), R(1), // |
| 5653 B(LdaSmi8), U8(10), // | 5979 B(LdaSmi8), U8(10), // |
| 5654 B(TestGreaterThan), R(0), // | 5980 B(TestGreaterThan), R(1), // |
| 5655 B(JumpIfFalse), U8(4), // | 5981 B(JumpIfFalse), U8(4), // |
| 5656 B(Jump), U8(2), // | 5982 B(Jump), U8(2), // |
| 5657 B(Ldar), R(0), // | 5983 B(Ldar), R(0), // |
| 5658 B(Return)}}, | 5984 B(Return)}}, |
| 5659 {"var ld_a = 1;\n" | 5985 {"var ld_a = 1;\n" |
| 5660 " ld_a = ld_a + ld_a;\n" | 5986 " ld_a = ld_a + ld_a;\n" |
| 5661 " return ld_a;", | 5987 " return ld_a;", |
| 5662 1 * kPointerSize, | 5988 2 * kPointerSize, |
| 5663 1, | 5989 1, |
| 5664 9, | 5990 13, |
| 5665 { | 5991 { |
| 5666 B(LdaSmi8), U8(1), // | 5992 B(LdaSmi8), U8(1), // |
| 5667 B(Star), R(0), // | 5993 B(Star), R(0), // |
| 5668 B(Add), R(0), // | 5994 B(Star), R(1), // |
| 5995 B(Ldar), R(0), // |
| 5996 B(Add), R(1), // |
| 5669 B(Star), R(0), // | 5997 B(Star), R(0), // |
| 5670 B(Return) // | 5998 B(Return) // |
| 5671 }}, | 5999 }}, |
| 5672 }; | 6000 }; |
| 5673 | 6001 |
| 5674 for (size_t i = 0; i < arraysize(snippets); i++) { | 6002 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5675 Handle<BytecodeArray> bytecode_array = | 6003 Handle<BytecodeArray> bytecode_array = |
| 5676 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 6004 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5677 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 6005 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5678 } | 6006 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5715 B(Star), R(0), // | 6043 B(Star), R(0), // |
| 5716 B(LdaSmi8), U8(100), // | 6044 B(LdaSmi8), U8(100), // |
| 5717 B(Star), R(0), // | 6045 B(Star), R(0), // |
| 5718 B(Star), R(1), // | 6046 B(Star), R(1), // |
| 5719 B(Return), // | 6047 B(Return), // |
| 5720 }, | 6048 }, |
| 5721 0}, | 6049 0}, |
| 5722 {"var x = 55;\n" | 6050 {"var x = 55;\n" |
| 5723 "x = x + (x = 100) + (x = 101);\n" | 6051 "x = x + (x = 100) + (x = 101);\n" |
| 5724 "return x;", | 6052 "return x;", |
| 5725 4 * kPointerSize, | 6053 3 * kPointerSize, |
| 5726 1, | 6054 1, |
| 5727 24, | 6055 23, |
| 5728 { | 6056 { |
| 5729 B(LdaSmi8), U8(55), // | 6057 B(LdaSmi8), U8(55), // |
| 5730 B(Star), R(0), // | 6058 B(Star), R(0), // |
| 6059 B(Star), R(1), // |
| 5731 B(LdaSmi8), U8(100), // | 6060 B(LdaSmi8), U8(100), // |
| 5732 B(Star), R(1), // | 6061 B(Star), R(0), // |
| 5733 B(Add), R(0), // | 6062 B(Add), R(1), // |
| 5734 B(Star), R(2), // | 6063 B(Star), R(2), // |
| 5735 B(LdaSmi8), U8(101), // | 6064 B(LdaSmi8), U8(101), // |
| 5736 B(Star), R(3), // | 6065 B(Star), R(0), // |
| 5737 B(Add), R(2), // | 6066 B(Add), R(2), // |
| 5738 B(Mov), R(3), R(0), // | |
| 5739 B(Star), R(0), // | 6067 B(Star), R(0), // |
| 5740 B(Return), // | 6068 B(Return), // |
| 5741 }, | 6069 }, |
| 5742 0}, | 6070 0}, |
| 5743 {"var x = 55;\n" | 6071 {"var x = 55;\n" |
| 5744 "x = (x = 56) - x + (x = 57);\n" | 6072 "x = (x = 56) - x + (x = 57);\n" |
| 5745 "x++;\n" | 6073 "x++;\n" |
| 5746 "return x;", | 6074 "return x;", |
| 5747 3 * kPointerSize, | 6075 3 * kPointerSize, |
| 5748 1, | 6076 1, |
| 5749 34, | 6077 31, |
| 5750 { | 6078 { |
| 5751 B(LdaSmi8), U8(55), // | 6079 B(LdaSmi8), U8(55), // |
| 5752 B(Star), R(0), // | 6080 B(Star), R(0), // |
| 5753 B(LdaSmi8), U8(56), // | 6081 B(LdaSmi8), U8(56), // |
| 5754 B(Star), R(0), // | 6082 B(Star), R(0), // |
| 5755 B(Star), R(1), // | 6083 B(Star), R(1), // |
| 5756 B(Ldar), R(0), // | 6084 B(Ldar), R(0), // |
| 5757 B(Sub), R(1), // | 6085 B(Sub), R(1), // |
| 5758 B(Star), R(2), // | 6086 B(Star), R(2), // |
| 5759 B(LdaSmi8), U8(57), // | 6087 B(LdaSmi8), U8(57), // |
| 5760 B(Star), R(1), // | 6088 B(Star), R(0), // |
| 5761 B(Add), R(2), // | 6089 B(Add), R(2), // |
| 5762 B(Mov), R(1), R(0), // | |
| 5763 B(Star), R(0), // | 6090 B(Star), R(0), // |
| 5764 B(ToNumber), // | 6091 B(ToNumber), // |
| 5765 B(Star), R(1), // | 6092 B(Star), R(1), // |
| 5766 B(Inc), // | 6093 B(Inc), // |
| 5767 B(Star), R(0), // | 6094 B(Star), R(0), // |
| 5768 B(Return), // | 6095 B(Return), // |
| 5769 }, | 6096 }, |
| 5770 0}, | 6097 0}, |
| 5771 {"var x = 55;\n" | 6098 {"var x = 55;\n" |
| 5772 "var y = x + (x = 1) + (x = 2) + (x = 3);\n" | 6099 "var y = x + (x = 1) + (x = 2) + (x = 3);\n" |
| 5773 "return y;", | 6100 "return y;", |
| 5774 6 * kPointerSize, | 6101 4 * kPointerSize, |
| 5775 1, | 6102 1, |
| 5776 32, | 6103 31, |
| 5777 { | 6104 { |
| 5778 B(LdaSmi8), U8(55), // | 6105 B(LdaSmi8), U8(55), // |
| 5779 B(Star), R(0), // | 6106 B(Star), R(0), // |
| 6107 B(Star), R(2), // |
| 5780 B(LdaSmi8), U8(1), // | 6108 B(LdaSmi8), U8(1), // |
| 5781 B(Star), R(2), // | 6109 B(Star), R(0), // |
| 5782 B(Add), R(0), // | 6110 B(Add), R(2), // |
| 5783 B(Star), R(3), // | 6111 B(Star), R(3), // |
| 5784 B(LdaSmi8), U8(2), // | 6112 B(LdaSmi8), U8(2), // |
| 5785 B(Star), R(4), // | 6113 B(Star), R(0), // |
| 5786 B(Add), R(3), // | 6114 B(Add), R(3), // |
| 5787 B(Star), R(5), // | 6115 B(Star), R(2), // |
| 5788 B(LdaSmi8), U8(3), // | 6116 B(LdaSmi8), U8(3), // |
| 5789 B(Star), R(3), // | 6117 B(Star), R(0), // |
| 5790 B(Add), R(5), // | 6118 B(Add), R(2), // |
| 5791 B(Mov), R(3), R(0), // | |
| 5792 B(Star), R(1), // | 6119 B(Star), R(1), // |
| 5793 B(Return), // | 6120 B(Return), // |
| 5794 }, | 6121 }, |
| 5795 0}, | 6122 0}, |
| 5796 {"var x = 55;\n" | 6123 {"var x = 55;\n" |
| 5797 "var x = x + (x = 1) + (x = 2) + (x = 3);\n" | 6124 "var x = x + (x = 1) + (x = 2) + (x = 3);\n" |
| 5798 "return x;", | 6125 "return x;", |
| 5799 5 * kPointerSize, | 6126 3 * kPointerSize, |
| 5800 1, | 6127 1, |
| 5801 32, | 6128 31, |
| 5802 { | 6129 { |
| 5803 B(LdaSmi8), U8(55), // | 6130 B(LdaSmi8), U8(55), // |
| 5804 B(Star), R(0), // | 6131 B(Star), R(0), // |
| 6132 B(Star), R(1), // |
| 5805 B(LdaSmi8), U8(1), // | 6133 B(LdaSmi8), U8(1), // |
| 5806 B(Star), R(1), // | 6134 B(Star), R(0), // |
| 5807 B(Add), R(0), // | 6135 B(Add), R(1), // |
| 5808 B(Star), R(2), // | 6136 B(Star), R(2), // |
| 5809 B(LdaSmi8), U8(2), // | 6137 B(LdaSmi8), U8(2), // |
| 5810 B(Star), R(3), // | 6138 B(Star), R(0), // |
| 5811 B(Add), R(2), // | 6139 B(Add), R(2), // |
| 5812 B(Star), R(4), // | 6140 B(Star), R(1), // |
| 5813 B(LdaSmi8), U8(3), // | 6141 B(LdaSmi8), U8(3), // |
| 5814 B(Star), R(2), // | 6142 B(Star), R(0), // |
| 5815 B(Add), R(4), // | 6143 B(Add), R(1), // |
| 5816 B(Mov), R(2), R(0), // | |
| 5817 B(Star), R(0), // | 6144 B(Star), R(0), // |
| 5818 B(Return), // | 6145 B(Return), // |
| 5819 }, | 6146 }, |
| 5820 0}, | 6147 0}, |
| 5821 {"var x = 10, y = 20;\n" | 6148 {"var x = 10, y = 20;\n" |
| 5822 "return x + (x = 1) + (x + 1) * (y = 2) + (y = 3) + (x = 4) + (y = 5) + " | 6149 "return x + (x = 1) + (x + 1) * (y = 2) + (y = 3) + (x = 4) + (y = 5) + " |
| 5823 "y;\n", | 6150 "y;\n", |
| 5824 6 * kPointerSize, | 6151 5 * kPointerSize, |
| 5825 1, | 6152 1, |
| 5826 64, | 6153 69, |
| 5827 { | 6154 { |
| 5828 B(LdaSmi8), U8(10), // | 6155 B(LdaSmi8), U8(10), // |
| 5829 B(Star), R(0), // | 6156 B(Star), R(0), // |
| 5830 B(LdaSmi8), U8(20), // | 6157 B(LdaSmi8), U8(20), // |
| 5831 B(Star), R(1), // | 6158 B(Star), R(1), // |
| 6159 B(Ldar), R(0), // |
| 6160 B(Star), R(2), // |
| 5832 B(LdaSmi8), U8(1), // | 6161 B(LdaSmi8), U8(1), // |
| 6162 B(Star), R(0), // |
| 6163 B(Add), R(2), // |
| 6164 B(Star), R(3), // |
| 6165 B(Ldar), R(0), // |
| 5833 B(Star), R(2), // | 6166 B(Star), R(2), // |
| 5834 B(Add), R(0), // | |
| 5835 B(Star), R(3), // | |
| 5836 B(LdaSmi8), U8(1), // | 6167 B(LdaSmi8), U8(1), // |
| 5837 B(Add), R(2), // | 6168 B(Add), R(2), // |
| 5838 B(Star), R(4), // | 6169 B(Star), R(4), // |
| 5839 B(LdaSmi8), U8(2), // | 6170 B(LdaSmi8), U8(2), // |
| 5840 B(Star), R(1), // | 6171 B(Star), R(1), // |
| 5841 B(Mul), R(4), // | 6172 B(Mul), R(4), // |
| 5842 B(Add), R(3), // | 6173 B(Add), R(3), // |
| 5843 B(Star), R(4), // | 6174 B(Star), R(2), // |
| 5844 B(LdaSmi8), U8(3), // | 6175 B(LdaSmi8), U8(3), // |
| 5845 B(Star), R(1), // | 6176 B(Star), R(1), // |
| 5846 B(Add), R(4), // | 6177 B(Add), R(2), // |
| 5847 B(Star), R(3), // | 6178 B(Star), R(3), // |
| 5848 B(LdaSmi8), U8(4), // | 6179 B(LdaSmi8), U8(4), // |
| 5849 B(Star), R(5), // | 6180 B(Star), R(0), // |
| 5850 B(Add), R(3), // | 6181 B(Add), R(3), // |
| 5851 B(Star), R(4), // | 6182 B(Star), R(2), // |
| 5852 B(LdaSmi8), U8(5), // | 6183 B(LdaSmi8), U8(5), // |
| 5853 B(Star), R(1), // | 6184 B(Star), R(1), // |
| 5854 B(Add), R(4), // | 6185 B(Add), R(2), // |
| 5855 B(Star), R(3), // | 6186 B(Star), R(3), // |
| 5856 B(Ldar), R(1), // | 6187 B(Ldar), R(1), // |
| 5857 B(Add), R(3), // | 6188 B(Add), R(3), // |
| 5858 B(Mov), R(5), R(0), // | |
| 5859 B(Return), // | 6189 B(Return), // |
| 5860 }, | 6190 }, |
| 5861 0}, | 6191 0}, |
| 5862 {"var x = 17;\n" | 6192 {"var x = 17;\n" |
| 5863 "return 1 + x + (x++) + (++x);\n", | 6193 "return 1 + x + (x++) + (++x);\n", |
| 5864 5 * kPointerSize, | 6194 4 * kPointerSize, |
| 5865 1, | 6195 1, |
| 5866 40, | 6196 37, |
| 5867 { | 6197 { |
| 5868 B(LdaSmi8), U8(17), // | 6198 B(LdaSmi8), U8(17), // |
| 5869 B(Star), R(0), // | 6199 B(Star), R(0), // |
| 5870 B(LdaSmi8), U8(1), // | 6200 B(LdaSmi8), U8(1), // |
| 5871 B(Star), R(1), // | 6201 B(Star), R(1), // |
| 5872 B(Ldar), R(0), // | 6202 B(Ldar), R(0), // |
| 5873 B(Add), R(1), // | 6203 B(Add), R(1), // |
| 5874 B(Star), R(2), // | 6204 B(Star), R(2), // |
| 5875 B(Ldar), R(0), // | 6205 B(Ldar), R(0), // |
| 5876 B(ToNumber), // | 6206 B(ToNumber), // |
| 5877 B(Star), R(1), // | 6207 B(Star), R(1), // |
| 5878 B(Inc), // | 6208 B(Inc), // |
| 5879 B(Star), R(3), // | 6209 B(Star), R(0), // |
| 5880 B(Ldar), R(1), // | 6210 B(Ldar), R(1), // |
| 5881 B(Add), R(2), // | 6211 B(Add), R(2), // |
| 5882 B(Star), R(4), // | 6212 B(Star), R(3), // |
| 5883 B(Ldar), R(3), // | 6213 B(Ldar), R(0), // |
| 5884 B(ToNumber), // | 6214 B(ToNumber), // |
| 5885 B(Inc), // | 6215 B(Inc), // |
| 5886 B(Star), R(1), // | 6216 B(Star), R(0), // |
| 5887 B(Add), R(4), // | 6217 B(Add), R(3), // |
| 5888 B(Mov), R(1), R(0), // | |
| 5889 B(Return), // | 6218 B(Return), // |
| 5890 }, | 6219 }, |
| 5891 0}}; | 6220 0}}; |
| 5892 | 6221 |
| 5893 for (size_t i = 0; i < arraysize(snippets); i++) { | 6222 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 5894 Handle<BytecodeArray> bytecode_array = | 6223 Handle<BytecodeArray> bytecode_array = |
| 5895 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 6224 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 5896 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 6225 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 5897 } | 6226 } |
| 5898 } | 6227 } |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6389 std::string(function_epilogue); | 6718 std::string(function_epilogue); |
| 6390 Handle<BytecodeArray> bytecode_array = | 6719 Handle<BytecodeArray> bytecode_array = |
| 6391 helper.MakeBytecode(script.c_str(), "t", "f"); | 6720 helper.MakeBytecode(script.c_str(), "t", "f"); |
| 6392 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 6721 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 6393 } | 6722 } |
| 6394 } | 6723 } |
| 6395 | 6724 |
| 6396 } // namespace interpreter | 6725 } // namespace interpreter |
| 6397 } // namespace internal | 6726 } // namespace internal |
| 6398 } // namespace v8 | 6727 } // namespace v8 |
| OLD | NEW |