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

Side by Side Diff: src/code-stubs.cc

Issue 2504913002: Revert of [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (state.CouldCreateAllocationMementos()) { 315 if (state.CouldCreateAllocationMementos()) {
316 BinaryOpICWithAllocationSiteStub stub(isolate, state); 316 BinaryOpICWithAllocationSiteStub stub(isolate, state);
317 stub.GetCode(); 317 stub.GetCode();
318 } 318 }
319 } 319 }
320 320
321 void StringAddStub::PrintBaseName(std::ostream& os) const { // NOLINT 321 void StringAddStub::PrintBaseName(std::ostream& os) const { // NOLINT
322 os << "StringAddStub_" << flags() << "_" << pretenure_flag(); 322 os << "StringAddStub_" << flags() << "_" << pretenure_flag();
323 } 323 }
324 324
325 void StringAddStub::GenerateAssembly( 325 void StringAddStub::GenerateAssembly(CodeStubAssembler* assembler) const {
326 compiler::CodeAssemblerState* state) const {
327 typedef compiler::Node Node; 326 typedef compiler::Node Node;
328 CodeStubAssembler assembler(state); 327 Node* left = assembler->Parameter(Descriptor::kLeft);
329 Node* left = assembler.Parameter(Descriptor::kLeft); 328 Node* right = assembler->Parameter(Descriptor::kRight);
330 Node* right = assembler.Parameter(Descriptor::kRight); 329 Node* context = assembler->Parameter(Descriptor::kContext);
331 Node* context = assembler.Parameter(Descriptor::kContext);
332 330
333 if ((flags() & STRING_ADD_CHECK_LEFT) != 0) { 331 if ((flags() & STRING_ADD_CHECK_LEFT) != 0) {
334 DCHECK((flags() & STRING_ADD_CONVERT) != 0); 332 DCHECK((flags() & STRING_ADD_CONVERT) != 0);
335 // TODO(danno): The ToString and JSReceiverToPrimitive below could be 333 // TODO(danno): The ToString and JSReceiverToPrimitive below could be
336 // combined to avoid duplicate smi and instance type checks. 334 // combined to avoid duplicate smi and instance type checks.
337 left = assembler.ToString(context, 335 left = assembler->ToString(context,
338 assembler.JSReceiverToPrimitive(context, left)); 336 assembler->JSReceiverToPrimitive(context, left));
339 } 337 }
340 if ((flags() & STRING_ADD_CHECK_RIGHT) != 0) { 338 if ((flags() & STRING_ADD_CHECK_RIGHT) != 0) {
341 DCHECK((flags() & STRING_ADD_CONVERT) != 0); 339 DCHECK((flags() & STRING_ADD_CONVERT) != 0);
342 // TODO(danno): The ToString and JSReceiverToPrimitive below could be 340 // TODO(danno): The ToString and JSReceiverToPrimitive below could be
343 // combined to avoid duplicate smi and instance type checks. 341 // combined to avoid duplicate smi and instance type checks.
344 right = assembler.ToString(context, 342 right = assembler->ToString(
345 assembler.JSReceiverToPrimitive(context, right)); 343 context, assembler->JSReceiverToPrimitive(context, right));
346 } 344 }
347 345
348 if ((flags() & STRING_ADD_CHECK_BOTH) == 0) { 346 if ((flags() & STRING_ADD_CHECK_BOTH) == 0) {
349 CodeStubAssembler::AllocationFlag flags = 347 CodeStubAssembler::AllocationFlag flags =
350 (pretenure_flag() == TENURED) ? CodeStubAssembler::kPretenured 348 (pretenure_flag() == TENURED) ? CodeStubAssembler::kPretenured
351 : CodeStubAssembler::kNone; 349 : CodeStubAssembler::kNone;
352 assembler.Return(assembler.StringAdd(context, left, right, flags)); 350 assembler->Return(assembler->StringAdd(context, left, right, flags));
353 } else { 351 } else {
354 Callable callable = CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, 352 Callable callable = CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE,
355 pretenure_flag()); 353 pretenure_flag());
356 assembler.TailCallStub(callable, context, left, right); 354 assembler->TailCallStub(callable, context, left, right);
357 } 355 }
358 } 356 }
359 357
360 InlineCacheState CompareICStub::GetICState() const { 358 InlineCacheState CompareICStub::GetICState() const {
361 CompareICState::State state = Max(left(), right()); 359 CompareICState::State state = Max(left(), right());
362 switch (state) { 360 switch (state) {
363 case CompareICState::UNINITIALIZED: 361 case CompareICState::UNINITIALIZED:
364 return ::v8::internal::UNINITIALIZED; 362 return ::v8::internal::UNINITIALIZED;
365 case CompareICState::BOOLEAN: 363 case CompareICState::BOOLEAN:
366 case CompareICState::SMI: 364 case CompareICState::SMI:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 case CompareICState::GENERIC: 415 case CompareICState::GENERIC:
418 GenerateGeneric(masm); 416 GenerateGeneric(masm);
419 break; 417 break;
420 } 418 }
421 } 419 }
422 420
423 Handle<Code> TurboFanCodeStub::GenerateCode() { 421 Handle<Code> TurboFanCodeStub::GenerateCode() {
424 const char* name = CodeStub::MajorName(MajorKey()); 422 const char* name = CodeStub::MajorName(MajorKey());
425 Zone zone(isolate()->allocator(), ZONE_NAME); 423 Zone zone(isolate()->allocator(), ZONE_NAME);
426 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); 424 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor());
427 compiler::CodeAssemblerState state(isolate(), &zone, descriptor, 425 CodeStubAssembler assembler(isolate(), &zone, descriptor, GetCodeFlags(),
428 GetCodeFlags(), name); 426 name);
429 GenerateAssembly(&state); 427 GenerateAssembly(&assembler);
430 return compiler::CodeAssembler::GenerateCode(&state); 428 return assembler.GenerateCode();
431 } 429 }
432 430
433 void LoadICTrampolineStub::GenerateAssembly( 431 void LoadICTrampolineStub::GenerateAssembly(
434 compiler::CodeAssemblerState* state) const { 432 CodeStubAssembler* assembler) const {
435 typedef compiler::Node Node; 433 typedef compiler::Node Node;
436 CodeStubAssembler assembler(state); 434
437 435 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
438 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 436 Node* name = assembler->Parameter(Descriptor::kName);
439 Node* name = assembler.Parameter(Descriptor::kName); 437 Node* slot = assembler->Parameter(Descriptor::kSlot);
440 Node* slot = assembler.Parameter(Descriptor::kSlot); 438 Node* context = assembler->Parameter(Descriptor::kContext);
441 Node* context = assembler.Parameter(Descriptor::kContext); 439 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
442 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); 440
443 441 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
444 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); 442 assembler->LoadIC(&p);
445 assembler.LoadIC(&p); 443 }
446 } 444
447 445 void LoadICStub::GenerateAssembly(CodeStubAssembler* assembler) const {
448 void LoadICStub::GenerateAssembly(compiler::CodeAssemblerState* state) const { 446 typedef compiler::Node Node;
449 typedef compiler::Node Node; 447
450 CodeStubAssembler assembler(state); 448 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
451 449 Node* name = assembler->Parameter(Descriptor::kName);
452 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 450 Node* slot = assembler->Parameter(Descriptor::kSlot);
453 Node* name = assembler.Parameter(Descriptor::kName); 451 Node* vector = assembler->Parameter(Descriptor::kVector);
454 Node* slot = assembler.Parameter(Descriptor::kSlot); 452 Node* context = assembler->Parameter(Descriptor::kContext);
455 Node* vector = assembler.Parameter(Descriptor::kVector); 453
456 Node* context = assembler.Parameter(Descriptor::kContext); 454 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
457 455 assembler->LoadIC(&p);
458 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
459 assembler.LoadIC(&p);
460 } 456 }
461 457
462 void LoadICProtoArrayStub::GenerateAssembly( 458 void LoadICProtoArrayStub::GenerateAssembly(
463 compiler::CodeAssemblerState* state) const { 459 CodeStubAssembler* assembler) const {
464 typedef compiler::Node Node; 460 typedef compiler::Node Node;
465 CodeStubAssembler assembler(state); 461
466 462 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
467 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 463 Node* name = assembler->Parameter(Descriptor::kName);
468 Node* name = assembler.Parameter(Descriptor::kName); 464 Node* slot = assembler->Parameter(Descriptor::kSlot);
469 Node* slot = assembler.Parameter(Descriptor::kSlot); 465 Node* vector = assembler->Parameter(Descriptor::kVector);
470 Node* vector = assembler.Parameter(Descriptor::kVector); 466 Node* handler = assembler->Parameter(Descriptor::kHandler);
471 Node* handler = assembler.Parameter(Descriptor::kHandler); 467 Node* context = assembler->Parameter(Descriptor::kContext);
472 Node* context = assembler.Parameter(Descriptor::kContext); 468
473 469 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
474 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); 470 assembler->LoadICProtoArray(&p, handler);
475 assembler.LoadICProtoArray(&p, handler);
476 } 471 }
477 472
478 void LoadGlobalICTrampolineStub::GenerateAssembly( 473 void LoadGlobalICTrampolineStub::GenerateAssembly(
479 compiler::CodeAssemblerState* state) const { 474 CodeStubAssembler* assembler) const {
480 typedef compiler::Node Node; 475 typedef compiler::Node Node;
481 CodeStubAssembler assembler(state); 476
482 477 Node* slot = assembler->Parameter(Descriptor::kSlot);
483 Node* slot = assembler.Parameter(Descriptor::kSlot); 478 Node* context = assembler->Parameter(Descriptor::kContext);
484 Node* context = assembler.Parameter(Descriptor::kContext); 479 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
485 Node* vector = assembler.LoadTypeFeedbackVectorForStub();
486 480
487 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, 481 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot,
488 vector); 482 vector);
489 assembler.LoadGlobalIC(&p); 483 assembler->LoadGlobalIC(&p);
490 } 484 }
491 485
492 void LoadGlobalICStub::GenerateAssembly( 486 void LoadGlobalICStub::GenerateAssembly(CodeStubAssembler* assembler) const {
493 compiler::CodeAssemblerState* state) const { 487 typedef compiler::Node Node;
494 typedef compiler::Node Node; 488
495 CodeStubAssembler assembler(state); 489 Node* slot = assembler->Parameter(Descriptor::kSlot);
496 490 Node* vector = assembler->Parameter(Descriptor::kVector);
497 Node* slot = assembler.Parameter(Descriptor::kSlot); 491 Node* context = assembler->Parameter(Descriptor::kContext);
498 Node* vector = assembler.Parameter(Descriptor::kVector);
499 Node* context = assembler.Parameter(Descriptor::kContext);
500 492
501 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, 493 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot,
502 vector); 494 vector);
503 assembler.LoadGlobalIC(&p); 495 assembler->LoadGlobalIC(&p);
504 } 496 }
505 497
506 void KeyedLoadICTrampolineTFStub::GenerateAssembly( 498 void KeyedLoadICTrampolineTFStub::GenerateAssembly(
507 compiler::CodeAssemblerState* state) const { 499 CodeStubAssembler* assembler) const {
508 typedef compiler::Node Node; 500 typedef compiler::Node Node;
509 CodeStubAssembler assembler(state); 501
510 502 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
511 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 503 Node* name = assembler->Parameter(Descriptor::kName);
512 Node* name = assembler.Parameter(Descriptor::kName); 504 Node* slot = assembler->Parameter(Descriptor::kSlot);
513 Node* slot = assembler.Parameter(Descriptor::kSlot); 505 Node* context = assembler->Parameter(Descriptor::kContext);
514 Node* context = assembler.Parameter(Descriptor::kContext); 506 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
515 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); 507
516 508 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
517 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); 509 assembler->KeyedLoadIC(&p);
518 assembler.KeyedLoadIC(&p); 510 }
519 } 511
520 512 void KeyedLoadICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const {
521 void KeyedLoadICTFStub::GenerateAssembly( 513 typedef compiler::Node Node;
522 compiler::CodeAssemblerState* state) const { 514
523 typedef compiler::Node Node; 515 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
524 CodeStubAssembler assembler(state); 516 Node* name = assembler->Parameter(Descriptor::kName);
525 517 Node* slot = assembler->Parameter(Descriptor::kSlot);
526 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 518 Node* vector = assembler->Parameter(Descriptor::kVector);
527 Node* name = assembler.Parameter(Descriptor::kName); 519 Node* context = assembler->Parameter(Descriptor::kContext);
528 Node* slot = assembler.Parameter(Descriptor::kSlot); 520
529 Node* vector = assembler.Parameter(Descriptor::kVector); 521 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
530 Node* context = assembler.Parameter(Descriptor::kContext); 522 assembler->KeyedLoadIC(&p);
531
532 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
533 assembler.KeyedLoadIC(&p);
534 } 523 }
535 524
536 void StoreICTrampolineStub::GenerateAssembly( 525 void StoreICTrampolineStub::GenerateAssembly(
537 compiler::CodeAssemblerState* state) const { 526 CodeStubAssembler* assembler) const {
538 typedef compiler::Node Node; 527 typedef compiler::Node Node;
539 CodeStubAssembler assembler(state); 528
540 529 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
541 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 530 Node* name = assembler->Parameter(Descriptor::kName);
542 Node* name = assembler.Parameter(Descriptor::kName); 531 Node* value = assembler->Parameter(Descriptor::kValue);
543 Node* value = assembler.Parameter(Descriptor::kValue); 532 Node* slot = assembler->Parameter(Descriptor::kSlot);
544 Node* slot = assembler.Parameter(Descriptor::kSlot); 533 Node* context = assembler->Parameter(Descriptor::kContext);
545 Node* context = assembler.Parameter(Descriptor::kContext); 534 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
546 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); 535
547 536 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot,
548 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, 537 vector);
549 vector); 538 assembler->StoreIC(&p);
550 assembler.StoreIC(&p); 539 }
551 } 540
552 541 void StoreICStub::GenerateAssembly(CodeStubAssembler* assembler) const {
553 void StoreICStub::GenerateAssembly(compiler::CodeAssemblerState* state) const { 542 typedef compiler::Node Node;
554 typedef compiler::Node Node; 543
555 CodeStubAssembler assembler(state); 544 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
556 545 Node* name = assembler->Parameter(Descriptor::kName);
557 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 546 Node* value = assembler->Parameter(Descriptor::kValue);
558 Node* name = assembler.Parameter(Descriptor::kName); 547 Node* slot = assembler->Parameter(Descriptor::kSlot);
559 Node* value = assembler.Parameter(Descriptor::kValue); 548 Node* vector = assembler->Parameter(Descriptor::kVector);
560 Node* slot = assembler.Parameter(Descriptor::kSlot); 549 Node* context = assembler->Parameter(Descriptor::kContext);
561 Node* vector = assembler.Parameter(Descriptor::kVector); 550
562 Node* context = assembler.Parameter(Descriptor::kContext); 551 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot,
563 552 vector);
564 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, 553 assembler->StoreIC(&p);
565 vector);
566 assembler.StoreIC(&p);
567 } 554 }
568 555
569 void KeyedStoreICTrampolineTFStub::GenerateAssembly( 556 void KeyedStoreICTrampolineTFStub::GenerateAssembly(
570 compiler::CodeAssemblerState* state) const { 557 CodeStubAssembler* assembler) const {
571 typedef compiler::Node Node; 558 typedef compiler::Node Node;
572 CodeStubAssembler assembler(state); 559
573 560 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
574 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 561 Node* name = assembler->Parameter(Descriptor::kName);
575 Node* name = assembler.Parameter(Descriptor::kName); 562 Node* value = assembler->Parameter(Descriptor::kValue);
576 Node* value = assembler.Parameter(Descriptor::kValue); 563 Node* slot = assembler->Parameter(Descriptor::kSlot);
577 Node* slot = assembler.Parameter(Descriptor::kSlot); 564 Node* context = assembler->Parameter(Descriptor::kContext);
578 Node* context = assembler.Parameter(Descriptor::kContext); 565 Node* vector = assembler->LoadTypeFeedbackVectorForStub();
579 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); 566
580 567 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot,
581 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, 568 vector);
582 vector); 569 assembler->KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState()));
583 assembler.KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState())); 570 }
584 } 571
585 572 void KeyedStoreICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const {
586 void KeyedStoreICTFStub::GenerateAssembly( 573 typedef compiler::Node Node;
587 compiler::CodeAssemblerState* state) const { 574
588 typedef compiler::Node Node; 575 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
589 CodeStubAssembler assembler(state); 576 Node* name = assembler->Parameter(Descriptor::kName);
590 577 Node* value = assembler->Parameter(Descriptor::kValue);
591 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 578 Node* slot = assembler->Parameter(Descriptor::kSlot);
592 Node* name = assembler.Parameter(Descriptor::kName); 579 Node* vector = assembler->Parameter(Descriptor::kVector);
593 Node* value = assembler.Parameter(Descriptor::kValue); 580 Node* context = assembler->Parameter(Descriptor::kContext);
594 Node* slot = assembler.Parameter(Descriptor::kSlot); 581
595 Node* vector = assembler.Parameter(Descriptor::kVector); 582 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot,
596 Node* context = assembler.Parameter(Descriptor::kContext); 583 vector);
597 584 assembler->KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState()));
598 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, 585 }
599 vector); 586
600 assembler.KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState())); 587 void StoreMapStub::GenerateAssembly(CodeStubAssembler* assembler) const {
601 } 588 typedef compiler::Node Node;
602 589
603 void StoreMapStub::GenerateAssembly(compiler::CodeAssemblerState* state) const { 590 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
604 typedef compiler::Node Node; 591 Node* map = assembler->Parameter(Descriptor::kMap);
605 CodeStubAssembler assembler(state); 592 Node* value = assembler->Parameter(Descriptor::kValue);
606 593
607 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 594 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map);
608 Node* map = assembler.Parameter(Descriptor::kMap); 595 assembler->Return(value);
609 Node* value = assembler.Parameter(Descriptor::kValue); 596 }
610 597
611 assembler.StoreObjectField(receiver, JSObject::kMapOffset, map); 598 void StoreTransitionStub::GenerateAssembly(CodeStubAssembler* assembler) const {
612 assembler.Return(value);
613 }
614
615 void StoreTransitionStub::GenerateAssembly(
616 compiler::CodeAssemblerState* state) const {
617 typedef CodeStubAssembler::Label Label; 599 typedef CodeStubAssembler::Label Label;
618 typedef compiler::Node Node; 600 typedef compiler::Node Node;
619 CodeStubAssembler assembler(state); 601
620 602 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
621 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 603 Node* name = assembler->Parameter(Descriptor::kName);
622 Node* name = assembler.Parameter(Descriptor::kName);
623 Node* offset = 604 Node* offset =
624 assembler.SmiUntag(assembler.Parameter(Descriptor::kFieldOffset)); 605 assembler->SmiUntag(assembler->Parameter(Descriptor::kFieldOffset));
625 Node* value = assembler.Parameter(Descriptor::kValue); 606 Node* value = assembler->Parameter(Descriptor::kValue);
626 Node* map = assembler.Parameter(Descriptor::kMap); 607 Node* map = assembler->Parameter(Descriptor::kMap);
627 Node* slot = assembler.Parameter(Descriptor::kSlot); 608 Node* slot = assembler->Parameter(Descriptor::kSlot);
628 Node* vector = assembler.Parameter(Descriptor::kVector); 609 Node* vector = assembler->Parameter(Descriptor::kVector);
629 Node* context = assembler.Parameter(Descriptor::kContext); 610 Node* context = assembler->Parameter(Descriptor::kContext);
630 611
631 Label miss(&assembler); 612 Label miss(assembler);
632 613
633 Representation representation = this->representation(); 614 Representation representation = this->representation();
634 assembler.Comment("StoreTransitionStub: is_inobject: %d: representation: %s", 615 assembler->Comment("StoreTransitionStub: is_inobject: %d: representation: %s",
635 is_inobject(), representation.Mnemonic()); 616 is_inobject(), representation.Mnemonic());
636 617
637 Node* prepared_value = 618 Node* prepared_value =
638 assembler.PrepareValueForWrite(value, representation, &miss); 619 assembler->PrepareValueForWrite(value, representation, &miss);
639 620
640 if (store_mode() == StoreTransitionStub::ExtendStorageAndStoreMapAndValue) { 621 if (store_mode() == StoreTransitionStub::ExtendStorageAndStoreMapAndValue) {
641 assembler.Comment("Extend storage"); 622 assembler->Comment("Extend storage");
642 assembler.ExtendPropertiesBackingStore(receiver); 623 assembler->ExtendPropertiesBackingStore(receiver);
643 } else { 624 } else {
644 DCHECK(store_mode() == StoreTransitionStub::StoreMapAndValue); 625 DCHECK(store_mode() == StoreTransitionStub::StoreMapAndValue);
645 } 626 }
646 627
647 // Store the new value into the "extended" object. 628 // Store the new value into the "extended" object.
648 assembler.Comment("Store value"); 629 assembler->Comment("Store value");
649 assembler.StoreNamedField(receiver, offset, is_inobject(), representation, 630 assembler->StoreNamedField(receiver, offset, is_inobject(), representation,
650 prepared_value, true); 631 prepared_value, true);
651 632
652 // And finally update the map. 633 // And finally update the map.
653 assembler.Comment("Store map"); 634 assembler->Comment("Store map");
654 assembler.StoreObjectField(receiver, JSObject::kMapOffset, map); 635 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map);
655 assembler.Return(value); 636 assembler->Return(value);
656 637
657 // Only store to tagged field never bails out. 638 // Only store to tagged field never bails out.
658 if (!representation.IsTagged()) { 639 if (!representation.IsTagged()) {
659 assembler.Bind(&miss); 640 assembler->Bind(&miss);
660 { 641 {
661 assembler.Comment("Miss"); 642 assembler->Comment("Miss");
662 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, 643 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
663 vector, receiver, name); 644 vector, receiver, name);
664 } 645 }
665 } 646 }
666 } 647 }
667 648
668 void ElementsTransitionAndStoreStub::GenerateAssembly( 649 void ElementsTransitionAndStoreStub::GenerateAssembly(
669 compiler::CodeAssemblerState* state) const { 650 CodeStubAssembler* assembler) const {
670 typedef CodeStubAssembler::Label Label; 651 typedef CodeStubAssembler::Label Label;
671 typedef compiler::Node Node; 652 typedef compiler::Node Node;
672 CodeStubAssembler assembler(state); 653
673 654 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
674 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 655 Node* key = assembler->Parameter(Descriptor::kName);
675 Node* key = assembler.Parameter(Descriptor::kName); 656 Node* value = assembler->Parameter(Descriptor::kValue);
676 Node* value = assembler.Parameter(Descriptor::kValue); 657 Node* map = assembler->Parameter(Descriptor::kMap);
677 Node* map = assembler.Parameter(Descriptor::kMap); 658 Node* slot = assembler->Parameter(Descriptor::kSlot);
678 Node* slot = assembler.Parameter(Descriptor::kSlot); 659 Node* vector = assembler->Parameter(Descriptor::kVector);
679 Node* vector = assembler.Parameter(Descriptor::kVector); 660 Node* context = assembler->Parameter(Descriptor::kContext);
680 Node* context = assembler.Parameter(Descriptor::kContext); 661
681 662 assembler->Comment(
682 assembler.Comment(
683 "ElementsTransitionAndStoreStub: from_kind=%s, to_kind=%s," 663 "ElementsTransitionAndStoreStub: from_kind=%s, to_kind=%s,"
684 " is_jsarray=%d, store_mode=%d", 664 " is_jsarray=%d, store_mode=%d",
685 ElementsKindToString(from_kind()), ElementsKindToString(to_kind()), 665 ElementsKindToString(from_kind()), ElementsKindToString(to_kind()),
686 is_jsarray(), store_mode()); 666 is_jsarray(), store_mode());
687 667
688 Label miss(&assembler); 668 Label miss(assembler);
689 669
690 if (FLAG_trace_elements_transitions) { 670 if (FLAG_trace_elements_transitions) {
691 // Tracing elements transitions is the job of the runtime. 671 // Tracing elements transitions is the job of the runtime.
692 assembler.Goto(&miss); 672 assembler->Goto(&miss);
693 } else { 673 } else {
694 assembler.TransitionElementsKind(receiver, map, from_kind(), to_kind(), 674 assembler->TransitionElementsKind(receiver, map, from_kind(), to_kind(),
695 is_jsarray(), &miss); 675 is_jsarray(), &miss);
696 assembler.EmitElementStore(receiver, key, value, is_jsarray(), to_kind(), 676 assembler->EmitElementStore(receiver, key, value, is_jsarray(), to_kind(),
697 store_mode(), &miss); 677 store_mode(), &miss);
698 assembler.Return(value); 678 assembler->Return(value);
699 } 679 }
700 680
701 assembler.Bind(&miss); 681 assembler->Bind(&miss);
702 { 682 {
703 assembler.Comment("Miss"); 683 assembler->Comment("Miss");
704 assembler.TailCallRuntime(Runtime::kElementsTransitionAndStoreIC_Miss, 684 assembler->TailCallRuntime(Runtime::kElementsTransitionAndStoreIC_Miss,
705 context, receiver, key, value, map, slot, vector); 685 context, receiver, key, value, map, slot,
686 vector);
706 } 687 }
707 } 688 }
708 689
709 void AllocateHeapNumberStub::GenerateAssembly( 690 void AllocateHeapNumberStub::GenerateAssembly(
710 compiler::CodeAssemblerState* state) const { 691 CodeStubAssembler* assembler) const {
711 typedef compiler::Node Node; 692 typedef compiler::Node Node;
712 CodeStubAssembler assembler(state); 693
713 694 Node* result = assembler->AllocateHeapNumber();
714 Node* result = assembler.AllocateHeapNumber(); 695 assembler->Return(result);
715 assembler.Return(result); 696 }
716 } 697
717 698 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \
718 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \ 699 void Allocate##Type##Stub::GenerateAssembly(CodeStubAssembler* assembler) \
719 void Allocate##Type##Stub::GenerateAssembly( \ 700 const { \
720 compiler::CodeAssemblerState* state) const { \ 701 compiler::Node* result = \
721 CodeStubAssembler assembler(state); \ 702 assembler->Allocate(Simd128Value::kSize, CodeStubAssembler::kNone); \
722 compiler::Node* result = \ 703 compiler::Node* map = assembler->LoadMap(result); \
723 assembler.Allocate(Simd128Value::kSize, CodeStubAssembler::kNone); \ 704 assembler->StoreNoWriteBarrier( \
724 compiler::Node* map = assembler.LoadMap(result); \ 705 MachineRepresentation::kTagged, map, \
725 assembler.StoreNoWriteBarrier( \ 706 assembler->HeapConstant(isolate()->factory()->type##_map())); \
726 MachineRepresentation::kTagged, map, \ 707 assembler->Return(result); \
727 assembler.HeapConstant(isolate()->factory()->type##_map())); \
728 assembler.Return(result); \
729 } 708 }
730 SIMD128_TYPES(SIMD128_GEN_ASM) 709 SIMD128_TYPES(SIMD128_GEN_ASM)
731 #undef SIMD128_GEN_ASM 710 #undef SIMD128_GEN_ASM
732 711
733 void StringLengthStub::GenerateAssembly( 712 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const {
734 compiler::CodeAssemblerState* state) const { 713 compiler::Node* value = assembler->Parameter(0);
735 CodeStubAssembler assembler(state); 714 compiler::Node* string = assembler->LoadJSValueValue(value);
736 compiler::Node* value = assembler.Parameter(0); 715 compiler::Node* result = assembler->LoadStringLength(string);
737 compiler::Node* string = assembler.LoadJSValueValue(value); 716 assembler->Return(result);
738 compiler::Node* result = assembler.LoadStringLength(string); 717 }
739 assembler.Return(result);
740 }
741
742 #define BINARY_OP_STUB(Name) \
743 void Name::GenerateAssembly(compiler::CodeAssemblerState* state) const { \
744 typedef BinaryOpWithVectorDescriptor Descriptor; \
745 CodeStubAssembler assembler(state); \
746 assembler.Return(Generate(&assembler, \
747 assembler.Parameter(Descriptor::kLeft), \
748 assembler.Parameter(Descriptor::kRight), \
749 assembler.Parameter(Descriptor::kSlot), \
750 assembler.Parameter(Descriptor::kVector), \
751 assembler.Parameter(Descriptor::kContext))); \
752 }
753 BINARY_OP_STUB(AddWithFeedbackStub)
754 BINARY_OP_STUB(SubtractWithFeedbackStub)
755 BINARY_OP_STUB(MultiplyWithFeedbackStub)
756 BINARY_OP_STUB(DivideWithFeedbackStub)
757 BINARY_OP_STUB(ModulusWithFeedbackStub)
758 #undef BINARY_OP_STUB
759 718
760 // static 719 // static
761 compiler::Node* AddWithFeedbackStub::Generate( 720 compiler::Node* AddWithFeedbackStub::Generate(
762 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* rhs, 721 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* rhs,
763 compiler::Node* slot_id, compiler::Node* type_feedback_vector, 722 compiler::Node* slot_id, compiler::Node* type_feedback_vector,
764 compiler::Node* context) { 723 compiler::Node* context) {
765 typedef CodeStubAssembler::Label Label; 724 typedef CodeStubAssembler::Label Label;
766 typedef compiler::Node Node; 725 typedef compiler::Node Node;
767 typedef CodeStubAssembler::Variable Variable; 726 typedef CodeStubAssembler::Variable Variable;
768 727
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor)); 1659 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor));
1701 assembler->Goto(&end); 1660 assembler->Goto(&end);
1702 } 1661 }
1703 1662
1704 assembler->Bind(&end); 1663 assembler->Bind(&end);
1705 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, 1664 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector,
1706 slot_id); 1665 slot_id);
1707 return var_result.value(); 1666 return var_result.value();
1708 } 1667 }
1709 1668
1710 #define UNARY_OP_STUB(Name) \
1711 void Name::GenerateAssembly(compiler::CodeAssemblerState* state) const { \
1712 CodeStubAssembler assembler(state); \
1713 assembler.Return(Generate(&assembler, assembler.Parameter(0), \
1714 assembler.Parameter(1), assembler.Parameter(2), \
1715 assembler.Parameter(3))); \
1716 }
1717 UNARY_OP_STUB(IncStub)
1718 UNARY_OP_STUB(DecStub)
1719 #undef UNARY_OP_STUB
1720
1721 // static 1669 // static
1722 compiler::Node* IncStub::Generate(CodeStubAssembler* assembler, 1670 compiler::Node* IncStub::Generate(CodeStubAssembler* assembler,
1723 compiler::Node* value, 1671 compiler::Node* value,
1724 compiler::Node* context, 1672 compiler::Node* context,
1725 compiler::Node* type_feedback_vector, 1673 compiler::Node* type_feedback_vector,
1726 compiler::Node* slot_id) { 1674 compiler::Node* slot_id) {
1727 typedef CodeStubAssembler::Label Label; 1675 typedef CodeStubAssembler::Label Label;
1728 typedef compiler::Node Node; 1676 typedef compiler::Node Node;
1729 typedef CodeStubAssembler::Variable Variable; 1677 typedef CodeStubAssembler::Variable Variable;
1730 1678
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 result_var.Bind(assembler->AllocateHeapNumberWithValue(finc_result)); 1792 result_var.Bind(assembler->AllocateHeapNumberWithValue(finc_result));
1845 assembler->Goto(&end); 1793 assembler->Goto(&end);
1846 } 1794 }
1847 1795
1848 assembler->Bind(&end); 1796 assembler->Bind(&end);
1849 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, 1797 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector,
1850 slot_id); 1798 slot_id);
1851 return result_var.value(); 1799 return result_var.value();
1852 } 1800 }
1853 1801
1854 void NumberToStringStub::GenerateAssembly( 1802 void NumberToStringStub::GenerateAssembly(CodeStubAssembler* assembler) const {
1855 compiler::CodeAssemblerState* state) const {
1856 typedef compiler::Node Node; 1803 typedef compiler::Node Node;
1857 CodeStubAssembler assembler(state); 1804 Node* argument = assembler->Parameter(Descriptor::kArgument);
1858 Node* argument = assembler.Parameter(Descriptor::kArgument); 1805 Node* context = assembler->Parameter(Descriptor::kContext);
1859 Node* context = assembler.Parameter(Descriptor::kContext); 1806 assembler->Return(assembler->NumberToString(context, argument));
1860 assembler.Return(assembler.NumberToString(context, argument));
1861 } 1807 }
1862 1808
1863 // static 1809 // static
1864 compiler::Node* DecStub::Generate(CodeStubAssembler* assembler, 1810 compiler::Node* DecStub::Generate(CodeStubAssembler* assembler,
1865 compiler::Node* value, 1811 compiler::Node* value,
1866 compiler::Node* context, 1812 compiler::Node* context,
1867 compiler::Node* type_feedback_vector, 1813 compiler::Node* type_feedback_vector,
1868 compiler::Node* slot_id) { 1814 compiler::Node* slot_id) {
1869 typedef CodeStubAssembler::Label Label; 1815 typedef CodeStubAssembler::Label Label;
1870 typedef compiler::Node Node; 1816 typedef compiler::Node Node;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 1941
1996 // ES6 section 21.1.3.19 String.prototype.substring ( start, end ) 1942 // ES6 section 21.1.3.19 String.prototype.substring ( start, end )
1997 compiler::Node* SubStringStub::Generate(CodeStubAssembler* assembler, 1943 compiler::Node* SubStringStub::Generate(CodeStubAssembler* assembler,
1998 compiler::Node* string, 1944 compiler::Node* string,
1999 compiler::Node* from, 1945 compiler::Node* from,
2000 compiler::Node* to, 1946 compiler::Node* to,
2001 compiler::Node* context) { 1947 compiler::Node* context) {
2002 return assembler->SubString(context, string, from, to); 1948 return assembler->SubString(context, string, from, to);
2003 } 1949 }
2004 1950
2005 void SubStringStub::GenerateAssembly( 1951 void LoadApiGetterStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2006 compiler::CodeAssemblerState* state) const {
2007 CodeStubAssembler assembler(state);
2008 assembler.Return(Generate(&assembler,
2009 assembler.Parameter(Descriptor::kString),
2010 assembler.Parameter(Descriptor::kFrom),
2011 assembler.Parameter(Descriptor::kTo),
2012 assembler.Parameter(Descriptor::kContext)));
2013 }
2014
2015 void LoadApiGetterStub::GenerateAssembly(
2016 compiler::CodeAssemblerState* state) const {
2017 typedef compiler::Node Node; 1952 typedef compiler::Node Node;
2018 CodeStubAssembler assembler(state); 1953 Node* context = assembler->Parameter(Descriptor::kContext);
2019 Node* context = assembler.Parameter(Descriptor::kContext); 1954 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2020 Node* receiver = assembler.Parameter(Descriptor::kReceiver);
2021 // For now we only support receiver_is_holder. 1955 // For now we only support receiver_is_holder.
2022 DCHECK(receiver_is_holder()); 1956 DCHECK(receiver_is_holder());
2023 Node* holder = receiver; 1957 Node* holder = receiver;
2024 Node* map = assembler.LoadMap(receiver); 1958 Node* map = assembler->LoadMap(receiver);
2025 Node* descriptors = assembler.LoadMapDescriptors(map); 1959 Node* descriptors = assembler->LoadMapDescriptors(map);
2026 Node* value_index = 1960 Node* value_index =
2027 assembler.IntPtrConstant(DescriptorArray::ToValueIndex(index())); 1961 assembler->IntPtrConstant(DescriptorArray::ToValueIndex(index()));
2028 Node* callback = assembler.LoadFixedArrayElement( 1962 Node* callback = assembler->LoadFixedArrayElement(
2029 descriptors, value_index, 0, CodeStubAssembler::INTPTR_PARAMETERS); 1963 descriptors, value_index, 0, CodeStubAssembler::INTPTR_PARAMETERS);
2030 assembler.TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver, 1964 assembler->TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver,
2031 holder, callback); 1965 holder, callback);
2032 } 1966 }
2033 1967
2034 void StoreFieldStub::GenerateAssembly( 1968 void StoreFieldStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2035 compiler::CodeAssemblerState* state) const {
2036 typedef CodeStubAssembler::Label Label; 1969 typedef CodeStubAssembler::Label Label;
2037 typedef compiler::Node Node; 1970 typedef compiler::Node Node;
2038 CodeStubAssembler assembler(state);
2039 1971
2040 FieldIndex index = this->index(); 1972 FieldIndex index = this->index();
2041 Representation representation = this->representation(); 1973 Representation representation = this->representation();
2042 1974
2043 assembler.Comment("StoreFieldStub: inobject=%d, offset=%d, rep=%s", 1975 assembler->Comment("StoreFieldStub: inobject=%d, offset=%d, rep=%s",
2044 index.is_inobject(), index.offset(), 1976 index.is_inobject(), index.offset(),
2045 representation.Mnemonic()); 1977 representation.Mnemonic());
2046 1978
2047 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 1979 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2048 Node* name = assembler.Parameter(Descriptor::kName); 1980 Node* name = assembler->Parameter(Descriptor::kName);
2049 Node* value = assembler.Parameter(Descriptor::kValue); 1981 Node* value = assembler->Parameter(Descriptor::kValue);
2050 Node* slot = assembler.Parameter(Descriptor::kSlot); 1982 Node* slot = assembler->Parameter(Descriptor::kSlot);
2051 Node* vector = assembler.Parameter(Descriptor::kVector); 1983 Node* vector = assembler->Parameter(Descriptor::kVector);
2052 Node* context = assembler.Parameter(Descriptor::kContext); 1984 Node* context = assembler->Parameter(Descriptor::kContext);
2053 1985
2054 Label miss(&assembler); 1986 Label miss(assembler);
2055 1987
2056 Node* prepared_value = 1988 Node* prepared_value =
2057 assembler.PrepareValueForWrite(value, representation, &miss); 1989 assembler->PrepareValueForWrite(value, representation, &miss);
2058 assembler.StoreNamedField(receiver, index, representation, prepared_value, 1990 assembler->StoreNamedField(receiver, index, representation, prepared_value,
2059 false); 1991 false);
2060 assembler.Return(value); 1992 assembler->Return(value);
2061 1993
2062 // Only stores to tagged field can't bailout. 1994 // Only stores to tagged field can't bailout.
2063 if (!representation.IsTagged()) { 1995 if (!representation.IsTagged()) {
2064 assembler.Bind(&miss); 1996 assembler->Bind(&miss);
2065 { 1997 {
2066 assembler.Comment("Miss"); 1998 assembler->Comment("Miss");
2067 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, 1999 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
2068 vector, receiver, name); 2000 vector, receiver, name);
2069 } 2001 }
2070 } 2002 }
2071 } 2003 }
2072 2004
2073 void StoreGlobalStub::GenerateAssembly( 2005 void StoreGlobalStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2074 compiler::CodeAssemblerState* state) const {
2075 typedef CodeStubAssembler::Label Label; 2006 typedef CodeStubAssembler::Label Label;
2076 typedef compiler::Node Node; 2007 typedef compiler::Node Node;
2077 CodeStubAssembler assembler(state);
2078 2008
2079 assembler.Comment( 2009 assembler->Comment(
2080 "StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d", 2010 "StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d",
2081 cell_type(), PropertyCellType::kConstantType == cell_type() 2011 cell_type(), PropertyCellType::kConstantType == cell_type()
2082 ? static_cast<int>(constant_type()) 2012 ? static_cast<int>(constant_type())
2083 : -1, 2013 : -1,
2084 check_global()); 2014 check_global());
2085 2015
2086 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 2016 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2087 Node* name = assembler.Parameter(Descriptor::kName); 2017 Node* name = assembler->Parameter(Descriptor::kName);
2088 Node* value = assembler.Parameter(Descriptor::kValue); 2018 Node* value = assembler->Parameter(Descriptor::kValue);
2089 Node* slot = assembler.Parameter(Descriptor::kSlot); 2019 Node* slot = assembler->Parameter(Descriptor::kSlot);
2090 Node* vector = assembler.Parameter(Descriptor::kVector); 2020 Node* vector = assembler->Parameter(Descriptor::kVector);
2091 Node* context = assembler.Parameter(Descriptor::kContext); 2021 Node* context = assembler->Parameter(Descriptor::kContext);
2092 2022
2093 Label miss(&assembler); 2023 Label miss(assembler);
2094 2024
2095 if (check_global()) { 2025 if (check_global()) {
2096 // Check that the map of the global has not changed: use a placeholder map 2026 // Check that the map of the global has not changed: use a placeholder map
2097 // that will be replaced later with the global object's map. 2027 // that will be replaced later with the global object's map.
2098 Node* proxy_map = assembler.LoadMap(receiver); 2028 Node* proxy_map = assembler->LoadMap(receiver);
2099 Node* global = assembler.LoadObjectField(proxy_map, Map::kPrototypeOffset); 2029 Node* global = assembler->LoadObjectField(proxy_map, Map::kPrototypeOffset);
2100 Node* map_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell( 2030 Node* map_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell(
2101 StoreGlobalStub::global_map_placeholder(isolate()))); 2031 StoreGlobalStub::global_map_placeholder(isolate())));
2102 Node* expected_map = assembler.LoadWeakCellValueUnchecked(map_cell); 2032 Node* expected_map = assembler->LoadWeakCellValueUnchecked(map_cell);
2103 Node* map = assembler.LoadMap(global); 2033 Node* map = assembler->LoadMap(global);
2104 assembler.GotoIf(assembler.WordNotEqual(expected_map, map), &miss); 2034 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss);
2105 } 2035 }
2106 2036
2107 Node* weak_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell( 2037 Node* weak_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell(
2108 StoreGlobalStub::property_cell_placeholder(isolate()))); 2038 StoreGlobalStub::property_cell_placeholder(isolate())));
2109 Node* cell = assembler.LoadWeakCellValue(weak_cell); 2039 Node* cell = assembler->LoadWeakCellValue(weak_cell);
2110 assembler.GotoIf(assembler.TaggedIsSmi(cell), &miss); 2040 assembler->GotoIf(assembler->TaggedIsSmi(cell), &miss);
2111 2041
2112 // Load the payload of the global parameter cell. A hole indicates that the 2042 // Load the payload of the global parameter cell. A hole indicates that the
2113 // cell has been invalidated and that the store must be handled by the 2043 // cell has been invalidated and that the store must be handled by the
2114 // runtime. 2044 // runtime.
2115 Node* cell_contents = 2045 Node* cell_contents =
2116 assembler.LoadObjectField(cell, PropertyCell::kValueOffset); 2046 assembler->LoadObjectField(cell, PropertyCell::kValueOffset);
2117 2047
2118 PropertyCellType cell_type = this->cell_type(); 2048 PropertyCellType cell_type = this->cell_type();
2119 if (cell_type == PropertyCellType::kConstant || 2049 if (cell_type == PropertyCellType::kConstant ||
2120 cell_type == PropertyCellType::kUndefined) { 2050 cell_type == PropertyCellType::kUndefined) {
2121 // This is always valid for all states a cell can be in. 2051 // This is always valid for all states a cell can be in.
2122 assembler.GotoIf(assembler.WordNotEqual(cell_contents, value), &miss); 2052 assembler->GotoIf(assembler->WordNotEqual(cell_contents, value), &miss);
2123 } else { 2053 } else {
2124 assembler.GotoIf(assembler.IsTheHole(cell_contents), &miss); 2054 assembler->GotoIf(assembler->IsTheHole(cell_contents), &miss);
2125 2055
2126 // When dealing with constant types, the type may be allowed to change, as 2056 // When dealing with constant types, the type may be allowed to change, as
2127 // long as optimized code remains valid. 2057 // long as optimized code remains valid.
2128 bool value_is_smi = false; 2058 bool value_is_smi = false;
2129 if (cell_type == PropertyCellType::kConstantType) { 2059 if (cell_type == PropertyCellType::kConstantType) {
2130 switch (constant_type()) { 2060 switch (constant_type()) {
2131 case PropertyCellConstantType::kSmi: 2061 case PropertyCellConstantType::kSmi:
2132 assembler.GotoUnless(assembler.TaggedIsSmi(value), &miss); 2062 assembler->GotoUnless(assembler->TaggedIsSmi(value), &miss);
2133 value_is_smi = true; 2063 value_is_smi = true;
2134 break; 2064 break;
2135 case PropertyCellConstantType::kStableMap: { 2065 case PropertyCellConstantType::kStableMap: {
2136 // It is sufficient here to check that the value and cell contents 2066 // It is sufficient here to check that the value and cell contents
2137 // have identical maps, no matter if they are stable or not or if they 2067 // have identical maps, no matter if they are stable or not or if they
2138 // are the maps that were originally in the cell or not. If optimized 2068 // are the maps that were originally in the cell or not. If optimized
2139 // code will deopt when a cell has a unstable map and if it has a 2069 // code will deopt when a cell has a unstable map and if it has a
2140 // dependency on a stable map, it will deopt if the map destabilizes. 2070 // dependency on a stable map, it will deopt if the map destabilizes.
2141 assembler.GotoIf(assembler.TaggedIsSmi(value), &miss); 2071 assembler->GotoIf(assembler->TaggedIsSmi(value), &miss);
2142 assembler.GotoIf(assembler.TaggedIsSmi(cell_contents), &miss); 2072 assembler->GotoIf(assembler->TaggedIsSmi(cell_contents), &miss);
2143 Node* expected_map = assembler.LoadMap(cell_contents); 2073 Node* expected_map = assembler->LoadMap(cell_contents);
2144 Node* map = assembler.LoadMap(value); 2074 Node* map = assembler->LoadMap(value);
2145 assembler.GotoIf(assembler.WordNotEqual(expected_map, map), &miss); 2075 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss);
2146 break; 2076 break;
2147 } 2077 }
2148 } 2078 }
2149 } 2079 }
2150 if (value_is_smi) { 2080 if (value_is_smi) {
2151 assembler.StoreObjectFieldNoWriteBarrier(cell, PropertyCell::kValueOffset, 2081 assembler->StoreObjectFieldNoWriteBarrier(
2152 value); 2082 cell, PropertyCell::kValueOffset, value);
2153 } else { 2083 } else {
2154 assembler.StoreObjectField(cell, PropertyCell::kValueOffset, value); 2084 assembler->StoreObjectField(cell, PropertyCell::kValueOffset, value);
2155 } 2085 }
2156 } 2086 }
2157 2087
2158 assembler.Return(value); 2088 assembler->Return(value);
2159 2089
2160 assembler.Bind(&miss); 2090 assembler->Bind(&miss);
2161 { 2091 {
2162 assembler.Comment("Miss"); 2092 assembler->Comment("Miss");
2163 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, 2093 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
2164 vector, receiver, name); 2094 vector, receiver, name);
2165 } 2095 }
2166 } 2096 }
2167 2097
2168 void KeyedLoadSloppyArgumentsStub::GenerateAssembly( 2098 void KeyedLoadSloppyArgumentsStub::GenerateAssembly(
2169 compiler::CodeAssemblerState* state) const { 2099 CodeStubAssembler* assembler) const {
2170 typedef CodeStubAssembler::Label Label; 2100 typedef CodeStubAssembler::Label Label;
2171 typedef compiler::Node Node; 2101 typedef compiler::Node Node;
2172 CodeStubAssembler assembler(state);
2173 2102
2174 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 2103 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2175 Node* key = assembler.Parameter(Descriptor::kName); 2104 Node* key = assembler->Parameter(Descriptor::kName);
2176 Node* slot = assembler.Parameter(Descriptor::kSlot); 2105 Node* slot = assembler->Parameter(Descriptor::kSlot);
2177 Node* vector = assembler.Parameter(Descriptor::kVector); 2106 Node* vector = assembler->Parameter(Descriptor::kVector);
2178 Node* context = assembler.Parameter(Descriptor::kContext); 2107 Node* context = assembler->Parameter(Descriptor::kContext);
2179 2108
2180 Label miss(&assembler); 2109 Label miss(assembler);
2181 2110
2182 Node* result = assembler.LoadKeyedSloppyArguments(receiver, key, &miss); 2111 Node* result = assembler->LoadKeyedSloppyArguments(receiver, key, &miss);
2183 assembler.Return(result); 2112 assembler->Return(result);
2184 2113
2185 assembler.Bind(&miss); 2114 assembler->Bind(&miss);
2186 { 2115 {
2187 assembler.Comment("Miss"); 2116 assembler->Comment("Miss");
2188 assembler.TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, 2117 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver,
2189 key, slot, vector); 2118 key, slot, vector);
2190 } 2119 }
2191 } 2120 }
2192 2121
2193 void KeyedStoreSloppyArgumentsStub::GenerateAssembly( 2122 void KeyedStoreSloppyArgumentsStub::GenerateAssembly(
2194 compiler::CodeAssemblerState* state) const { 2123 CodeStubAssembler* assembler) const {
2195 typedef CodeStubAssembler::Label Label; 2124 typedef CodeStubAssembler::Label Label;
2196 typedef compiler::Node Node; 2125 typedef compiler::Node Node;
2197 CodeStubAssembler assembler(state);
2198 2126
2199 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 2127 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2200 Node* key = assembler.Parameter(Descriptor::kName); 2128 Node* key = assembler->Parameter(Descriptor::kName);
2201 Node* value = assembler.Parameter(Descriptor::kValue); 2129 Node* value = assembler->Parameter(Descriptor::kValue);
2202 Node* slot = assembler.Parameter(Descriptor::kSlot); 2130 Node* slot = assembler->Parameter(Descriptor::kSlot);
2203 Node* vector = assembler.Parameter(Descriptor::kVector); 2131 Node* vector = assembler->Parameter(Descriptor::kVector);
2204 Node* context = assembler.Parameter(Descriptor::kContext); 2132 Node* context = assembler->Parameter(Descriptor::kContext);
2205 2133
2206 Label miss(&assembler); 2134 Label miss(assembler);
2207 2135
2208 assembler.StoreKeyedSloppyArguments(receiver, key, value, &miss); 2136 assembler->StoreKeyedSloppyArguments(receiver, key, value, &miss);
2209 assembler.Return(value); 2137 assembler->Return(value);
2210 2138
2211 assembler.Bind(&miss); 2139 assembler->Bind(&miss);
2212 { 2140 {
2213 assembler.Comment("Miss"); 2141 assembler->Comment("Miss");
2214 assembler.TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, 2142 assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value,
2215 vector, receiver, key); 2143 slot, vector, receiver, key);
2216 } 2144 }
2217 } 2145 }
2218 2146
2219 void LoadScriptContextFieldStub::GenerateAssembly( 2147 void LoadScriptContextFieldStub::GenerateAssembly(
2220 compiler::CodeAssemblerState* state) const { 2148 CodeStubAssembler* assembler) const {
2221 typedef compiler::Node Node; 2149 typedef compiler::Node Node;
2222 CodeStubAssembler assembler(state);
2223 2150
2224 assembler.Comment("LoadScriptContextFieldStub: context_index=%d, slot=%d", 2151 assembler->Comment("LoadScriptContextFieldStub: context_index=%d, slot=%d",
2225 context_index(), slot_index()); 2152 context_index(), slot_index());
2226 2153
2227 Node* context = assembler.Parameter(Descriptor::kContext); 2154 Node* context = assembler->Parameter(Descriptor::kContext);
2228 2155
2229 Node* script_context = assembler.LoadScriptContext(context, context_index()); 2156 Node* script_context = assembler->LoadScriptContext(context, context_index());
2230 Node* result = assembler.LoadFixedArrayElement( 2157 Node* result = assembler->LoadFixedArrayElement(
2231 script_context, assembler.IntPtrConstant(slot_index()), 0, 2158 script_context, assembler->IntPtrConstant(slot_index()), 0,
2232 CodeStubAssembler::INTPTR_PARAMETERS); 2159 CodeStubAssembler::INTPTR_PARAMETERS);
2233 assembler.Return(result); 2160 assembler->Return(result);
2234 } 2161 }
2235 2162
2236 void StoreScriptContextFieldStub::GenerateAssembly( 2163 void StoreScriptContextFieldStub::GenerateAssembly(
2237 compiler::CodeAssemblerState* state) const { 2164 CodeStubAssembler* assembler) const {
2238 typedef compiler::Node Node; 2165 typedef compiler::Node Node;
2239 CodeStubAssembler assembler(state);
2240 2166
2241 assembler.Comment("StoreScriptContextFieldStub: context_index=%d, slot=%d", 2167 assembler->Comment("StoreScriptContextFieldStub: context_index=%d, slot=%d",
2242 context_index(), slot_index()); 2168 context_index(), slot_index());
2243 2169
2244 Node* value = assembler.Parameter(Descriptor::kValue); 2170 Node* value = assembler->Parameter(Descriptor::kValue);
2245 Node* context = assembler.Parameter(Descriptor::kContext); 2171 Node* context = assembler->Parameter(Descriptor::kContext);
2246 2172
2247 Node* script_context = assembler.LoadScriptContext(context, context_index()); 2173 Node* script_context = assembler->LoadScriptContext(context, context_index());
2248 assembler.StoreFixedArrayElement( 2174 assembler->StoreFixedArrayElement(
2249 script_context, assembler.IntPtrConstant(slot_index()), value, 2175 script_context, assembler->IntPtrConstant(slot_index()), value,
2250 UPDATE_WRITE_BARRIER, CodeStubAssembler::INTPTR_PARAMETERS); 2176 UPDATE_WRITE_BARRIER, CodeStubAssembler::INTPTR_PARAMETERS);
2251 assembler.Return(value); 2177 assembler->Return(value);
2252 } 2178 }
2253 2179
2254 void StoreInterceptorStub::GenerateAssembly( 2180 void StoreInterceptorStub::GenerateAssembly(
2255 compiler::CodeAssemblerState* state) const { 2181 CodeStubAssembler* assembler) const {
2256 typedef compiler::Node Node; 2182 typedef compiler::Node Node;
2257 CodeStubAssembler assembler(state);
2258 2183
2259 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 2184 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2260 Node* name = assembler.Parameter(Descriptor::kName); 2185 Node* name = assembler->Parameter(Descriptor::kName);
2261 Node* value = assembler.Parameter(Descriptor::kValue); 2186 Node* value = assembler->Parameter(Descriptor::kValue);
2262 Node* context = assembler.Parameter(Descriptor::kContext); 2187 Node* context = assembler->Parameter(Descriptor::kContext);
2263 assembler.TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, 2188 assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context,
2264 receiver, name, value); 2189 receiver, name, value);
2265 } 2190 }
2266 2191
2267 void LoadIndexedInterceptorStub::GenerateAssembly( 2192 void LoadIndexedInterceptorStub::GenerateAssembly(
2268 compiler::CodeAssemblerState* state) const { 2193 CodeStubAssembler* assembler) const {
2269 typedef compiler::Node Node; 2194 typedef compiler::Node Node;
2270 typedef CodeStubAssembler::Label Label; 2195 typedef CodeStubAssembler::Label Label;
2271 CodeStubAssembler assembler(state);
2272 2196
2273 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 2197 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
2274 Node* key = assembler.Parameter(Descriptor::kName); 2198 Node* key = assembler->Parameter(Descriptor::kName);
2275 Node* slot = assembler.Parameter(Descriptor::kSlot); 2199 Node* slot = assembler->Parameter(Descriptor::kSlot);
2276 Node* vector = assembler.Parameter(Descriptor::kVector); 2200 Node* vector = assembler->Parameter(Descriptor::kVector);
2277 Node* context = assembler.Parameter(Descriptor::kContext); 2201 Node* context = assembler->Parameter(Descriptor::kContext);
2278 2202
2279 Label if_keyispositivesmi(&assembler), if_keyisinvalid(&assembler); 2203 Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler);
2280 assembler.Branch(assembler.WordIsPositiveSmi(key), &if_keyispositivesmi, 2204 assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi,
2281 &if_keyisinvalid); 2205 &if_keyisinvalid);
2282 assembler.Bind(&if_keyispositivesmi); 2206 assembler->Bind(&if_keyispositivesmi);
2283 assembler.TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, 2207 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context,
2284 receiver, key); 2208 receiver, key);
2285 2209
2286 assembler.Bind(&if_keyisinvalid); 2210 assembler->Bind(&if_keyisinvalid);
2287 assembler.TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, 2211 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key,
2288 slot, vector); 2212 slot, vector);
2289 } 2213 }
2290 2214
2291 // static 2215 // static
2292 bool FastCloneShallowObjectStub::IsSupported(ObjectLiteral* expr) { 2216 bool FastCloneShallowObjectStub::IsSupported(ObjectLiteral* expr) {
2293 // FastCloneShallowObjectStub doesn't copy elements, and object literals don't 2217 // FastCloneShallowObjectStub doesn't copy elements, and object literals don't
2294 // support copy-on-write (COW) elements for now. 2218 // support copy-on-write (COW) elements for now.
2295 // TODO(mvstanton): make object literals support COW elements. 2219 // TODO(mvstanton): make object literals support COW elements.
2296 return expr->fast_elements() && expr->has_shallow_properties() && 2220 return expr->fast_elements() && expr->has_shallow_properties() &&
2297 expr->properties_count() <= kMaximumClonedProperties; 2221 expr->properties_count() <= kMaximumClonedProperties;
2298 } 2222 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2385 assembler->StoreObjectFieldNoWriteBarrier( 2309 assembler->StoreObjectFieldNoWriteBarrier(
2386 allocation_site, AllocationSite::kPretenureCreateCountOffset, 2310 allocation_site, AllocationSite::kPretenureCreateCountOffset,
2387 memento_create_count); 2311 memento_create_count);
2388 } 2312 }
2389 2313
2390 // TODO(verwaest): Allocate and fill in double boxes. 2314 // TODO(verwaest): Allocate and fill in double boxes.
2391 return copy; 2315 return copy;
2392 } 2316 }
2393 2317
2394 void FastCloneShallowObjectStub::GenerateAssembly( 2318 void FastCloneShallowObjectStub::GenerateAssembly(
2395 compiler::CodeAssemblerState* state) const { 2319 CodeStubAssembler* assembler) const {
2396 typedef CodeStubAssembler::Label Label; 2320 typedef CodeStubAssembler::Label Label;
2397 typedef compiler::Node Node; 2321 typedef compiler::Node Node;
2398 CodeStubAssembler assembler(state); 2322 Label call_runtime(assembler);
2399 2323 Node* closure = assembler->Parameter(0);
2400 Label call_runtime(&assembler); 2324 Node* literals_index = assembler->Parameter(1);
2401 Node* closure = assembler.Parameter(0);
2402 Node* literals_index = assembler.Parameter(1);
2403 2325
2404 Node* properties_count = 2326 Node* properties_count =
2405 assembler.IntPtrConstant(PropertiesCount(this->length())); 2327 assembler->IntPtrConstant(PropertiesCount(this->length()));
2406 Node* copy = GenerateFastPath(&assembler, &call_runtime, closure, 2328 Node* copy = GenerateFastPath(assembler, &call_runtime, closure,
2407 literals_index, properties_count); 2329 literals_index, properties_count);
2408 assembler.Return(copy); 2330 assembler->Return(copy);
2409 2331
2410 assembler.Bind(&call_runtime); 2332 assembler->Bind(&call_runtime);
2411 Node* constant_properties = assembler.Parameter(2); 2333 Node* constant_properties = assembler->Parameter(2);
2412 Node* flags = assembler.Parameter(3); 2334 Node* flags = assembler->Parameter(3);
2413 Node* context = assembler.Parameter(4); 2335 Node* context = assembler->Parameter(4);
2414 assembler.TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure, 2336 assembler->TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure,
2415 literals_index, constant_properties, flags); 2337 literals_index, constant_properties, flags);
2416 } 2338 }
2417 2339
2418 template<class StateType> 2340 template<class StateType>
2419 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { 2341 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) {
2420 // Note: Although a no-op transition is semantically OK, it is hinting at a 2342 // Note: Although a no-op transition is semantically OK, it is hinting at a
2421 // bug somewhere in our state transition machinery. 2343 // bug somewhere in our state transition machinery.
2422 DCHECK(from != to); 2344 DCHECK(from != to);
2423 if (!FLAG_trace_ic) return; 2345 if (!FLAG_trace_ic) return;
2424 OFStream os(stdout); 2346 OFStream os(stdout);
2425 os << "["; 2347 os << "[";
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); 2420 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss);
2499 } 2421 }
2500 2422
2501 2423
2502 void BinaryOpWithAllocationSiteStub::InitializeDescriptor( 2424 void BinaryOpWithAllocationSiteStub::InitializeDescriptor(
2503 CodeStubDescriptor* descriptor) { 2425 CodeStubDescriptor* descriptor) {
2504 descriptor->Initialize( 2426 descriptor->Initialize(
2505 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); 2427 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite));
2506 } 2428 }
2507 2429
2508 void GetPropertyStub::GenerateAssembly( 2430 void GetPropertyStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2509 compiler::CodeAssemblerState* state) const {
2510 typedef compiler::Node Node; 2431 typedef compiler::Node Node;
2511 typedef CodeStubAssembler::Label Label; 2432 typedef CodeStubAssembler::Label Label;
2512 typedef CodeStubAssembler::Variable Variable; 2433 typedef CodeStubAssembler::Variable Variable;
2513 CodeStubAssembler assembler(state);
2514 2434
2515 Label call_runtime(&assembler, Label::kDeferred), 2435 Label call_runtime(assembler, Label::kDeferred), return_undefined(assembler),
2516 return_undefined(&assembler), end(&assembler); 2436 end(assembler);
2517 2437
2518 Node* object = assembler.Parameter(0); 2438 Node* object = assembler->Parameter(0);
2519 Node* key = assembler.Parameter(1); 2439 Node* key = assembler->Parameter(1);
2520 Node* context = assembler.Parameter(2); 2440 Node* context = assembler->Parameter(2);
2521 Variable var_result(&assembler, MachineRepresentation::kTagged); 2441 Variable var_result(assembler, MachineRepresentation::kTagged);
2522 2442
2523 CodeStubAssembler::LookupInHolder lookup_property_in_holder = 2443 CodeStubAssembler::LookupInHolder lookup_property_in_holder =
2524 [&assembler, context, &var_result, &end]( 2444 [assembler, context, &var_result, &end](
2525 Node* receiver, Node* holder, Node* holder_map, 2445 Node* receiver, Node* holder, Node* holder_map,
2526 Node* holder_instance_type, Node* unique_name, Label* next_holder, 2446 Node* holder_instance_type, Node* unique_name, Label* next_holder,
2527 Label* if_bailout) { 2447 Label* if_bailout) {
2528 Variable var_value(&assembler, MachineRepresentation::kTagged); 2448 Variable var_value(assembler, MachineRepresentation::kTagged);
2529 Label if_found(&assembler); 2449 Label if_found(assembler);
2530 assembler.TryGetOwnProperty( 2450 assembler->TryGetOwnProperty(
2531 context, receiver, holder, holder_map, holder_instance_type, 2451 context, receiver, holder, holder_map, holder_instance_type,
2532 unique_name, &if_found, &var_value, next_holder, if_bailout); 2452 unique_name, &if_found, &var_value, next_holder, if_bailout);
2533 assembler.Bind(&if_found); 2453 assembler->Bind(&if_found);
2534 { 2454 {
2535 var_result.Bind(var_value.value()); 2455 var_result.Bind(var_value.value());
2536 assembler.Goto(&end); 2456 assembler->Goto(&end);
2537 } 2457 }
2538 }; 2458 };
2539 2459
2540 CodeStubAssembler::LookupInHolder lookup_element_in_holder = 2460 CodeStubAssembler::LookupInHolder lookup_element_in_holder =
2541 [&assembler, context, &var_result, &end]( 2461 [assembler, context, &var_result, &end](
2542 Node* receiver, Node* holder, Node* holder_map, 2462 Node* receiver, Node* holder, Node* holder_map,
2543 Node* holder_instance_type, Node* index, Label* next_holder, 2463 Node* holder_instance_type, Node* index, Label* next_holder,
2544 Label* if_bailout) { 2464 Label* if_bailout) {
2545 // Not supported yet. 2465 // Not supported yet.
2546 assembler.Use(next_holder); 2466 assembler->Use(next_holder);
2547 assembler.Goto(if_bailout); 2467 assembler->Goto(if_bailout);
2548 }; 2468 };
2549 2469
2550 assembler.TryPrototypeChainLookup(object, key, lookup_property_in_holder, 2470 assembler->TryPrototypeChainLookup(object, key, lookup_property_in_holder,
2551 lookup_element_in_holder, &return_undefined, 2471 lookup_element_in_holder,
2552 &call_runtime); 2472 &return_undefined, &call_runtime);
2553 2473
2554 assembler.Bind(&return_undefined); 2474 assembler->Bind(&return_undefined);
2555 { 2475 {
2556 var_result.Bind(assembler.UndefinedConstant()); 2476 var_result.Bind(assembler->UndefinedConstant());
2557 assembler.Goto(&end); 2477 assembler->Goto(&end);
2558 } 2478 }
2559 2479
2560 assembler.Bind(&call_runtime); 2480 assembler->Bind(&call_runtime);
2561 { 2481 {
2562 var_result.Bind( 2482 var_result.Bind(
2563 assembler.CallRuntime(Runtime::kGetProperty, context, object, key)); 2483 assembler->CallRuntime(Runtime::kGetProperty, context, object, key));
2564 assembler.Goto(&end); 2484 assembler->Goto(&end);
2565 } 2485 }
2566 2486
2567 assembler.Bind(&end); 2487 assembler->Bind(&end);
2568 assembler.Return(var_result.value()); 2488 assembler->Return(var_result.value());
2569 } 2489 }
2570 2490
2571 // static 2491 // static
2572 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler, 2492 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler,
2573 compiler::Node* shared_info, 2493 compiler::Node* shared_info,
2574 compiler::Node* context) { 2494 compiler::Node* context) {
2575 typedef compiler::Node Node; 2495 typedef compiler::Node Node;
2576 typedef compiler::CodeAssembler::Label Label; 2496 typedef compiler::CodeAssembler::Label Label;
2577 typedef compiler::CodeAssembler::Variable Variable; 2497 typedef compiler::CodeAssembler::Variable Variable;
2578 2498
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); 2632 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag));
2713 assembler->StoreObjectFieldNoWriteBarrier( 2633 assembler->StoreObjectFieldNoWriteBarrier(
2714 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry); 2634 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry);
2715 assembler->StoreObjectFieldNoWriteBarrier(result, 2635 assembler->StoreObjectFieldNoWriteBarrier(result,
2716 JSFunction::kNextFunctionLinkOffset, 2636 JSFunction::kNextFunctionLinkOffset,
2717 assembler->UndefinedConstant()); 2637 assembler->UndefinedConstant());
2718 2638
2719 return result; 2639 return result;
2720 } 2640 }
2721 2641
2722 void FastNewClosureStub::GenerateAssembly( 2642 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2723 compiler::CodeAssemblerState* state) const { 2643 assembler->Return(
2724 CodeStubAssembler assembler(state); 2644 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1)));
2725 assembler.Return(
2726 Generate(&assembler, assembler.Parameter(0), assembler.Parameter(1)));
2727 } 2645 }
2728 2646
2729 // static 2647 // static
2730 compiler::Node* FastNewFunctionContextStub::Generate( 2648 compiler::Node* FastNewFunctionContextStub::Generate(
2731 CodeStubAssembler* assembler, compiler::Node* function, 2649 CodeStubAssembler* assembler, compiler::Node* function,
2732 compiler::Node* slots, compiler::Node* context) { 2650 compiler::Node* slots, compiler::Node* context) {
2733 typedef compiler::Node Node; 2651 typedef compiler::Node Node;
2734 2652
2735 Node* min_context_slots = 2653 Node* min_context_slots =
2736 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); 2654 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 function_context, FAST_ELEMENTS, min_context_slots, length, 2691 function_context, FAST_ELEMENTS, min_context_slots, length,
2774 [undefined](CodeStubAssembler* assembler, Node* context, Node* offset) { 2692 [undefined](CodeStubAssembler* assembler, Node* context, Node* offset) {
2775 assembler->StoreNoWriteBarrier(MachineType::PointerRepresentation(), 2693 assembler->StoreNoWriteBarrier(MachineType::PointerRepresentation(),
2776 context, offset, undefined); 2694 context, offset, undefined);
2777 }); 2695 });
2778 2696
2779 return function_context; 2697 return function_context;
2780 } 2698 }
2781 2699
2782 void FastNewFunctionContextStub::GenerateAssembly( 2700 void FastNewFunctionContextStub::GenerateAssembly(
2783 compiler::CodeAssemblerState* state) const { 2701 CodeStubAssembler* assembler) const {
2784 typedef compiler::Node Node; 2702 typedef compiler::Node Node;
2785 CodeStubAssembler assembler(state); 2703 Node* function = assembler->Parameter(Descriptor::kFunction);
2786 Node* function = assembler.Parameter(Descriptor::kFunction); 2704 Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots);
2787 Node* slots = assembler.Parameter(FastNewFunctionContextDescriptor::kSlots); 2705 Node* context = assembler->Parameter(Descriptor::kContext);
2788 Node* context = assembler.Parameter(Descriptor::kContext);
2789 2706
2790 assembler.Return(Generate(&assembler, function, slots, context)); 2707 assembler->Return(Generate(assembler, function, slots, context));
2791 } 2708 }
2792 2709
2793 // static 2710 // static
2794 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, 2711 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler,
2795 compiler::Node* closure, 2712 compiler::Node* closure,
2796 compiler::Node* literal_index, 2713 compiler::Node* literal_index,
2797 compiler::Node* pattern, 2714 compiler::Node* pattern,
2798 compiler::Node* flags, 2715 compiler::Node* flags,
2799 compiler::Node* context) { 2716 compiler::Node* context) {
2800 typedef CodeStubAssembler::Label Label; 2717 typedef CodeStubAssembler::Label Label;
(...skipping 27 matching lines...) Expand all
2828 { 2745 {
2829 result.Bind(assembler->CallRuntime(Runtime::kCreateRegExpLiteral, context, 2746 result.Bind(assembler->CallRuntime(Runtime::kCreateRegExpLiteral, context,
2830 closure, literal_index, pattern, flags)); 2747 closure, literal_index, pattern, flags));
2831 assembler->Goto(&end); 2748 assembler->Goto(&end);
2832 } 2749 }
2833 2750
2834 assembler->Bind(&end); 2751 assembler->Bind(&end);
2835 return result.value(); 2752 return result.value();
2836 } 2753 }
2837 2754
2838 void FastCloneRegExpStub::GenerateAssembly( 2755 void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2839 compiler::CodeAssemblerState* state) const {
2840 typedef compiler::Node Node; 2756 typedef compiler::Node Node;
2841 CodeStubAssembler assembler(state); 2757 Node* closure = assembler->Parameter(Descriptor::kClosure);
2842 Node* closure = assembler.Parameter(Descriptor::kClosure); 2758 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex);
2843 Node* literal_index = assembler.Parameter(Descriptor::kLiteralIndex); 2759 Node* pattern = assembler->Parameter(Descriptor::kPattern);
2844 Node* pattern = assembler.Parameter(Descriptor::kPattern); 2760 Node* flags = assembler->Parameter(Descriptor::kFlags);
2845 Node* flags = assembler.Parameter(Descriptor::kFlags); 2761 Node* context = assembler->Parameter(Descriptor::kContext);
2846 Node* context = assembler.Parameter(Descriptor::kContext);
2847 2762
2848 assembler.Return( 2763 assembler->Return(
2849 Generate(&assembler, closure, literal_index, pattern, flags, context)); 2764 Generate(assembler, closure, literal_index, pattern, flags, context));
2850 } 2765 }
2851 2766
2852 namespace { 2767 namespace {
2853 2768
2854 compiler::Node* NonEmptyShallowClone(CodeStubAssembler* assembler, 2769 compiler::Node* NonEmptyShallowClone(CodeStubAssembler* assembler,
2855 compiler::Node* boilerplate, 2770 compiler::Node* boilerplate,
2856 compiler::Node* boilerplate_map, 2771 compiler::Node* boilerplate_map,
2857 compiler::Node* boilerplate_elements, 2772 compiler::Node* boilerplate_elements,
2858 compiler::Node* allocation_site, 2773 compiler::Node* allocation_site,
2859 compiler::Node* capacity, 2774 compiler::Node* capacity,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 elements.value()); 2919 elements.value());
3005 result.Bind(array); 2920 result.Bind(array);
3006 assembler->Goto(&return_result); 2921 assembler->Goto(&return_result);
3007 } 2922 }
3008 2923
3009 assembler->Bind(&return_result); 2924 assembler->Bind(&return_result);
3010 return result.value(); 2925 return result.value();
3011 } 2926 }
3012 2927
3013 void FastCloneShallowArrayStub::GenerateAssembly( 2928 void FastCloneShallowArrayStub::GenerateAssembly(
3014 compiler::CodeAssemblerState* state) const { 2929 CodeStubAssembler* assembler) const {
3015 typedef compiler::Node Node; 2930 typedef compiler::Node Node;
3016 typedef CodeStubAssembler::Label Label; 2931 typedef CodeStubAssembler::Label Label;
3017 CodeStubAssembler assembler(state); 2932 Node* closure = assembler->Parameter(Descriptor::kClosure);
2933 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex);
2934 Node* constant_elements = assembler->Parameter(Descriptor::kConstantElements);
2935 Node* context = assembler->Parameter(Descriptor::kContext);
2936 Label call_runtime(assembler, Label::kDeferred);
2937 assembler->Return(Generate(assembler, closure, literal_index, context,
2938 &call_runtime, allocation_site_mode()));
3018 2939
3019 Node* closure = assembler.Parameter(Descriptor::kClosure); 2940 assembler->Bind(&call_runtime);
3020 Node* literal_index = assembler.Parameter(Descriptor::kLiteralIndex);
3021 Node* constant_elements = assembler.Parameter(Descriptor::kConstantElements);
3022 Node* context = assembler.Parameter(Descriptor::kContext);
3023 Label call_runtime(&assembler, Label::kDeferred);
3024 assembler.Return(Generate(&assembler, closure, literal_index, context,
3025 &call_runtime, allocation_site_mode()));
3026
3027 assembler.Bind(&call_runtime);
3028 { 2941 {
3029 assembler.Comment("call runtime"); 2942 assembler->Comment("call runtime");
3030 Node* flags = assembler.SmiConstant( 2943 Node* flags = assembler->SmiConstant(
3031 Smi::FromInt(ArrayLiteral::kShallowElements | 2944 Smi::FromInt(ArrayLiteral::kShallowElements |
3032 (allocation_site_mode() == TRACK_ALLOCATION_SITE 2945 (allocation_site_mode() == TRACK_ALLOCATION_SITE
3033 ? 0 2946 ? 0
3034 : ArrayLiteral::kDisableMementos))); 2947 : ArrayLiteral::kDisableMementos)));
3035 assembler.Return(assembler.CallRuntime(Runtime::kCreateArrayLiteral, 2948 assembler->Return(assembler->CallRuntime(Runtime::kCreateArrayLiteral,
3036 context, closure, literal_index, 2949 context, closure, literal_index,
3037 constant_elements, flags)); 2950 constant_elements, flags));
3038 } 2951 }
3039 } 2952 }
3040 2953
3041 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { 2954 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) {
3042 CreateAllocationSiteStub stub(isolate); 2955 CreateAllocationSiteStub stub(isolate);
3043 stub.GetCode(); 2956 stub.GetCode();
3044 } 2957 }
3045 2958
3046 2959
3047 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { 2960 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) {
3048 CreateWeakCellStub stub(isolate); 2961 CreateWeakCellStub stub(isolate);
3049 stub.GetCode(); 2962 stub.GetCode();
3050 } 2963 }
3051 2964
3052 2965
3053 void StoreElementStub::Generate(MacroAssembler* masm) { 2966 void StoreElementStub::Generate(MacroAssembler* masm) {
3054 DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind()); 2967 DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind());
3055 KeyedStoreIC::GenerateSlow(masm); 2968 KeyedStoreIC::GenerateSlow(masm);
3056 } 2969 }
3057 2970
3058 void StoreFastElementStub::GenerateAssembly( 2971 void StoreFastElementStub::GenerateAssembly(
3059 compiler::CodeAssemblerState* state) const { 2972 CodeStubAssembler* assembler) const {
3060 typedef CodeStubAssembler::Label Label; 2973 typedef CodeStubAssembler::Label Label;
3061 typedef compiler::Node Node; 2974 typedef compiler::Node Node;
3062 CodeStubAssembler assembler(state);
3063 2975
3064 assembler.Comment( 2976 assembler->Comment(
3065 "StoreFastElementStub: js_array=%d, elements_kind=%s, store_mode=%d", 2977 "StoreFastElementStub: js_array=%d, elements_kind=%s, store_mode=%d",
3066 is_js_array(), ElementsKindToString(elements_kind()), store_mode()); 2978 is_js_array(), ElementsKindToString(elements_kind()), store_mode());
3067 2979
3068 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 2980 Node* receiver = assembler->Parameter(Descriptor::kReceiver);
3069 Node* key = assembler.Parameter(Descriptor::kName); 2981 Node* key = assembler->Parameter(Descriptor::kName);
3070 Node* value = assembler.Parameter(Descriptor::kValue); 2982 Node* value = assembler->Parameter(Descriptor::kValue);
3071 Node* slot = assembler.Parameter(Descriptor::kSlot); 2983 Node* slot = assembler->Parameter(Descriptor::kSlot);
3072 Node* vector = assembler.Parameter(Descriptor::kVector); 2984 Node* vector = assembler->Parameter(Descriptor::kVector);
3073 Node* context = assembler.Parameter(Descriptor::kContext); 2985 Node* context = assembler->Parameter(Descriptor::kContext);
3074 2986
3075 Label miss(&assembler); 2987 Label miss(assembler);
3076 2988
3077 assembler.EmitElementStore(receiver, key, value, is_js_array(), 2989 assembler->EmitElementStore(receiver, key, value, is_js_array(),
3078 elements_kind(), store_mode(), &miss); 2990 elements_kind(), store_mode(), &miss);
3079 assembler.Return(value); 2991 assembler->Return(value);
3080 2992
3081 assembler.Bind(&miss); 2993 assembler->Bind(&miss);
3082 { 2994 {
3083 assembler.Comment("Miss"); 2995 assembler->Comment("Miss");
3084 assembler.TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, 2996 assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value,
3085 vector, receiver, key); 2997 slot, vector, receiver, key);
3086 } 2998 }
3087 } 2999 }
3088 3000
3089 // static 3001 // static
3090 void StoreFastElementStub::GenerateAheadOfTime(Isolate* isolate) { 3002 void StoreFastElementStub::GenerateAheadOfTime(Isolate* isolate) {
3091 if (FLAG_minimal) return; 3003 if (FLAG_minimal) return;
3092 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, STANDARD_STORE) 3004 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, STANDARD_STORE)
3093 .GetCode(); 3005 .GetCode();
3094 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, 3006 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS,
3095 STORE_AND_GROW_NO_TRANSITION).GetCode(); 3007 STORE_AND_GROW_NO_TRANSITION).GetCode();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3159 3071
3160 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, 3072 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function,
3161 intptr_t stack_pointer, 3073 intptr_t stack_pointer,
3162 Isolate* isolate) { 3074 Isolate* isolate) {
3163 FunctionEntryHook entry_hook = isolate->function_entry_hook(); 3075 FunctionEntryHook entry_hook = isolate->function_entry_hook();
3164 DCHECK(entry_hook != NULL); 3076 DCHECK(entry_hook != NULL);
3165 entry_hook(function, stack_pointer); 3077 entry_hook(function, stack_pointer);
3166 } 3078 }
3167 3079
3168 void CreateAllocationSiteStub::GenerateAssembly( 3080 void CreateAllocationSiteStub::GenerateAssembly(
3169 compiler::CodeAssemblerState* state) const { 3081 CodeStubAssembler* assembler) const {
3170 CodeStubAssembler assembler(state); 3082 assembler->Return(assembler->CreateAllocationSiteInFeedbackVector(
3171 assembler.Return(assembler.CreateAllocationSiteInFeedbackVector( 3083 assembler->Parameter(Descriptor::kVector),
3172 assembler.Parameter(Descriptor::kVector), 3084 assembler->Parameter(Descriptor::kSlot)));
3173 assembler.Parameter(Descriptor::kSlot)));
3174 } 3085 }
3175 3086
3176 void CreateWeakCellStub::GenerateAssembly( 3087 void CreateWeakCellStub::GenerateAssembly(CodeStubAssembler* assembler) const {
3177 compiler::CodeAssemblerState* state) const { 3088 assembler->Return(assembler->CreateWeakCellInFeedbackVector(
3178 CodeStubAssembler assembler(state); 3089 assembler->Parameter(Descriptor::kVector),
3179 assembler.Return(assembler.CreateWeakCellInFeedbackVector( 3090 assembler->Parameter(Descriptor::kSlot),
3180 assembler.Parameter(Descriptor::kVector), 3091 assembler->Parameter(Descriptor::kValue)));
3181 assembler.Parameter(Descriptor::kSlot),
3182 assembler.Parameter(Descriptor::kValue)));
3183 } 3092 }
3184 3093
3185 void ArrayNoArgumentConstructorStub::GenerateAssembly( 3094 void ArrayNoArgumentConstructorStub::GenerateAssembly(
3186 compiler::CodeAssemblerState* state) const { 3095 CodeStubAssembler* assembler) const {
3187 typedef compiler::Node Node; 3096 typedef compiler::Node Node;
3188 CodeStubAssembler assembler(state); 3097 Node* native_context = assembler->LoadObjectField(
3189 Node* native_context = assembler.LoadObjectField( 3098 assembler->Parameter(Descriptor::kFunction), JSFunction::kContextOffset);
3190 assembler.Parameter(Descriptor::kFunction), JSFunction::kContextOffset);
3191 bool track_allocation_site = 3099 bool track_allocation_site =
3192 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && 3100 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE &&
3193 override_mode() != DISABLE_ALLOCATION_SITES; 3101 override_mode() != DISABLE_ALLOCATION_SITES;
3194 Node* allocation_site = track_allocation_site 3102 Node* allocation_site =
3195 ? assembler.Parameter(Descriptor::kAllocationSite) 3103 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite)
3196 : nullptr; 3104 : nullptr;
3197 Node* array_map = 3105 Node* array_map =
3198 assembler.LoadJSArrayElementsMap(elements_kind(), native_context); 3106 assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
3199 Node* array = assembler.AllocateJSArray( 3107 Node* array = assembler->AllocateJSArray(
3200 elements_kind(), array_map, 3108 elements_kind(), array_map,
3201 assembler.IntPtrConstant(JSArray::kPreallocatedArrayElements), 3109 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
3202 assembler.SmiConstant(Smi::kZero), allocation_site); 3110 assembler->SmiConstant(Smi::kZero), allocation_site);
3203 assembler.Return(array); 3111 assembler->Return(array);
3204 } 3112 }
3205 3113
3206 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( 3114 void InternalArrayNoArgumentConstructorStub::GenerateAssembly(
3207 compiler::CodeAssemblerState* state) const { 3115 CodeStubAssembler* assembler) const {
3208 typedef compiler::Node Node; 3116 typedef compiler::Node Node;
3209 CodeStubAssembler assembler(state);
3210 Node* array_map = 3117 Node* array_map =
3211 assembler.LoadObjectField(assembler.Parameter(Descriptor::kFunction), 3118 assembler->LoadObjectField(assembler->Parameter(Descriptor::kFunction),
3212 JSFunction::kPrototypeOrInitialMapOffset); 3119 JSFunction::kPrototypeOrInitialMapOffset);
3213 Node* array = assembler.AllocateJSArray( 3120 Node* array = assembler->AllocateJSArray(
3214 elements_kind(), array_map, 3121 elements_kind(), array_map,
3215 assembler.IntPtrConstant(JSArray::kPreallocatedArrayElements), 3122 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
3216 assembler.SmiConstant(Smi::kZero), nullptr); 3123 assembler->SmiConstant(Smi::kZero), nullptr);
3217 assembler.Return(array); 3124 assembler->Return(array);
3218 } 3125 }
3219 3126
3220 namespace { 3127 namespace {
3221 3128
3222 template <typename Descriptor> 3129 template <typename Descriptor>
3223 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, 3130 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
3224 ElementsKind elements_kind, 3131 ElementsKind elements_kind,
3225 compiler::Node* array_map, 3132 compiler::Node* array_map,
3226 compiler::Node* allocation_site, 3133 compiler::Node* allocation_site,
3227 AllocationSiteMode mode) { 3134 AllocationSiteMode mode) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 Node* function = assembler->Parameter(Descriptor::kFunction); 3184 Node* function = assembler->Parameter(Descriptor::kFunction);
3278 Node* array_size = assembler->Parameter(Descriptor::kArraySizeSmiParameter); 3185 Node* array_size = assembler->Parameter(Descriptor::kArraySizeSmiParameter);
3279 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite); 3186 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite);
3280 assembler->TailCallRuntime(Runtime::kNewArray, context, function, 3187 assembler->TailCallRuntime(Runtime::kNewArray, context, function,
3281 array_size, function, allocation_site); 3188 array_size, function, allocation_site);
3282 } 3189 }
3283 } 3190 }
3284 } // namespace 3191 } // namespace
3285 3192
3286 void ArraySingleArgumentConstructorStub::GenerateAssembly( 3193 void ArraySingleArgumentConstructorStub::GenerateAssembly(
3287 compiler::CodeAssemblerState* state) const { 3194 CodeStubAssembler* assembler) const {
3288 typedef compiler::Node Node; 3195 typedef compiler::Node Node;
3289 CodeStubAssembler assembler(state); 3196 Node* function = assembler->Parameter(Descriptor::kFunction);
3290 Node* function = assembler.Parameter(Descriptor::kFunction);
3291 Node* native_context = 3197 Node* native_context =
3292 assembler.LoadObjectField(function, JSFunction::kContextOffset); 3198 assembler->LoadObjectField(function, JSFunction::kContextOffset);
3293 Node* array_map = 3199 Node* array_map =
3294 assembler.LoadJSArrayElementsMap(elements_kind(), native_context); 3200 assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
3295 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES 3201 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES
3296 ? DONT_TRACK_ALLOCATION_SITE 3202 ? DONT_TRACK_ALLOCATION_SITE
3297 : AllocationSite::GetMode(elements_kind()); 3203 : AllocationSite::GetMode(elements_kind());
3298 Node* allocation_site = assembler.Parameter(Descriptor::kAllocationSite); 3204 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite);
3299 SingleArgumentConstructorCommon<Descriptor>(&assembler, elements_kind(), 3205 SingleArgumentConstructorCommon<Descriptor>(assembler, elements_kind(),
3300 array_map, allocation_site, mode); 3206 array_map, allocation_site, mode);
3301 } 3207 }
3302 3208
3303 void InternalArraySingleArgumentConstructorStub::GenerateAssembly( 3209 void InternalArraySingleArgumentConstructorStub::GenerateAssembly(
3304 compiler::CodeAssemblerState* state) const { 3210 CodeStubAssembler* assembler) const {
3305 typedef compiler::Node Node; 3211 typedef compiler::Node Node;
3306 CodeStubAssembler assembler(state); 3212 Node* function = assembler->Parameter(Descriptor::kFunction);
3307 Node* function = assembler.Parameter(Descriptor::kFunction); 3213 Node* array_map = assembler->LoadObjectField(
3308 Node* array_map = assembler.LoadObjectField(
3309 function, JSFunction::kPrototypeOrInitialMapOffset); 3214 function, JSFunction::kPrototypeOrInitialMapOffset);
3310 SingleArgumentConstructorCommon<Descriptor>( 3215 SingleArgumentConstructorCommon<Descriptor>(
3311 &assembler, elements_kind(), array_map, assembler.UndefinedConstant(), 3216 assembler, elements_kind(), array_map, assembler->UndefinedConstant(),
3312 DONT_TRACK_ALLOCATION_SITE); 3217 DONT_TRACK_ALLOCATION_SITE);
3313 } 3218 }
3314 3219
3315 void GrowArrayElementsStub::GenerateAssembly( 3220 void GrowArrayElementsStub::GenerateAssembly(
3316 compiler::CodeAssemblerState* state) const { 3221 CodeStubAssembler* assembler) const {
3317 typedef compiler::Node Node; 3222 typedef compiler::Node Node;
3318 CodeStubAssembler assembler(state); 3223 CodeStubAssembler::Label runtime(assembler,
3319 CodeStubAssembler::Label runtime(&assembler,
3320 CodeStubAssembler::Label::kDeferred); 3224 CodeStubAssembler::Label::kDeferred);
3321 3225
3322 Node* object = assembler.Parameter(Descriptor::kObject); 3226 Node* object = assembler->Parameter(Descriptor::kObject);
3323 Node* key = assembler.Parameter(Descriptor::kKey); 3227 Node* key = assembler->Parameter(Descriptor::kKey);
3324 Node* context = assembler.Parameter(Descriptor::kContext); 3228 Node* context = assembler->Parameter(Descriptor::kContext);
3325 ElementsKind kind = elements_kind(); 3229 ElementsKind kind = elements_kind();
3326 3230
3327 Node* elements = assembler.LoadElements(object); 3231 Node* elements = assembler->LoadElements(object);
3328 Node* new_elements = 3232 Node* new_elements =
3329 assembler.TryGrowElementsCapacity(object, elements, kind, key, &runtime); 3233 assembler->TryGrowElementsCapacity(object, elements, kind, key, &runtime);
3330 assembler.Return(new_elements); 3234 assembler->Return(new_elements);
3331 3235
3332 assembler.Bind(&runtime); 3236 assembler->Bind(&runtime);
3333 // TODO(danno): Make this a tail call when the stub is only used from TurboFan 3237 // TODO(danno): Make this a tail call when the stub is only used from TurboFan
3334 // code. This musn't be a tail call for now, since the caller site in lithium 3238 // code. This musn't be a tail call for now, since the caller site in lithium
3335 // creates a safepoint. This safepoint musn't have a different number of 3239 // creates a safepoint. This safepoint musn't have a different number of
3336 // arguments on the stack in the case that a GC happens from the slow-case 3240 // arguments on the stack in the case that a GC happens from the slow-case
3337 // allocation path (zero, since all the stubs inputs are in registers) and 3241 // allocation path (zero, since all the stubs inputs are in registers) and
3338 // when the call happens (it would be two in the tail call case due to the 3242 // when the call happens (it would be two in the tail call case due to the
3339 // tail call pushing the arguments on the stack for the runtime call). By not 3243 // tail call pushing the arguments on the stack for the runtime call). By not
3340 // tail-calling, the runtime call case also has zero arguments on the stack 3244 // tail-calling, the runtime call case also has zero arguments on the stack
3341 // for the stub frame. 3245 // for the stub frame.
3342 assembler.Return( 3246 assembler->Return(assembler->CallRuntime(Runtime::kGrowArrayElements, context,
3343 assembler.CallRuntime(Runtime::kGrowArrayElements, context, object, key)); 3247 object, key));
3344 } 3248 }
3345 3249
3346 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 3250 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
3347 : PlatformCodeStub(isolate) {} 3251 : PlatformCodeStub(isolate) {}
3348 3252
3349 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) 3253 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
3350 : PlatformCodeStub(isolate) {} 3254 : PlatformCodeStub(isolate) {}
3351 3255
3352 } // namespace internal 3256 } // namespace internal
3353 } // namespace v8 3257 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698