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