| 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" |
| 11 #include "test/cctest/cctest.h" | 11 #include "test/cctest/cctest.h" |
| 12 #include "test/cctest/test-feedback-vector.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 namespace interpreter { | 16 namespace interpreter { |
| 16 | 17 |
| 17 class BytecodeGeneratorHelper { | 18 class BytecodeGeneratorHelper { |
| 18 public: | 19 public: |
| 19 const char* kFunctionName = "f"; | 20 const char* kFunctionName = "f"; |
| 20 | 21 |
| 21 static const int kLastParamIndex = | 22 static const int kLastParamIndex = |
| 22 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize; | 23 -InterpreterFrameConstants::kLastParamFromRegisterPointer / kPointerSize; |
| 23 | 24 |
| 24 BytecodeGeneratorHelper() { | 25 BytecodeGeneratorHelper() { |
| 25 i::FLAG_vector_stores = true; | 26 i::FLAG_vector_stores = true; |
| 26 i::FLAG_ignition = true; | 27 i::FLAG_ignition = true; |
| 27 i::FLAG_ignition_filter = StrDup(kFunctionName); | 28 i::FLAG_ignition_filter = StrDup(kFunctionName); |
| 28 i::FLAG_always_opt = false; | 29 i::FLAG_always_opt = false; |
| 29 CcTest::i_isolate()->interpreter()->Initialize(); | 30 CcTest::i_isolate()->interpreter()->Initialize(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 | 33 Isolate* isolate() { return CcTest::i_isolate(); } |
| 33 Factory* factory() { return CcTest::i_isolate()->factory(); } | 34 Factory* factory() { return CcTest::i_isolate()->factory(); } |
| 34 | 35 |
| 35 | 36 |
| 36 Handle<BytecodeArray> MakeBytecode(const char* script, | 37 Handle<BytecodeArray> MakeBytecode(const char* script, |
| 37 const char* function_name) { | 38 const char* function_name) { |
| 38 CompileRun(script); | 39 CompileRun(script); |
| 39 Local<Function> function = | 40 Local<Function> function = |
| 40 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name))); | 41 Local<Function>::Cast(CcTest::global()->Get(v8_str(function_name))); |
| 41 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*function); | 42 i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*function); |
| 42 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); | 43 return handle(js_function->shared()->bytecode_array(), CcTest::i_isolate()); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 Handle<BytecodeArray> bytecode_array = | 385 Handle<BytecodeArray> bytecode_array = |
| 385 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 386 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 386 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 387 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 387 } | 388 } |
| 388 } | 389 } |
| 389 | 390 |
| 390 | 391 |
| 391 TEST(PropertyLoads) { | 392 TEST(PropertyLoads) { |
| 392 InitializedHandleScope handle_scope; | 393 InitializedHandleScope handle_scope; |
| 393 BytecodeGeneratorHelper helper; | 394 BytecodeGeneratorHelper helper; |
| 395 Zone zone; |
| 394 | 396 |
| 395 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, | 397 FeedbackVectorSpec feedback_spec(&zone); |
| 396 i::FeedbackVectorSlotKind::LOAD_IC}; | 398 FeedbackVectorSlot slot1 = feedback_spec.AddLoadICSlot(); |
| 397 StaticFeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 399 FeedbackVectorSlot slot2 = feedback_spec.AddLoadICSlot(); |
| 400 |
| 398 Handle<i::TypeFeedbackVector> vector = | 401 Handle<i::TypeFeedbackVector> vector = |
| 399 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 402 i::TypeFeedbackVector::New(helper.isolate(), &feedback_spec); |
| 400 | 403 |
| 401 ExpectedSnippet<const char*> snippets[] = { | 404 ExpectedSnippet<const char*> snippets[] = { |
| 402 {"function f(a) { return a.name; }\nf({name : \"test\"})", | 405 {"function f(a) { return a.name; }\nf({name : \"test\"})", |
| 403 1 * kPointerSize, | 406 1 * kPointerSize, |
| 404 2, | 407 2, |
| 405 10, | 408 10, |
| 406 { | 409 { |
| 407 B(Ldar), R(helper.kLastParamIndex), // | 410 B(Ldar), R(helper.kLastParamIndex), // |
| 408 B(Star), R(0), // | 411 B(Star), R(0), // |
| 409 B(LdaConstant), U8(0), // | 412 B(LdaConstant), U8(0), // |
| 410 B(LoadIC), R(0), U8(vector->first_ic_slot_index()), // | 413 B(LoadIC), R(0), U8(vector->GetIndex(slot1)), // |
| 411 B(Return) // | 414 B(Return) // |
| 412 }, | 415 }, |
| 413 1, | 416 1, |
| 414 {"name"}}, | 417 {"name"}}, |
| 415 {"function f(a) { return a[\"key\"]; }\nf({key : \"test\"})", | 418 {"function f(a) { return a[\"key\"]; }\nf({key : \"test\"})", |
| 416 1 * kPointerSize, | 419 1 * kPointerSize, |
| 417 2, | 420 2, |
| 418 10, | 421 10, |
| 419 { | 422 { |
| 420 B(Ldar), R(helper.kLastParamIndex), // | 423 B(Ldar), R(helper.kLastParamIndex), // |
| 421 B(Star), R(0), // | 424 B(Star), R(0), // |
| 422 B(LdaConstant), U8(0), // | 425 B(LdaConstant), U8(0), // |
| 423 B(LoadIC), R(0), U8(vector->first_ic_slot_index()), // | 426 B(LoadIC), R(0), U8(vector->GetIndex(slot1)), // |
| 424 B(Return) // | 427 B(Return) // |
| 425 }, | 428 }, |
| 426 1, | 429 1, |
| 427 {"key"}}, | 430 {"key"}}, |
| 428 {"function f(a) { return a[100]; }\nf({100 : \"test\"})", | 431 {"function f(a) { return a[100]; }\nf({100 : \"test\"})", |
| 429 1 * kPointerSize, | 432 1 * kPointerSize, |
| 430 2, | 433 2, |
| 431 10, | 434 10, |
| 432 { | 435 { |
| 433 B(Ldar), R(helper.kLastParamIndex), // | 436 B(Ldar), R(helper.kLastParamIndex), // |
| 434 B(Star), R(0), // | 437 B(Star), R(0), // |
| 435 B(LdaSmi8), U8(100), // | 438 B(LdaSmi8), U8(100), // |
| 436 B(KeyedLoadIC), R(0), U8(vector->first_ic_slot_index()), // | 439 B(KeyedLoadIC), R(0), U8(vector->GetIndex(slot1)), // |
| 437 B(Return) // | 440 B(Return) // |
| 438 }, | 441 }, |
| 439 0}, | 442 0}, |
| 440 {"function f(a, b) { return a[b]; }\nf({arg : \"test\"}, \"arg\")", | 443 {"function f(a, b) { return a[b]; }\nf({arg : \"test\"}, \"arg\")", |
| 441 1 * kPointerSize, | 444 1 * kPointerSize, |
| 442 3, | 445 3, |
| 443 10, | 446 10, |
| 444 { | 447 { |
| 445 B(Ldar), R(helper.kLastParamIndex - 1), // | 448 B(Ldar), R(helper.kLastParamIndex - 1), // |
| 446 B(Star), R(0), // | 449 B(Star), R(0), // |
| 447 B(Ldar), R(helper.kLastParamIndex), // | 450 B(Ldar), R(helper.kLastParamIndex), // |
| 448 B(KeyedLoadIC), R(0), U8(vector->first_ic_slot_index()), // | 451 B(KeyedLoadIC), R(0), U8(vector->GetIndex(slot1)), // |
| 449 B(Return) // | 452 B(Return) // |
| 450 }, | 453 }, |
| 451 0}, | 454 0}, |
| 452 {"function f(a) { var b = a.name; return a[-124]; }\n" | 455 {"function f(a) { var b = a.name; return a[-124]; }\n" |
| 453 "f({\"-124\" : \"test\", name : 123 })", | 456 "f({\"-124\" : \"test\", name : 123 })", |
| 454 2 * kPointerSize, | 457 2 * kPointerSize, |
| 455 2, | 458 2, |
| 456 21, | 459 21, |
| 457 { | 460 { |
| 458 B(Ldar), R(helper.kLastParamIndex), // | 461 B(Ldar), R(helper.kLastParamIndex), // |
| 459 B(Star), R(1), // | 462 B(Star), R(1), // |
| 460 B(LdaConstant), U8(0), // | 463 B(LdaConstant), U8(0), // |
| 461 B(LoadIC), R(1), U8(vector->first_ic_slot_index()), // | 464 B(LoadIC), R(1), U8(vector->GetIndex(slot1)), // |
| 462 B(Star), R(0), // | 465 B(Star), R(0), // |
| 463 B(Ldar), R(helper.kLastParamIndex), // | 466 B(Ldar), R(helper.kLastParamIndex), // |
| 464 B(Star), R(1), // | 467 B(Star), R(1), // |
| 465 B(LdaSmi8), U8(-124), // | 468 B(LdaSmi8), U8(-124), // |
| 466 B(KeyedLoadIC), R(1), U8(vector->first_ic_slot_index() + 2), // | 469 B(KeyedLoadIC), R(1), U8(vector->GetIndex(slot2)), // |
| 467 B(Return) // | 470 B(Return) // |
| 468 }, | 471 }, |
| 469 1, | 472 1, |
| 470 {"name"}}}; | 473 {"name"}}}; |
| 471 for (size_t i = 0; i < arraysize(snippets); i++) { | 474 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 472 Handle<BytecodeArray> bytecode_array = | 475 Handle<BytecodeArray> bytecode_array = |
| 473 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 476 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 474 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 477 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 475 } | 478 } |
| 476 } | 479 } |
| 477 | 480 |
| 478 | 481 |
| 479 TEST(PropertyStores) { | 482 TEST(PropertyStores) { |
| 480 InitializedHandleScope handle_scope; | 483 InitializedHandleScope handle_scope; |
| 481 BytecodeGeneratorHelper helper; | 484 BytecodeGeneratorHelper helper; |
| 485 Zone zone; |
| 482 | 486 |
| 483 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC, | 487 FeedbackVectorSpec feedback_spec(&zone); |
| 484 i::FeedbackVectorSlotKind::STORE_IC}; | 488 FeedbackVectorSlot slot1 = feedback_spec.AddStoreICSlot(); |
| 485 StaticFeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 489 FeedbackVectorSlot slot2 = feedback_spec.AddStoreICSlot(); |
| 490 |
| 486 Handle<i::TypeFeedbackVector> vector = | 491 Handle<i::TypeFeedbackVector> vector = |
| 487 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 492 i::TypeFeedbackVector::New(helper.isolate(), &feedback_spec); |
| 488 | 493 |
| 489 ExpectedSnippet<const char*> snippets[] = { | 494 ExpectedSnippet<const char*> snippets[] = { |
| 490 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", | 495 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", |
| 491 2 * kPointerSize, | 496 2 * kPointerSize, |
| 492 2, | 497 2, |
| 493 16, | 498 16, |
| 494 { | 499 { |
| 495 B(Ldar), R(helper.kLastParamIndex), // | 500 B(Ldar), R(helper.kLastParamIndex), // |
| 496 B(Star), R(0), // | 501 B(Star), R(0), // |
| 497 B(LdaConstant), U8(0), // | 502 B(LdaConstant), U8(0), // |
| 498 B(Star), R(1), // | 503 B(Star), R(1), // |
| 499 B(LdaConstant), U8(1), // | 504 B(LdaConstant), U8(1), // |
| 500 B(StoreIC), R(0), R(1), U8(vector->first_ic_slot_index()), // | 505 B(StoreIC), R(0), R(1), U8(vector->GetIndex(slot1)), // |
| 501 B(LdaUndefined), // | 506 B(LdaUndefined), // |
| 502 B(Return) // | 507 B(Return) // |
| 503 }, | 508 }, |
| 504 2, | 509 2, |
| 505 {"name", "val"}}, | 510 {"name", "val"}}, |
| 506 {"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})", | 511 {"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})", |
| 507 2 * kPointerSize, | 512 2 * kPointerSize, |
| 508 2, | 513 2, |
| 509 16, | 514 16, |
| 510 { | 515 { |
| 511 B(Ldar), R(helper.kLastParamIndex), // | 516 B(Ldar), R(helper.kLastParamIndex), // |
| 512 B(Star), R(0), // | 517 B(Star), R(0), // |
| 513 B(LdaConstant), U8(0), // | 518 B(LdaConstant), U8(0), // |
| 514 B(Star), R(1), // | 519 B(Star), R(1), // |
| 515 B(LdaConstant), U8(1), // | 520 B(LdaConstant), U8(1), // |
| 516 B(StoreIC), R(0), R(1), U8(vector->first_ic_slot_index()), // | 521 B(StoreIC), R(0), R(1), U8(vector->GetIndex(slot1)), // |
| 517 B(LdaUndefined), // | 522 B(LdaUndefined), // |
| 518 B(Return) // | 523 B(Return) // |
| 519 }, | 524 }, |
| 520 2, | 525 2, |
| 521 {"key", "val"}}, | 526 {"key", "val"}}, |
| 522 {"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})", | 527 {"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})", |
| 523 2 * kPointerSize, | 528 2 * kPointerSize, |
| 524 2, | 529 2, |
| 525 16, | 530 16, |
| 526 { | 531 { |
| 527 B(Ldar), R(helper.kLastParamIndex), // | 532 B(Ldar), R(helper.kLastParamIndex), // |
| 528 B(Star), R(0), // | 533 B(Star), R(0), // |
| 529 B(LdaSmi8), U8(100), // | 534 B(LdaSmi8), U8(100), // |
| 530 B(Star), R(1), // | 535 B(Star), R(1), // |
| 531 B(LdaConstant), U8(0), // | 536 B(LdaConstant), U8(0), // |
| 532 B(KeyedStoreIC), R(0), R(1), U8(vector->first_ic_slot_index()), // | 537 B(KeyedStoreIC), R(0), R(1), U8(vector->GetIndex(slot1)), // |
| 533 B(LdaUndefined), // | 538 B(LdaUndefined), // |
| 534 B(Return) // | 539 B(Return) // |
| 535 }, | 540 }, |
| 536 1, | 541 1, |
| 537 {"val"}}, | 542 {"val"}}, |
| 538 {"function f(a, b) { a[b] = \"val\"; }\nf({arg : \"test\"}, \"arg\")", | 543 {"function f(a, b) { a[b] = \"val\"; }\nf({arg : \"test\"}, \"arg\")", |
| 539 2 * kPointerSize, | 544 2 * kPointerSize, |
| 540 3, | 545 3, |
| 541 16, | 546 16, |
| 542 { | 547 { |
| 543 B(Ldar), R(helper.kLastParamIndex - 1), // | 548 B(Ldar), R(helper.kLastParamIndex - 1), // |
| 544 B(Star), R(0), // | 549 B(Star), R(0), // |
| 545 B(Ldar), R(helper.kLastParamIndex), // | 550 B(Ldar), R(helper.kLastParamIndex), // |
| 546 B(Star), R(1), // | 551 B(Star), R(1), // |
| 547 B(LdaConstant), U8(0), // | 552 B(LdaConstant), U8(0), // |
| 548 B(KeyedStoreIC), R(0), R(1), U8(vector->first_ic_slot_index()), // | 553 B(KeyedStoreIC), R(0), R(1), U8(vector->GetIndex(slot1)), // |
| 549 B(LdaUndefined), // | 554 B(LdaUndefined), // |
| 550 B(Return) // | 555 B(Return) // |
| 551 }, | 556 }, |
| 552 1, | 557 1, |
| 553 {"val"}}, | 558 {"val"}}, |
| 554 {"function f(a) { a.name = a[-124]; }\n" | 559 {"function f(a) { a.name = a[-124]; }\n" |
| 555 "f({\"-124\" : \"test\", name : 123 })", | 560 "f({\"-124\" : \"test\", name : 123 })", |
| 556 3 * kPointerSize, | 561 3 * kPointerSize, |
| 557 2, | 562 2, |
| 558 23, | 563 23, |
| 559 { | 564 { |
| 560 B(Ldar), R(helper.kLastParamIndex), // | 565 B(Ldar), R(helper.kLastParamIndex), // |
| 561 B(Star), R(0), // | 566 B(Star), R(0), // |
| 562 B(LdaConstant), U8(0), // | 567 B(LdaConstant), U8(0), // |
| 563 B(Star), R(1), // | 568 B(Star), R(1), // |
| 564 B(Ldar), R(helper.kLastParamIndex), // | 569 B(Ldar), R(helper.kLastParamIndex), // |
| 565 B(Star), R(2), // | 570 B(Star), R(2), // |
| 566 B(LdaSmi8), U8(-124), // | 571 B(LdaSmi8), U8(-124), // |
| 567 B(KeyedLoadIC), R(2), U8(vector->first_ic_slot_index()), // | 572 B(KeyedLoadIC), R(2), U8(vector->GetIndex(slot1)), // |
| 568 B(StoreIC), R(0), R(1), U8(vector->first_ic_slot_index() + 2), // | 573 B(StoreIC), R(0), R(1), U8(vector->GetIndex(slot2)), // |
| 569 B(LdaUndefined), // | 574 B(LdaUndefined), // |
| 570 B(Return) // | 575 B(Return) // |
| 571 }, | 576 }, |
| 572 1, | 577 1, |
| 573 {"name"}}}; | 578 {"name"}}}; |
| 574 for (size_t i = 0; i < arraysize(snippets); i++) { | 579 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 575 Handle<BytecodeArray> bytecode_array = | 580 Handle<BytecodeArray> bytecode_array = |
| 576 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 581 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 577 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 582 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 578 } | 583 } |
| 579 } | 584 } |
| 580 | 585 |
| 581 | 586 |
| 582 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" | 587 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" |
| 583 | 588 |
| 584 | 589 |
| 585 TEST(PropertyCall) { | 590 TEST(PropertyCall) { |
| 586 InitializedHandleScope handle_scope; | 591 InitializedHandleScope handle_scope; |
| 587 BytecodeGeneratorHelper helper; // | 592 BytecodeGeneratorHelper helper; // |
| 593 Zone zone; |
| 588 | 594 |
| 589 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, | 595 FeedbackVectorSpec feedback_spec(&zone); |
| 590 i::FeedbackVectorSlotKind::LOAD_IC}; | 596 FeedbackVectorSlot slot1 = feedback_spec.AddLoadICSlot(); |
| 591 StaticFeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 597 FeedbackVectorSlot slot2 = feedback_spec.AddLoadICSlot(); |
| 598 USE(slot1); |
| 599 |
| 592 Handle<i::TypeFeedbackVector> vector = | 600 Handle<i::TypeFeedbackVector> vector = |
| 593 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 601 i::TypeFeedbackVector::New(helper.isolate(), &feedback_spec); |
| 594 | 602 |
| 595 ExpectedSnippet<const char*> snippets[] = { | 603 ExpectedSnippet<const char*> snippets[] = { |
| 596 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", | 604 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", |
| 597 2 * kPointerSize, | 605 2 * kPointerSize, |
| 598 2, | 606 2, |
| 599 16, | 607 16, |
| 600 { | 608 { |
| 601 B(Ldar), R(helper.kLastParamIndex), // | 609 B(Ldar), R(helper.kLastParamIndex), // |
| 602 B(Star), R(1), // | 610 B(Star), R(1), // |
| 603 B(LdaConstant), U8(0), // | 611 B(LdaConstant), U8(0), // |
| 604 B(LoadIC), R(1), U8(vector->first_ic_slot_index() + 2), // | 612 B(LoadIC), R(1), U8(vector->GetIndex(slot2)), // |
| 605 B(Star), R(0), // | 613 B(Star), R(0), // |
| 606 B(Call), R(0), R(1), U8(0), // | 614 B(Call), R(0), R(1), U8(0), // |
| 607 B(Return) // | 615 B(Return) // |
| 608 }, | 616 }, |
| 609 1, | 617 1, |
| 610 {"func"}}, | 618 {"func"}}, |
| 611 {"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)", | 619 {"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)", |
| 612 4 * kPointerSize, | 620 4 * kPointerSize, |
| 613 4, | 621 4, |
| 614 24, | 622 24, |
| 615 { | 623 { |
| 616 B(Ldar), R(helper.kLastParamIndex - 2), // | 624 B(Ldar), R(helper.kLastParamIndex - 2), // |
| 617 B(Star), R(1), // | 625 B(Star), R(1), // |
| 618 B(LdaConstant), U8(0), // | 626 B(LdaConstant), U8(0), // |
| 619 B(LoadIC), R(1), U8(vector->first_ic_slot_index() + 2), // | 627 B(LoadIC), R(1), U8(vector->GetIndex(slot2)), // |
| 620 B(Star), R(0), // | 628 B(Star), R(0), // |
| 621 B(Ldar), R(helper.kLastParamIndex - 1), // | 629 B(Ldar), R(helper.kLastParamIndex - 1), // |
| 622 B(Star), R(2), // | 630 B(Star), R(2), // |
| 623 B(Ldar), R(helper.kLastParamIndex), // | 631 B(Ldar), R(helper.kLastParamIndex), // |
| 624 B(Star), R(3), // | 632 B(Star), R(3), // |
| 625 B(Call), R(0), R(1), U8(2), // | 633 B(Call), R(0), R(1), U8(2), // |
| 626 B(Return) // | 634 B(Return) // |
| 627 }, | 635 }, |
| 628 1, | 636 1, |
| 629 {"func"}}, | 637 {"func"}}, |
| 630 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", | 638 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", |
| 631 4 * kPointerSize, | 639 4 * kPointerSize, |
| 632 3, | 640 3, |
| 633 30, | 641 30, |
| 634 { | 642 { |
| 635 B(Ldar), R(helper.kLastParamIndex - 1), // | 643 B(Ldar), R(helper.kLastParamIndex - 1), // |
| 636 B(Star), R(1), // | 644 B(Star), R(1), // |
| 637 B(LdaConstant), U8(0), // | 645 B(LdaConstant), U8(0), // |
| 638 B(LoadIC), R(1), U8(vector->first_ic_slot_index() + 2), // | 646 B(LoadIC), R(1), U8(vector->GetIndex(slot2)), // |
| 639 B(Star), R(0), // | 647 B(Star), R(0), // |
| 640 B(Ldar), R(helper.kLastParamIndex), // | 648 B(Ldar), R(helper.kLastParamIndex), // |
| 641 B(Star), R(2), // | 649 B(Star), R(2), // |
| 642 B(Ldar), R(helper.kLastParamIndex), // | 650 B(Ldar), R(helper.kLastParamIndex), // |
| 643 B(Add), R(2), // | 651 B(Add), R(2), // |
| 644 B(Star), R(2), // | 652 B(Star), R(2), // |
| 645 B(Ldar), R(helper.kLastParamIndex), // | 653 B(Ldar), R(helper.kLastParamIndex), // |
| 646 B(Star), R(3), // | 654 B(Star), R(3), // |
| 647 B(Call), R(0), R(1), U8(2), // | 655 B(Call), R(0), R(1), U8(2), // |
| 648 B(Return) // | 656 B(Return) // |
| 649 }, | 657 }, |
| 650 1, | 658 1, |
| 651 {"func"}}}; | 659 {"func"}}}; |
| 652 for (size_t i = 0; i < arraysize(snippets); i++) { | 660 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 653 Handle<BytecodeArray> bytecode_array = | 661 Handle<BytecodeArray> bytecode_array = |
| 654 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 662 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 655 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 663 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 656 } | 664 } |
| 657 } | 665 } |
| 658 | 666 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 Handle<BytecodeArray> bytecode_array = | 907 Handle<BytecodeArray> bytecode_array = |
| 900 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 908 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| 901 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 909 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 902 } | 910 } |
| 903 } | 911 } |
| 904 | 912 |
| 905 | 913 |
| 906 } // namespace interpreter | 914 } // namespace interpreter |
| 907 } // namespace internal | 915 } // namespace internal |
| 908 } // namespace v8 | 916 } // namespace v8 |
| OLD | NEW |