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 state.GenerateCode(); |
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); |
442 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); | |
440 | 443 |
441 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); | 444 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); |
442 assembler->LoadIC(&p); | 445 assembler.LoadIC(&p); |
443 } | 446 } |
444 | 447 |
445 void LoadICStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 448 void LoadICStub::GenerateAssembly(compiler::CodeAssemblerState* state) const { |
446 typedef compiler::Node Node; | 449 typedef compiler::Node Node; |
447 | 450 CodeStubAssembler assembler(state); |
448 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 451 |
449 Node* name = assembler->Parameter(Descriptor::kName); | 452 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
450 Node* slot = assembler->Parameter(Descriptor::kSlot); | 453 Node* name = assembler.Parameter(Descriptor::kName); |
451 Node* vector = assembler->Parameter(Descriptor::kVector); | 454 Node* slot = assembler.Parameter(Descriptor::kSlot); |
452 Node* context = assembler->Parameter(Descriptor::kContext); | 455 Node* vector = assembler.Parameter(Descriptor::kVector); |
456 Node* context = assembler.Parameter(Descriptor::kContext); | |
453 | 457 |
454 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); | 458 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); |
455 assembler->LoadIC(&p); | 459 assembler.LoadIC(&p); |
456 } | 460 } |
457 | 461 |
458 void LoadGlobalICTrampolineStub::GenerateAssembly( | 462 void LoadGlobalICTrampolineStub::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* slot = assembler->Parameter(Descriptor::kSlot); | 466 |
463 Node* context = assembler->Parameter(Descriptor::kContext); | 467 Node* slot = assembler.Parameter(Descriptor::kSlot); |
464 Node* vector = assembler->LoadTypeFeedbackVectorForStub(); | 468 Node* context = assembler.Parameter(Descriptor::kContext); |
469 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); | |
465 | 470 |
466 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, | 471 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, |
467 vector); | 472 vector); |
468 assembler->LoadGlobalIC(&p); | 473 assembler.LoadGlobalIC(&p); |
469 } | 474 } |
470 | 475 |
471 void LoadGlobalICStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 476 void LoadGlobalICStub::GenerateAssembly( |
472 typedef compiler::Node Node; | 477 compiler::CodeAssemblerState* state) const { |
473 | 478 typedef compiler::Node Node; |
474 Node* slot = assembler->Parameter(Descriptor::kSlot); | 479 CodeStubAssembler assembler(state); |
475 Node* vector = assembler->Parameter(Descriptor::kVector); | 480 |
476 Node* context = assembler->Parameter(Descriptor::kContext); | 481 Node* slot = assembler.Parameter(Descriptor::kSlot); |
482 Node* vector = assembler.Parameter(Descriptor::kVector); | |
483 Node* context = assembler.Parameter(Descriptor::kContext); | |
477 | 484 |
478 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, | 485 CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot, |
479 vector); | 486 vector); |
480 assembler->LoadGlobalIC(&p); | 487 assembler.LoadGlobalIC(&p); |
481 } | 488 } |
482 | 489 |
483 void KeyedLoadICTrampolineTFStub::GenerateAssembly( | 490 void KeyedLoadICTrampolineTFStub::GenerateAssembly( |
484 CodeStubAssembler* assembler) const { | 491 compiler::CodeAssemblerState* state) const { |
485 typedef compiler::Node Node; | 492 typedef compiler::Node Node; |
486 | 493 CodeStubAssembler assembler(state); |
487 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 494 |
488 Node* name = assembler->Parameter(Descriptor::kName); | 495 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
489 Node* slot = assembler->Parameter(Descriptor::kSlot); | 496 Node* name = assembler.Parameter(Descriptor::kName); |
490 Node* context = assembler->Parameter(Descriptor::kContext); | 497 Node* slot = assembler.Parameter(Descriptor::kSlot); |
491 Node* vector = assembler->LoadTypeFeedbackVectorForStub(); | 498 Node* context = assembler.Parameter(Descriptor::kContext); |
499 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); | |
492 | 500 |
493 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); | 501 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); |
494 assembler->KeyedLoadIC(&p); | 502 assembler.KeyedLoadIC(&p); |
495 } | 503 } |
496 | 504 |
497 void KeyedLoadICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 505 void KeyedLoadICTFStub::GenerateAssembly( |
498 typedef compiler::Node Node; | 506 compiler::CodeAssemblerState* state) const { |
499 | 507 typedef compiler::Node Node; |
500 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 508 CodeStubAssembler assembler(state); |
501 Node* name = assembler->Parameter(Descriptor::kName); | 509 |
502 Node* slot = assembler->Parameter(Descriptor::kSlot); | 510 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
503 Node* vector = assembler->Parameter(Descriptor::kVector); | 511 Node* name = assembler.Parameter(Descriptor::kName); |
504 Node* context = assembler->Parameter(Descriptor::kContext); | 512 Node* slot = assembler.Parameter(Descriptor::kSlot); |
513 Node* vector = assembler.Parameter(Descriptor::kVector); | |
514 Node* context = assembler.Parameter(Descriptor::kContext); | |
505 | 515 |
506 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); | 516 CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector); |
507 assembler->KeyedLoadIC(&p); | 517 assembler.KeyedLoadIC(&p); |
508 } | 518 } |
509 | 519 |
510 void StoreICTrampolineStub::GenerateAssembly( | 520 void StoreICTrampolineStub::GenerateAssembly( |
511 CodeStubAssembler* assembler) const { | 521 compiler::CodeAssemblerState* state) const { |
512 typedef compiler::Node Node; | 522 typedef compiler::Node Node; |
513 | 523 CodeStubAssembler assembler(state); |
514 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 524 |
515 Node* name = assembler->Parameter(Descriptor::kName); | 525 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
516 Node* value = assembler->Parameter(Descriptor::kValue); | 526 Node* name = assembler.Parameter(Descriptor::kName); |
517 Node* slot = assembler->Parameter(Descriptor::kSlot); | 527 Node* value = assembler.Parameter(Descriptor::kValue); |
518 Node* context = assembler->Parameter(Descriptor::kContext); | 528 Node* slot = assembler.Parameter(Descriptor::kSlot); |
519 Node* vector = assembler->LoadTypeFeedbackVectorForStub(); | 529 Node* context = assembler.Parameter(Descriptor::kContext); |
530 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); | |
520 | 531 |
521 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, | 532 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, |
522 vector); | 533 vector); |
523 assembler->StoreIC(&p); | 534 assembler.StoreIC(&p); |
524 } | 535 } |
525 | 536 |
526 void StoreICStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 537 void StoreICStub::GenerateAssembly(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* vector = assembler->Parameter(Descriptor::kVector); | 544 Node* slot = assembler.Parameter(Descriptor::kSlot); |
534 Node* context = assembler->Parameter(Descriptor::kContext); | 545 Node* vector = assembler.Parameter(Descriptor::kVector); |
546 Node* context = assembler.Parameter(Descriptor::kContext); | |
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 KeyedStoreICTrampolineTFStub::GenerateAssembly( | 553 void KeyedStoreICTrampolineTFStub::GenerateAssembly( |
542 CodeStubAssembler* assembler) const { | 554 compiler::CodeAssemblerState* state) const { |
543 typedef compiler::Node Node; | 555 typedef compiler::Node Node; |
544 | 556 CodeStubAssembler assembler(state); |
545 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 557 |
546 Node* name = assembler->Parameter(Descriptor::kName); | 558 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
547 Node* value = assembler->Parameter(Descriptor::kValue); | 559 Node* name = assembler.Parameter(Descriptor::kName); |
548 Node* slot = assembler->Parameter(Descriptor::kSlot); | 560 Node* value = assembler.Parameter(Descriptor::kValue); |
549 Node* context = assembler->Parameter(Descriptor::kContext); | 561 Node* slot = assembler.Parameter(Descriptor::kSlot); |
550 Node* vector = assembler->LoadTypeFeedbackVectorForStub(); | 562 Node* context = assembler.Parameter(Descriptor::kContext); |
563 Node* vector = assembler.LoadTypeFeedbackVectorForStub(); | |
551 | 564 |
552 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, | 565 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, |
553 vector); | 566 vector); |
554 assembler->KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState())); | 567 assembler.KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState())); |
555 } | 568 } |
556 | 569 |
557 void KeyedStoreICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 570 void KeyedStoreICTFStub::GenerateAssembly( |
558 typedef compiler::Node Node; | 571 compiler::CodeAssemblerState* state) const { |
559 | 572 typedef compiler::Node Node; |
560 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 573 CodeStubAssembler assembler(state); |
561 Node* name = assembler->Parameter(Descriptor::kName); | 574 |
562 Node* value = assembler->Parameter(Descriptor::kValue); | 575 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
563 Node* slot = assembler->Parameter(Descriptor::kSlot); | 576 Node* name = assembler.Parameter(Descriptor::kName); |
564 Node* vector = assembler->Parameter(Descriptor::kVector); | 577 Node* value = assembler.Parameter(Descriptor::kValue); |
565 Node* context = assembler->Parameter(Descriptor::kContext); | 578 Node* slot = assembler.Parameter(Descriptor::kSlot); |
579 Node* vector = assembler.Parameter(Descriptor::kVector); | |
580 Node* context = assembler.Parameter(Descriptor::kContext); | |
566 | 581 |
567 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, | 582 CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot, |
568 vector); | 583 vector); |
569 assembler->KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState())); | 584 assembler.KeyedStoreIC(&p, StoreICState::GetLanguageMode(GetExtraICState())); |
570 } | 585 } |
571 | 586 |
572 void StoreMapStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 587 void StoreMapStub::GenerateAssembly(compiler::CodeAssemblerState* state) const { |
573 typedef compiler::Node Node; | 588 typedef compiler::Node Node; |
574 | 589 CodeStubAssembler assembler(state); |
575 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 590 |
576 Node* map = assembler->Parameter(Descriptor::kMap); | 591 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
577 Node* value = assembler->Parameter(Descriptor::kValue); | 592 Node* map = assembler.Parameter(Descriptor::kMap); |
578 | 593 Node* value = assembler.Parameter(Descriptor::kValue); |
579 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map); | 594 |
580 assembler->Return(value); | 595 assembler.StoreObjectField(receiver, JSObject::kMapOffset, map); |
581 } | 596 assembler.Return(value); |
582 | 597 } |
583 void StoreTransitionStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 598 |
599 void StoreTransitionStub::GenerateAssembly( | |
600 compiler::CodeAssemblerState* state) const { | |
584 typedef CodeStubAssembler::Label Label; | 601 typedef CodeStubAssembler::Label Label; |
585 typedef compiler::Node Node; | 602 typedef compiler::Node Node; |
586 | 603 CodeStubAssembler assembler(state); |
587 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 604 |
588 Node* name = assembler->Parameter(Descriptor::kName); | 605 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
606 Node* name = assembler.Parameter(Descriptor::kName); | |
589 Node* offset = | 607 Node* offset = |
590 assembler->SmiUntag(assembler->Parameter(Descriptor::kFieldOffset)); | 608 assembler.SmiUntag(assembler.Parameter(Descriptor::kFieldOffset)); |
591 Node* value = assembler->Parameter(Descriptor::kValue); | 609 Node* value = assembler.Parameter(Descriptor::kValue); |
592 Node* map = assembler->Parameter(Descriptor::kMap); | 610 Node* map = assembler.Parameter(Descriptor::kMap); |
593 Node* slot = assembler->Parameter(Descriptor::kSlot); | 611 Node* slot = assembler.Parameter(Descriptor::kSlot); |
594 Node* vector = assembler->Parameter(Descriptor::kVector); | 612 Node* vector = assembler.Parameter(Descriptor::kVector); |
595 Node* context = assembler->Parameter(Descriptor::kContext); | 613 Node* context = assembler.Parameter(Descriptor::kContext); |
596 | 614 |
597 Label miss(assembler); | 615 Label miss(&assembler); |
598 | 616 |
599 Representation representation = this->representation(); | 617 Representation representation = this->representation(); |
600 assembler->Comment("StoreTransitionStub: is_inobject: %d: representation: %s", | 618 assembler.Comment("StoreTransitionStub: is_inobject: %d: representation: %s", |
601 is_inobject(), representation.Mnemonic()); | 619 is_inobject(), representation.Mnemonic()); |
602 | 620 |
603 Node* prepared_value = | 621 Node* prepared_value = |
604 assembler->PrepareValueForWrite(value, representation, &miss); | 622 assembler.PrepareValueForWrite(value, representation, &miss); |
605 | 623 |
606 if (store_mode() == StoreTransitionStub::ExtendStorageAndStoreMapAndValue) { | 624 if (store_mode() == StoreTransitionStub::ExtendStorageAndStoreMapAndValue) { |
607 assembler->Comment("Extend storage"); | 625 assembler.Comment("Extend storage"); |
608 assembler->ExtendPropertiesBackingStore(receiver); | 626 assembler.ExtendPropertiesBackingStore(receiver); |
609 } else { | 627 } else { |
610 DCHECK(store_mode() == StoreTransitionStub::StoreMapAndValue); | 628 DCHECK(store_mode() == StoreTransitionStub::StoreMapAndValue); |
611 } | 629 } |
612 | 630 |
613 // Store the new value into the "extended" object. | 631 // Store the new value into the "extended" object. |
614 assembler->Comment("Store value"); | 632 assembler.Comment("Store value"); |
615 assembler->StoreNamedField(receiver, offset, is_inobject(), representation, | 633 assembler.StoreNamedField(receiver, offset, is_inobject(), representation, |
616 prepared_value, true); | 634 prepared_value, true); |
617 | 635 |
618 // And finally update the map. | 636 // And finally update the map. |
619 assembler->Comment("Store map"); | 637 assembler.Comment("Store map"); |
620 assembler->StoreObjectField(receiver, JSObject::kMapOffset, map); | 638 assembler.StoreObjectField(receiver, JSObject::kMapOffset, map); |
621 assembler->Return(value); | 639 assembler.Return(value); |
622 | 640 |
623 // Only store to tagged field never bails out. | 641 // Only store to tagged field never bails out. |
624 if (!representation.IsTagged()) { | 642 if (!representation.IsTagged()) { |
625 assembler->Bind(&miss); | 643 assembler.Bind(&miss); |
626 { | 644 { |
627 assembler->Comment("Miss"); | 645 assembler.Comment("Miss"); |
628 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | 646 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, |
629 vector, receiver, name); | 647 vector, receiver, name); |
630 } | 648 } |
631 } | 649 } |
632 } | 650 } |
633 | 651 |
634 void ElementsTransitionAndStoreStub::GenerateAssembly( | 652 void ElementsTransitionAndStoreStub::GenerateAssembly( |
635 CodeStubAssembler* assembler) const { | 653 compiler::CodeAssemblerState* state) const { |
636 typedef CodeStubAssembler::Label Label; | 654 typedef CodeStubAssembler::Label Label; |
637 typedef compiler::Node Node; | 655 typedef compiler::Node Node; |
638 | 656 CodeStubAssembler assembler(state); |
639 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 657 |
640 Node* key = assembler->Parameter(Descriptor::kName); | 658 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
641 Node* value = assembler->Parameter(Descriptor::kValue); | 659 Node* key = assembler.Parameter(Descriptor::kName); |
642 Node* map = assembler->Parameter(Descriptor::kMap); | 660 Node* value = assembler.Parameter(Descriptor::kValue); |
643 Node* slot = assembler->Parameter(Descriptor::kSlot); | 661 Node* map = assembler.Parameter(Descriptor::kMap); |
644 Node* vector = assembler->Parameter(Descriptor::kVector); | 662 Node* slot = assembler.Parameter(Descriptor::kSlot); |
645 Node* context = assembler->Parameter(Descriptor::kContext); | 663 Node* vector = assembler.Parameter(Descriptor::kVector); |
646 | 664 Node* context = assembler.Parameter(Descriptor::kContext); |
647 assembler->Comment( | 665 |
666 assembler.Comment( | |
648 "ElementsTransitionAndStoreStub: from_kind=%s, to_kind=%s," | 667 "ElementsTransitionAndStoreStub: from_kind=%s, to_kind=%s," |
649 " is_jsarray=%d, store_mode=%d", | 668 " is_jsarray=%d, store_mode=%d", |
650 ElementsKindToString(from_kind()), ElementsKindToString(to_kind()), | 669 ElementsKindToString(from_kind()), ElementsKindToString(to_kind()), |
651 is_jsarray(), store_mode()); | 670 is_jsarray(), store_mode()); |
652 | 671 |
653 Label miss(assembler); | 672 Label miss(&assembler); |
654 | 673 |
655 if (FLAG_trace_elements_transitions) { | 674 if (FLAG_trace_elements_transitions) { |
656 // Tracing elements transitions is the job of the runtime. | 675 // Tracing elements transitions is the job of the runtime. |
657 assembler->Goto(&miss); | 676 assembler.Goto(&miss); |
658 } else { | 677 } else { |
659 assembler->TransitionElementsKind(receiver, map, from_kind(), to_kind(), | 678 assembler.TransitionElementsKind(receiver, map, from_kind(), to_kind(), |
660 is_jsarray(), &miss); | 679 is_jsarray(), &miss); |
661 assembler->EmitElementStore(receiver, key, value, is_jsarray(), to_kind(), | 680 assembler.EmitElementStore(receiver, key, value, is_jsarray(), to_kind(), |
662 store_mode(), &miss); | 681 store_mode(), &miss); |
663 assembler->Return(value); | 682 assembler.Return(value); |
664 } | 683 } |
665 | 684 |
666 assembler->Bind(&miss); | 685 assembler.Bind(&miss); |
667 { | 686 { |
668 assembler->Comment("Miss"); | 687 assembler.Comment("Miss"); |
669 assembler->TailCallRuntime(Runtime::kElementsTransitionAndStoreIC_Miss, | 688 assembler.TailCallRuntime(Runtime::kElementsTransitionAndStoreIC_Miss, |
670 context, receiver, key, value, map, slot, | 689 context, receiver, key, value, map, slot, vector); |
671 vector); | |
672 } | 690 } |
673 } | 691 } |
674 | 692 |
675 void AllocateHeapNumberStub::GenerateAssembly( | 693 void AllocateHeapNumberStub::GenerateAssembly( |
676 CodeStubAssembler* assembler) const { | 694 compiler::CodeAssemblerState* state) const { |
677 typedef compiler::Node Node; | 695 typedef compiler::Node Node; |
678 | 696 CodeStubAssembler assembler(state); |
679 Node* result = assembler->AllocateHeapNumber(); | 697 |
680 assembler->Return(result); | 698 Node* result = assembler.AllocateHeapNumber(); |
681 } | 699 assembler.Return(result); |
682 | 700 } |
683 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \ | 701 |
684 void Allocate##Type##Stub::GenerateAssembly(CodeStubAssembler* assembler) \ | 702 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \ |
685 const { \ | 703 void Allocate##Type##Stub::GenerateAssembly( \ |
686 compiler::Node* result = \ | 704 compiler::CodeAssemblerState* state) const { \ |
687 assembler->Allocate(Simd128Value::kSize, CodeStubAssembler::kNone); \ | 705 CodeStubAssembler assembler(state); \ |
688 compiler::Node* map = assembler->LoadMap(result); \ | 706 compiler::Node* result = \ |
689 assembler->StoreNoWriteBarrier( \ | 707 assembler.Allocate(Simd128Value::kSize, CodeStubAssembler::kNone); \ |
690 MachineRepresentation::kTagged, map, \ | 708 compiler::Node* map = assembler.LoadMap(result); \ |
691 assembler->HeapConstant(isolate()->factory()->type##_map())); \ | 709 assembler.StoreNoWriteBarrier( \ |
692 assembler->Return(result); \ | 710 MachineRepresentation::kTagged, map, \ |
711 assembler.HeapConstant(isolate()->factory()->type##_map())); \ | |
712 assembler.Return(result); \ | |
693 } | 713 } |
694 SIMD128_TYPES(SIMD128_GEN_ASM) | 714 SIMD128_TYPES(SIMD128_GEN_ASM) |
695 #undef SIMD128_GEN_ASM | 715 #undef SIMD128_GEN_ASM |
696 | 716 |
697 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 717 void StringLengthStub::GenerateAssembly( |
698 compiler::Node* value = assembler->Parameter(0); | 718 compiler::CodeAssemblerState* state) const { |
699 compiler::Node* string = assembler->LoadJSValueValue(value); | 719 CodeStubAssembler assembler(state); |
700 compiler::Node* result = assembler->LoadStringLength(string); | 720 compiler::Node* value = assembler.Parameter(0); |
701 assembler->Return(result); | 721 compiler::Node* string = assembler.LoadJSValueValue(value); |
702 } | 722 compiler::Node* result = assembler.LoadStringLength(string); |
723 assembler.Return(result); | |
724 } | |
725 | |
726 #define BINARY_OP_STUB(Name) \ | |
727 void Name::GenerateAssembly(compiler::CodeAssemblerState* state) const { \ | |
728 typedef BinaryOpWithVectorDescriptor Descriptor; \ | |
729 CodeStubAssembler assembler(state); \ | |
730 assembler.Return(Generate(&assembler, \ | |
731 assembler.Parameter(Descriptor::kLeft), \ | |
732 assembler.Parameter(Descriptor::kRight), \ | |
733 assembler.Parameter(Descriptor::kSlot), \ | |
734 assembler.Parameter(Descriptor::kVector), \ | |
735 assembler.Parameter(Descriptor::kContext))); \ | |
736 } | |
737 BINARY_OP_STUB(AddWithFeedbackStub) | |
738 BINARY_OP_STUB(SubtractWithFeedbackStub) | |
739 BINARY_OP_STUB(MultiplyWithFeedbackStub) | |
740 BINARY_OP_STUB(DivideWithFeedbackStub) | |
741 BINARY_OP_STUB(ModulusWithFeedbackStub) | |
742 #undef BINARY_OP_STUB | |
703 | 743 |
704 // static | 744 // static |
705 compiler::Node* AddWithFeedbackStub::Generate( | 745 compiler::Node* AddWithFeedbackStub::Generate( |
706 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* rhs, | 746 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* rhs, |
707 compiler::Node* slot_id, compiler::Node* type_feedback_vector, | 747 compiler::Node* slot_id, compiler::Node* type_feedback_vector, |
708 compiler::Node* context) { | 748 compiler::Node* context) { |
709 typedef CodeStubAssembler::Label Label; | 749 typedef CodeStubAssembler::Label Label; |
710 typedef compiler::Node Node; | 750 typedef compiler::Node Node; |
711 typedef CodeStubAssembler::Variable Variable; | 751 typedef CodeStubAssembler::Variable Variable; |
712 | 752 |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1644 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor)); | 1684 var_result.Bind(assembler->CallStub(callable, context, dividend, divisor)); |
1645 assembler->Goto(&end); | 1685 assembler->Goto(&end); |
1646 } | 1686 } |
1647 | 1687 |
1648 assembler->Bind(&end); | 1688 assembler->Bind(&end); |
1649 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, | 1689 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, |
1650 slot_id); | 1690 slot_id); |
1651 return var_result.value(); | 1691 return var_result.value(); |
1652 } | 1692 } |
1653 | 1693 |
1694 #define UNARY_OP_STUB(Name) \ | |
1695 void Name::GenerateAssembly(compiler::CodeAssemblerState* state) const { \ | |
1696 CodeStubAssembler assembler(state); \ | |
1697 assembler.Return(Generate(&assembler, assembler.Parameter(0), \ | |
Jakob Kummerow
2016/11/15 09:51:50
I can't use named constants here because we don't
Igor Sheludko
2016/11/15 13:06:35
It's actually a CountOpDescriptor. So if you defin
Jakob Kummerow
2016/11/15 13:40:31
I still think it's an unrelated change :-)
I can d
Igor Sheludko
2016/11/15 14:02:53
Acknowledged.
| |
1698 assembler.Parameter(1), assembler.Parameter(2), \ | |
1699 assembler.Parameter(3))); \ | |
1700 } | |
1701 UNARY_OP_STUB(IncStub) | |
1702 UNARY_OP_STUB(DecStub) | |
1703 #undef UNARY_OP_STUB | |
1704 | |
1654 // static | 1705 // static |
1655 compiler::Node* IncStub::Generate(CodeStubAssembler* assembler, | 1706 compiler::Node* IncStub::Generate(CodeStubAssembler* assembler, |
1656 compiler::Node* value, | 1707 compiler::Node* value, |
1657 compiler::Node* context, | 1708 compiler::Node* context, |
1658 compiler::Node* type_feedback_vector, | 1709 compiler::Node* type_feedback_vector, |
1659 compiler::Node* slot_id) { | 1710 compiler::Node* slot_id) { |
1660 typedef CodeStubAssembler::Label Label; | 1711 typedef CodeStubAssembler::Label Label; |
1661 typedef compiler::Node Node; | 1712 typedef compiler::Node Node; |
1662 typedef CodeStubAssembler::Variable Variable; | 1713 typedef CodeStubAssembler::Variable Variable; |
1663 | 1714 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1777 result_var.Bind(assembler->AllocateHeapNumberWithValue(finc_result)); | 1828 result_var.Bind(assembler->AllocateHeapNumberWithValue(finc_result)); |
1778 assembler->Goto(&end); | 1829 assembler->Goto(&end); |
1779 } | 1830 } |
1780 | 1831 |
1781 assembler->Bind(&end); | 1832 assembler->Bind(&end); |
1782 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, | 1833 assembler->UpdateFeedback(var_type_feedback.value(), type_feedback_vector, |
1783 slot_id); | 1834 slot_id); |
1784 return result_var.value(); | 1835 return result_var.value(); |
1785 } | 1836 } |
1786 | 1837 |
1787 void NumberToStringStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 1838 void NumberToStringStub::GenerateAssembly( |
1839 compiler::CodeAssemblerState* state) const { | |
1788 typedef compiler::Node Node; | 1840 typedef compiler::Node Node; |
1789 Node* argument = assembler->Parameter(Descriptor::kArgument); | 1841 CodeStubAssembler assembler(state); |
1790 Node* context = assembler->Parameter(Descriptor::kContext); | 1842 Node* argument = assembler.Parameter(Descriptor::kArgument); |
1791 assembler->Return(assembler->NumberToString(context, argument)); | 1843 Node* context = assembler.Parameter(Descriptor::kContext); |
1844 assembler.Return(assembler.NumberToString(context, argument)); | |
1792 } | 1845 } |
1793 | 1846 |
1794 // static | 1847 // static |
1795 compiler::Node* DecStub::Generate(CodeStubAssembler* assembler, | 1848 compiler::Node* DecStub::Generate(CodeStubAssembler* assembler, |
1796 compiler::Node* value, | 1849 compiler::Node* value, |
1797 compiler::Node* context, | 1850 compiler::Node* context, |
1798 compiler::Node* type_feedback_vector, | 1851 compiler::Node* type_feedback_vector, |
1799 compiler::Node* slot_id) { | 1852 compiler::Node* slot_id) { |
1800 typedef CodeStubAssembler::Label Label; | 1853 typedef CodeStubAssembler::Label Label; |
1801 typedef compiler::Node Node; | 1854 typedef compiler::Node Node; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1926 | 1979 |
1927 // ES6 section 21.1.3.19 String.prototype.substring ( start, end ) | 1980 // ES6 section 21.1.3.19 String.prototype.substring ( start, end ) |
1928 compiler::Node* SubStringStub::Generate(CodeStubAssembler* assembler, | 1981 compiler::Node* SubStringStub::Generate(CodeStubAssembler* assembler, |
1929 compiler::Node* string, | 1982 compiler::Node* string, |
1930 compiler::Node* from, | 1983 compiler::Node* from, |
1931 compiler::Node* to, | 1984 compiler::Node* to, |
1932 compiler::Node* context) { | 1985 compiler::Node* context) { |
1933 return assembler->SubString(context, string, from, to); | 1986 return assembler->SubString(context, string, from, to); |
1934 } | 1987 } |
1935 | 1988 |
1936 void LoadApiGetterStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 1989 void SubStringStub::GenerateAssembly( |
1990 compiler::CodeAssemblerState* state) const { | |
1991 CodeStubAssembler assembler(state); | |
1992 assembler.Return(Generate(&assembler, | |
1993 assembler.Parameter(Descriptor::kString), | |
1994 assembler.Parameter(Descriptor::kFrom), | |
1995 assembler.Parameter(Descriptor::kTo), | |
1996 assembler.Parameter(Descriptor::kContext))); | |
1997 } | |
1998 | |
1999 void LoadApiGetterStub::GenerateAssembly( | |
2000 compiler::CodeAssemblerState* state) const { | |
1937 typedef compiler::Node Node; | 2001 typedef compiler::Node Node; |
1938 Node* context = assembler->Parameter(Descriptor::kContext); | 2002 CodeStubAssembler assembler(state); |
1939 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2003 Node* context = assembler.Parameter(Descriptor::kContext); |
2004 Node* receiver = assembler.Parameter(Descriptor::kReceiver); | |
1940 // For now we only support receiver_is_holder. | 2005 // For now we only support receiver_is_holder. |
1941 DCHECK(receiver_is_holder()); | 2006 DCHECK(receiver_is_holder()); |
1942 Node* holder = receiver; | 2007 Node* holder = receiver; |
1943 Node* map = assembler->LoadMap(receiver); | 2008 Node* map = assembler.LoadMap(receiver); |
1944 Node* descriptors = assembler->LoadMapDescriptors(map); | 2009 Node* descriptors = assembler.LoadMapDescriptors(map); |
1945 Node* value_index = | 2010 Node* value_index = |
1946 assembler->IntPtrConstant(DescriptorArray::ToValueIndex(index())); | 2011 assembler.IntPtrConstant(DescriptorArray::ToValueIndex(index())); |
1947 Node* callback = assembler->LoadFixedArrayElement( | 2012 Node* callback = assembler.LoadFixedArrayElement( |
1948 descriptors, value_index, 0, CodeStubAssembler::INTPTR_PARAMETERS); | 2013 descriptors, value_index, 0, CodeStubAssembler::INTPTR_PARAMETERS); |
1949 assembler->TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver, | 2014 assembler.TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver, |
1950 holder, callback); | 2015 holder, callback); |
1951 } | 2016 } |
1952 | 2017 |
1953 void StoreFieldStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 2018 void StoreFieldStub::GenerateAssembly( |
2019 compiler::CodeAssemblerState* state) const { | |
1954 typedef CodeStubAssembler::Label Label; | 2020 typedef CodeStubAssembler::Label Label; |
1955 typedef compiler::Node Node; | 2021 typedef compiler::Node Node; |
2022 CodeStubAssembler assembler(state); | |
1956 | 2023 |
1957 FieldIndex index = this->index(); | 2024 FieldIndex index = this->index(); |
1958 Representation representation = this->representation(); | 2025 Representation representation = this->representation(); |
1959 | 2026 |
1960 assembler->Comment("StoreFieldStub: inobject=%d, offset=%d, rep=%s", | 2027 assembler.Comment("StoreFieldStub: inobject=%d, offset=%d, rep=%s", |
1961 index.is_inobject(), index.offset(), | 2028 index.is_inobject(), index.offset(), |
1962 representation.Mnemonic()); | 2029 representation.Mnemonic()); |
1963 | 2030 |
1964 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2031 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
1965 Node* name = assembler->Parameter(Descriptor::kName); | 2032 Node* name = assembler.Parameter(Descriptor::kName); |
1966 Node* value = assembler->Parameter(Descriptor::kValue); | 2033 Node* value = assembler.Parameter(Descriptor::kValue); |
1967 Node* slot = assembler->Parameter(Descriptor::kSlot); | 2034 Node* slot = assembler.Parameter(Descriptor::kSlot); |
1968 Node* vector = assembler->Parameter(Descriptor::kVector); | 2035 Node* vector = assembler.Parameter(Descriptor::kVector); |
1969 Node* context = assembler->Parameter(Descriptor::kContext); | 2036 Node* context = assembler.Parameter(Descriptor::kContext); |
1970 | 2037 |
1971 Label miss(assembler); | 2038 Label miss(&assembler); |
1972 | 2039 |
1973 Node* prepared_value = | 2040 Node* prepared_value = |
1974 assembler->PrepareValueForWrite(value, representation, &miss); | 2041 assembler.PrepareValueForWrite(value, representation, &miss); |
1975 assembler->StoreNamedField(receiver, index, representation, prepared_value, | 2042 assembler.StoreNamedField(receiver, index, representation, prepared_value, |
1976 false); | 2043 false); |
1977 assembler->Return(value); | 2044 assembler.Return(value); |
1978 | 2045 |
1979 // Only stores to tagged field can't bailout. | 2046 // Only stores to tagged field can't bailout. |
1980 if (!representation.IsTagged()) { | 2047 if (!representation.IsTagged()) { |
1981 assembler->Bind(&miss); | 2048 assembler.Bind(&miss); |
1982 { | 2049 { |
1983 assembler->Comment("Miss"); | 2050 assembler.Comment("Miss"); |
1984 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | 2051 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, |
1985 vector, receiver, name); | 2052 vector, receiver, name); |
1986 } | 2053 } |
1987 } | 2054 } |
1988 } | 2055 } |
1989 | 2056 |
1990 void StoreGlobalStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 2057 void StoreGlobalStub::GenerateAssembly( |
2058 compiler::CodeAssemblerState* state) const { | |
1991 typedef CodeStubAssembler::Label Label; | 2059 typedef CodeStubAssembler::Label Label; |
1992 typedef compiler::Node Node; | 2060 typedef compiler::Node Node; |
2061 CodeStubAssembler assembler(state); | |
1993 | 2062 |
1994 assembler->Comment( | 2063 assembler.Comment( |
1995 "StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d", | 2064 "StoreGlobalStub: cell_type=%d, constant_type=%d, check_global=%d", |
1996 cell_type(), PropertyCellType::kConstantType == cell_type() | 2065 cell_type(), PropertyCellType::kConstantType == cell_type() |
1997 ? static_cast<int>(constant_type()) | 2066 ? static_cast<int>(constant_type()) |
1998 : -1, | 2067 : -1, |
1999 check_global()); | 2068 check_global()); |
2000 | 2069 |
2001 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2070 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2002 Node* name = assembler->Parameter(Descriptor::kName); | 2071 Node* name = assembler.Parameter(Descriptor::kName); |
2003 Node* value = assembler->Parameter(Descriptor::kValue); | 2072 Node* value = assembler.Parameter(Descriptor::kValue); |
2004 Node* slot = assembler->Parameter(Descriptor::kSlot); | 2073 Node* slot = assembler.Parameter(Descriptor::kSlot); |
2005 Node* vector = assembler->Parameter(Descriptor::kVector); | 2074 Node* vector = assembler.Parameter(Descriptor::kVector); |
2006 Node* context = assembler->Parameter(Descriptor::kContext); | 2075 Node* context = assembler.Parameter(Descriptor::kContext); |
2007 | 2076 |
2008 Label miss(assembler); | 2077 Label miss(&assembler); |
2009 | 2078 |
2010 if (check_global()) { | 2079 if (check_global()) { |
2011 // Check that the map of the global has not changed: use a placeholder map | 2080 // Check that the map of the global has not changed: use a placeholder map |
2012 // that will be replaced later with the global object's map. | 2081 // that will be replaced later with the global object's map. |
2013 Node* proxy_map = assembler->LoadMap(receiver); | 2082 Node* proxy_map = assembler.LoadMap(receiver); |
2014 Node* global = assembler->LoadObjectField(proxy_map, Map::kPrototypeOffset); | 2083 Node* global = assembler.LoadObjectField(proxy_map, Map::kPrototypeOffset); |
2015 Node* map_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell( | 2084 Node* map_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell( |
2016 StoreGlobalStub::global_map_placeholder(isolate()))); | 2085 StoreGlobalStub::global_map_placeholder(isolate()))); |
2017 Node* expected_map = assembler->LoadWeakCellValueUnchecked(map_cell); | 2086 Node* expected_map = assembler.LoadWeakCellValueUnchecked(map_cell); |
2018 Node* map = assembler->LoadMap(global); | 2087 Node* map = assembler.LoadMap(global); |
2019 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss); | 2088 assembler.GotoIf(assembler.WordNotEqual(expected_map, map), &miss); |
2020 } | 2089 } |
2021 | 2090 |
2022 Node* weak_cell = assembler->HeapConstant(isolate()->factory()->NewWeakCell( | 2091 Node* weak_cell = assembler.HeapConstant(isolate()->factory()->NewWeakCell( |
2023 StoreGlobalStub::property_cell_placeholder(isolate()))); | 2092 StoreGlobalStub::property_cell_placeholder(isolate()))); |
2024 Node* cell = assembler->LoadWeakCellValue(weak_cell); | 2093 Node* cell = assembler.LoadWeakCellValue(weak_cell); |
2025 assembler->GotoIf(assembler->TaggedIsSmi(cell), &miss); | 2094 assembler.GotoIf(assembler.TaggedIsSmi(cell), &miss); |
2026 | 2095 |
2027 // Load the payload of the global parameter cell. A hole indicates that the | 2096 // Load the payload of the global parameter cell. A hole indicates that the |
2028 // cell has been invalidated and that the store must be handled by the | 2097 // cell has been invalidated and that the store must be handled by the |
2029 // runtime. | 2098 // runtime. |
2030 Node* cell_contents = | 2099 Node* cell_contents = |
2031 assembler->LoadObjectField(cell, PropertyCell::kValueOffset); | 2100 assembler.LoadObjectField(cell, PropertyCell::kValueOffset); |
2032 | 2101 |
2033 PropertyCellType cell_type = this->cell_type(); | 2102 PropertyCellType cell_type = this->cell_type(); |
2034 if (cell_type == PropertyCellType::kConstant || | 2103 if (cell_type == PropertyCellType::kConstant || |
2035 cell_type == PropertyCellType::kUndefined) { | 2104 cell_type == PropertyCellType::kUndefined) { |
2036 // This is always valid for all states a cell can be in. | 2105 // This is always valid for all states a cell can be in. |
2037 assembler->GotoIf(assembler->WordNotEqual(cell_contents, value), &miss); | 2106 assembler.GotoIf(assembler.WordNotEqual(cell_contents, value), &miss); |
2038 } else { | 2107 } else { |
2039 assembler->GotoIf(assembler->IsTheHole(cell_contents), &miss); | 2108 assembler.GotoIf(assembler.IsTheHole(cell_contents), &miss); |
2040 | 2109 |
2041 // When dealing with constant types, the type may be allowed to change, as | 2110 // When dealing with constant types, the type may be allowed to change, as |
2042 // long as optimized code remains valid. | 2111 // long as optimized code remains valid. |
2043 bool value_is_smi = false; | 2112 bool value_is_smi = false; |
2044 if (cell_type == PropertyCellType::kConstantType) { | 2113 if (cell_type == PropertyCellType::kConstantType) { |
2045 switch (constant_type()) { | 2114 switch (constant_type()) { |
2046 case PropertyCellConstantType::kSmi: | 2115 case PropertyCellConstantType::kSmi: |
2047 assembler->GotoUnless(assembler->TaggedIsSmi(value), &miss); | 2116 assembler.GotoUnless(assembler.TaggedIsSmi(value), &miss); |
2048 value_is_smi = true; | 2117 value_is_smi = true; |
2049 break; | 2118 break; |
2050 case PropertyCellConstantType::kStableMap: { | 2119 case PropertyCellConstantType::kStableMap: { |
2051 // It is sufficient here to check that the value and cell contents | 2120 // It is sufficient here to check that the value and cell contents |
2052 // have identical maps, no matter if they are stable or not or if they | 2121 // have identical maps, no matter if they are stable or not or if they |
2053 // are the maps that were originally in the cell or not. If optimized | 2122 // are the maps that were originally in the cell or not. If optimized |
2054 // code will deopt when a cell has a unstable map and if it has a | 2123 // code will deopt when a cell has a unstable map and if it has a |
2055 // dependency on a stable map, it will deopt if the map destabilizes. | 2124 // dependency on a stable map, it will deopt if the map destabilizes. |
2056 assembler->GotoIf(assembler->TaggedIsSmi(value), &miss); | 2125 assembler.GotoIf(assembler.TaggedIsSmi(value), &miss); |
2057 assembler->GotoIf(assembler->TaggedIsSmi(cell_contents), &miss); | 2126 assembler.GotoIf(assembler.TaggedIsSmi(cell_contents), &miss); |
2058 Node* expected_map = assembler->LoadMap(cell_contents); | 2127 Node* expected_map = assembler.LoadMap(cell_contents); |
2059 Node* map = assembler->LoadMap(value); | 2128 Node* map = assembler.LoadMap(value); |
2060 assembler->GotoIf(assembler->WordNotEqual(expected_map, map), &miss); | 2129 assembler.GotoIf(assembler.WordNotEqual(expected_map, map), &miss); |
2061 break; | 2130 break; |
2062 } | 2131 } |
2063 } | 2132 } |
2064 } | 2133 } |
2065 if (value_is_smi) { | 2134 if (value_is_smi) { |
2066 assembler->StoreObjectFieldNoWriteBarrier( | 2135 assembler.StoreObjectFieldNoWriteBarrier(cell, PropertyCell::kValueOffset, |
2067 cell, PropertyCell::kValueOffset, value); | 2136 value); |
2068 } else { | 2137 } else { |
2069 assembler->StoreObjectField(cell, PropertyCell::kValueOffset, value); | 2138 assembler.StoreObjectField(cell, PropertyCell::kValueOffset, value); |
2070 } | 2139 } |
2071 } | 2140 } |
2072 | 2141 |
2073 assembler->Return(value); | 2142 assembler.Return(value); |
2074 | 2143 |
2075 assembler->Bind(&miss); | 2144 assembler.Bind(&miss); |
2076 { | 2145 { |
2077 assembler->Comment("Miss"); | 2146 assembler.Comment("Miss"); |
2078 assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, | 2147 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, |
2079 vector, receiver, name); | 2148 vector, receiver, name); |
2080 } | 2149 } |
2081 } | 2150 } |
2082 | 2151 |
2083 void KeyedLoadSloppyArgumentsStub::GenerateAssembly( | 2152 void KeyedLoadSloppyArgumentsStub::GenerateAssembly( |
2084 CodeStubAssembler* assembler) const { | 2153 compiler::CodeAssemblerState* state) const { |
2085 typedef CodeStubAssembler::Label Label; | 2154 typedef CodeStubAssembler::Label Label; |
2086 typedef compiler::Node Node; | 2155 typedef compiler::Node Node; |
2156 CodeStubAssembler assembler(state); | |
2087 | 2157 |
2088 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2158 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2089 Node* key = assembler->Parameter(Descriptor::kName); | 2159 Node* key = assembler.Parameter(Descriptor::kName); |
2090 Node* slot = assembler->Parameter(Descriptor::kSlot); | 2160 Node* slot = assembler.Parameter(Descriptor::kSlot); |
2091 Node* vector = assembler->Parameter(Descriptor::kVector); | 2161 Node* vector = assembler.Parameter(Descriptor::kVector); |
2092 Node* context = assembler->Parameter(Descriptor::kContext); | 2162 Node* context = assembler.Parameter(Descriptor::kContext); |
2093 | 2163 |
2094 Label miss(assembler); | 2164 Label miss(&assembler); |
2095 | 2165 |
2096 Node* result = assembler->LoadKeyedSloppyArguments(receiver, key, &miss); | 2166 Node* result = assembler.LoadKeyedSloppyArguments(receiver, key, &miss); |
2097 assembler->Return(result); | 2167 assembler.Return(result); |
2098 | 2168 |
2099 assembler->Bind(&miss); | 2169 assembler.Bind(&miss); |
2100 { | 2170 { |
2101 assembler->Comment("Miss"); | 2171 assembler.Comment("Miss"); |
2102 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, | 2172 assembler.TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, |
2103 key, slot, vector); | 2173 key, slot, vector); |
2104 } | 2174 } |
2105 } | 2175 } |
2106 | 2176 |
2107 void KeyedStoreSloppyArgumentsStub::GenerateAssembly( | 2177 void KeyedStoreSloppyArgumentsStub::GenerateAssembly( |
2108 CodeStubAssembler* assembler) const { | 2178 compiler::CodeAssemblerState* state) const { |
2109 typedef CodeStubAssembler::Label Label; | 2179 typedef CodeStubAssembler::Label Label; |
2110 typedef compiler::Node Node; | 2180 typedef compiler::Node Node; |
2181 CodeStubAssembler assembler(state); | |
2111 | 2182 |
2112 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2183 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2113 Node* key = assembler->Parameter(Descriptor::kName); | 2184 Node* key = assembler.Parameter(Descriptor::kName); |
2114 Node* value = assembler->Parameter(Descriptor::kValue); | 2185 Node* value = assembler.Parameter(Descriptor::kValue); |
2115 Node* slot = assembler->Parameter(Descriptor::kSlot); | 2186 Node* slot = assembler.Parameter(Descriptor::kSlot); |
2116 Node* vector = assembler->Parameter(Descriptor::kVector); | 2187 Node* vector = assembler.Parameter(Descriptor::kVector); |
2117 Node* context = assembler->Parameter(Descriptor::kContext); | 2188 Node* context = assembler.Parameter(Descriptor::kContext); |
2118 | 2189 |
2119 Label miss(assembler); | 2190 Label miss(&assembler); |
2120 | 2191 |
2121 assembler->StoreKeyedSloppyArguments(receiver, key, value, &miss); | 2192 assembler.StoreKeyedSloppyArguments(receiver, key, value, &miss); |
2122 assembler->Return(value); | 2193 assembler.Return(value); |
2123 | 2194 |
2124 assembler->Bind(&miss); | 2195 assembler.Bind(&miss); |
2125 { | 2196 { |
2126 assembler->Comment("Miss"); | 2197 assembler.Comment("Miss"); |
2127 assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, | 2198 assembler.TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, |
2128 slot, vector, receiver, key); | 2199 vector, receiver, key); |
2129 } | 2200 } |
2130 } | 2201 } |
2131 | 2202 |
2132 void LoadScriptContextFieldStub::GenerateAssembly( | 2203 void LoadScriptContextFieldStub::GenerateAssembly( |
2133 CodeStubAssembler* assembler) const { | 2204 compiler::CodeAssemblerState* state) const { |
2134 typedef compiler::Node Node; | 2205 typedef compiler::Node Node; |
2206 CodeStubAssembler assembler(state); | |
2135 | 2207 |
2136 assembler->Comment("LoadScriptContextFieldStub: context_index=%d, slot=%d", | 2208 assembler.Comment("LoadScriptContextFieldStub: context_index=%d, slot=%d", |
2137 context_index(), slot_index()); | 2209 context_index(), slot_index()); |
2138 | 2210 |
2139 Node* context = assembler->Parameter(Descriptor::kContext); | 2211 Node* context = assembler.Parameter(Descriptor::kContext); |
2140 | 2212 |
2141 Node* script_context = assembler->LoadScriptContext(context, context_index()); | 2213 Node* script_context = assembler.LoadScriptContext(context, context_index()); |
2142 Node* result = assembler->LoadFixedArrayElement( | 2214 Node* result = assembler.LoadFixedArrayElement( |
2143 script_context, assembler->IntPtrConstant(slot_index()), 0, | 2215 script_context, assembler.IntPtrConstant(slot_index()), 0, |
2144 CodeStubAssembler::INTPTR_PARAMETERS); | 2216 CodeStubAssembler::INTPTR_PARAMETERS); |
2145 assembler->Return(result); | 2217 assembler.Return(result); |
2146 } | 2218 } |
2147 | 2219 |
2148 void StoreScriptContextFieldStub::GenerateAssembly( | 2220 void StoreScriptContextFieldStub::GenerateAssembly( |
2149 CodeStubAssembler* assembler) const { | 2221 compiler::CodeAssemblerState* state) const { |
2150 typedef compiler::Node Node; | 2222 typedef compiler::Node Node; |
2223 CodeStubAssembler assembler(state); | |
2151 | 2224 |
2152 assembler->Comment("StoreScriptContextFieldStub: context_index=%d, slot=%d", | 2225 assembler.Comment("StoreScriptContextFieldStub: context_index=%d, slot=%d", |
2153 context_index(), slot_index()); | 2226 context_index(), slot_index()); |
2154 | 2227 |
2155 Node* value = assembler->Parameter(Descriptor::kValue); | 2228 Node* value = assembler.Parameter(Descriptor::kValue); |
2156 Node* context = assembler->Parameter(Descriptor::kContext); | 2229 Node* context = assembler.Parameter(Descriptor::kContext); |
2157 | 2230 |
2158 Node* script_context = assembler->LoadScriptContext(context, context_index()); | 2231 Node* script_context = assembler.LoadScriptContext(context, context_index()); |
2159 assembler->StoreFixedArrayElement( | 2232 assembler.StoreFixedArrayElement( |
2160 script_context, assembler->IntPtrConstant(slot_index()), value, | 2233 script_context, assembler.IntPtrConstant(slot_index()), value, |
2161 UPDATE_WRITE_BARRIER, CodeStubAssembler::INTPTR_PARAMETERS); | 2234 UPDATE_WRITE_BARRIER, CodeStubAssembler::INTPTR_PARAMETERS); |
2162 assembler->Return(value); | 2235 assembler.Return(value); |
2163 } | 2236 } |
2164 | 2237 |
2165 void StoreInterceptorStub::GenerateAssembly( | 2238 void StoreInterceptorStub::GenerateAssembly( |
2166 CodeStubAssembler* assembler) const { | 2239 compiler::CodeAssemblerState* state) const { |
2167 typedef compiler::Node Node; | 2240 typedef compiler::Node Node; |
2241 CodeStubAssembler assembler(state); | |
2168 | 2242 |
2169 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2243 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2170 Node* name = assembler->Parameter(Descriptor::kName); | 2244 Node* name = assembler.Parameter(Descriptor::kName); |
2171 Node* value = assembler->Parameter(Descriptor::kValue); | 2245 Node* value = assembler.Parameter(Descriptor::kValue); |
2172 Node* context = assembler->Parameter(Descriptor::kContext); | 2246 Node* context = assembler.Parameter(Descriptor::kContext); |
2173 assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, | 2247 assembler.TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, |
2174 receiver, name, value); | 2248 receiver, name, value); |
2175 } | 2249 } |
2176 | 2250 |
2177 void LoadIndexedInterceptorStub::GenerateAssembly( | 2251 void LoadIndexedInterceptorStub::GenerateAssembly( |
2178 CodeStubAssembler* assembler) const { | 2252 compiler::CodeAssemblerState* state) const { |
2179 typedef compiler::Node Node; | 2253 typedef compiler::Node Node; |
2180 typedef CodeStubAssembler::Label Label; | 2254 typedef CodeStubAssembler::Label Label; |
2255 CodeStubAssembler assembler(state); | |
2181 | 2256 |
2182 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 2257 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2183 Node* key = assembler->Parameter(Descriptor::kName); | 2258 Node* key = assembler.Parameter(Descriptor::kName); |
2184 Node* slot = assembler->Parameter(Descriptor::kSlot); | 2259 Node* slot = assembler.Parameter(Descriptor::kSlot); |
2185 Node* vector = assembler->Parameter(Descriptor::kVector); | 2260 Node* vector = assembler.Parameter(Descriptor::kVector); |
2186 Node* context = assembler->Parameter(Descriptor::kContext); | 2261 Node* context = assembler.Parameter(Descriptor::kContext); |
2187 | 2262 |
2188 Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler); | 2263 Label if_keyispositivesmi(&assembler), if_keyisinvalid(&assembler); |
2189 assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi, | 2264 assembler.Branch(assembler.WordIsPositiveSmi(key), &if_keyispositivesmi, |
2190 &if_keyisinvalid); | 2265 &if_keyisinvalid); |
2191 assembler->Bind(&if_keyispositivesmi); | 2266 assembler.Bind(&if_keyispositivesmi); |
2192 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, | 2267 assembler.TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, |
2193 receiver, key); | 2268 receiver, key); |
2194 | 2269 |
2195 assembler->Bind(&if_keyisinvalid); | 2270 assembler.Bind(&if_keyisinvalid); |
2196 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, | 2271 assembler.TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, |
2197 slot, vector); | 2272 slot, vector); |
2198 } | 2273 } |
2199 | 2274 |
2200 // static | 2275 // static |
2201 bool FastCloneShallowObjectStub::IsSupported(ObjectLiteral* expr) { | 2276 bool FastCloneShallowObjectStub::IsSupported(ObjectLiteral* expr) { |
2202 // FastCloneShallowObjectStub doesn't copy elements, and object literals don't | 2277 // FastCloneShallowObjectStub doesn't copy elements, and object literals don't |
2203 // support copy-on-write (COW) elements for now. | 2278 // support copy-on-write (COW) elements for now. |
2204 // TODO(mvstanton): make object literals support COW elements. | 2279 // TODO(mvstanton): make object literals support COW elements. |
2205 return expr->fast_elements() && expr->has_shallow_properties() && | 2280 return expr->fast_elements() && expr->has_shallow_properties() && |
2206 expr->properties_count() <= kMaximumClonedProperties; | 2281 expr->properties_count() <= kMaximumClonedProperties; |
2207 } | 2282 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2294 assembler->StoreObjectFieldNoWriteBarrier( | 2369 assembler->StoreObjectFieldNoWriteBarrier( |
2295 allocation_site, AllocationSite::kPretenureCreateCountOffset, | 2370 allocation_site, AllocationSite::kPretenureCreateCountOffset, |
2296 memento_create_count); | 2371 memento_create_count); |
2297 } | 2372 } |
2298 | 2373 |
2299 // TODO(verwaest): Allocate and fill in double boxes. | 2374 // TODO(verwaest): Allocate and fill in double boxes. |
2300 return copy; | 2375 return copy; |
2301 } | 2376 } |
2302 | 2377 |
2303 void FastCloneShallowObjectStub::GenerateAssembly( | 2378 void FastCloneShallowObjectStub::GenerateAssembly( |
2304 CodeStubAssembler* assembler) const { | 2379 compiler::CodeAssemblerState* state) const { |
2305 typedef CodeStubAssembler::Label Label; | 2380 typedef CodeStubAssembler::Label Label; |
2306 typedef compiler::Node Node; | 2381 typedef compiler::Node Node; |
2307 Label call_runtime(assembler); | 2382 CodeStubAssembler assembler(state); |
2308 Node* closure = assembler->Parameter(0); | 2383 |
2309 Node* literals_index = assembler->Parameter(1); | 2384 Label call_runtime(&assembler); |
2385 Node* closure = assembler.Parameter(0); | |
2386 Node* literals_index = assembler.Parameter(1); | |
2310 | 2387 |
2311 Node* properties_count = | 2388 Node* properties_count = |
2312 assembler->IntPtrConstant(PropertiesCount(this->length())); | 2389 assembler.IntPtrConstant(PropertiesCount(this->length())); |
2313 Node* copy = GenerateFastPath(assembler, &call_runtime, closure, | 2390 Node* copy = GenerateFastPath(&assembler, &call_runtime, closure, |
2314 literals_index, properties_count); | 2391 literals_index, properties_count); |
2315 assembler->Return(copy); | 2392 assembler.Return(copy); |
2316 | 2393 |
2317 assembler->Bind(&call_runtime); | 2394 assembler.Bind(&call_runtime); |
2318 Node* constant_properties = assembler->Parameter(2); | 2395 Node* constant_properties = assembler.Parameter(2); |
2319 Node* flags = assembler->Parameter(3); | 2396 Node* flags = assembler.Parameter(3); |
2320 Node* context = assembler->Parameter(4); | 2397 Node* context = assembler.Parameter(4); |
2321 assembler->TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure, | 2398 assembler.TailCallRuntime(Runtime::kCreateObjectLiteral, context, closure, |
2322 literals_index, constant_properties, flags); | 2399 literals_index, constant_properties, flags); |
2323 } | 2400 } |
2324 | 2401 |
2325 template<class StateType> | 2402 template<class StateType> |
2326 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { | 2403 void HydrogenCodeStub::TraceTransition(StateType from, StateType to) { |
2327 // Note: Although a no-op transition is semantically OK, it is hinting at a | 2404 // Note: Although a no-op transition is semantically OK, it is hinting at a |
2328 // bug somewhere in our state transition machinery. | 2405 // bug somewhere in our state transition machinery. |
2329 DCHECK(from != to); | 2406 DCHECK(from != to); |
2330 if (!FLAG_trace_ic) return; | 2407 if (!FLAG_trace_ic) return; |
2331 OFStream os(stdout); | 2408 OFStream os(stdout); |
2332 os << "["; | 2409 os << "["; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2405 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); | 2482 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); |
2406 } | 2483 } |
2407 | 2484 |
2408 | 2485 |
2409 void BinaryOpWithAllocationSiteStub::InitializeDescriptor( | 2486 void BinaryOpWithAllocationSiteStub::InitializeDescriptor( |
2410 CodeStubDescriptor* descriptor) { | 2487 CodeStubDescriptor* descriptor) { |
2411 descriptor->Initialize( | 2488 descriptor->Initialize( |
2412 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); | 2489 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); |
2413 } | 2490 } |
2414 | 2491 |
2415 void GetPropertyStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 2492 void GetPropertyStub::GenerateAssembly( |
2493 compiler::CodeAssemblerState* state) const { | |
2416 typedef compiler::Node Node; | 2494 typedef compiler::Node Node; |
2417 typedef CodeStubAssembler::Label Label; | 2495 typedef CodeStubAssembler::Label Label; |
2418 typedef CodeStubAssembler::Variable Variable; | 2496 typedef CodeStubAssembler::Variable Variable; |
2497 CodeStubAssembler assembler(state); | |
2419 | 2498 |
2420 Label call_runtime(assembler, Label::kDeferred), return_undefined(assembler), | 2499 Label call_runtime(&assembler, Label::kDeferred), |
2421 end(assembler); | 2500 return_undefined(&assembler), end(&assembler); |
2422 | 2501 |
2423 Node* object = assembler->Parameter(0); | 2502 Node* object = assembler.Parameter(0); |
2424 Node* key = assembler->Parameter(1); | 2503 Node* key = assembler.Parameter(1); |
2425 Node* context = assembler->Parameter(2); | 2504 Node* context = assembler.Parameter(2); |
2426 Variable var_result(assembler, MachineRepresentation::kTagged); | 2505 Variable var_result(&assembler, MachineRepresentation::kTagged); |
2427 | 2506 |
2428 CodeStubAssembler::LookupInHolder lookup_property_in_holder = | 2507 CodeStubAssembler::LookupInHolder lookup_property_in_holder = |
2429 [assembler, context, &var_result, &end]( | 2508 [&assembler, context, &var_result, &end]( |
2430 Node* receiver, Node* holder, Node* holder_map, | 2509 Node* receiver, Node* holder, Node* holder_map, |
2431 Node* holder_instance_type, Node* unique_name, Label* next_holder, | 2510 Node* holder_instance_type, Node* unique_name, Label* next_holder, |
2432 Label* if_bailout) { | 2511 Label* if_bailout) { |
2433 Variable var_value(assembler, MachineRepresentation::kTagged); | 2512 Variable var_value(&assembler, MachineRepresentation::kTagged); |
2434 Label if_found(assembler); | 2513 Label if_found(&assembler); |
2435 assembler->TryGetOwnProperty( | 2514 assembler.TryGetOwnProperty( |
2436 context, receiver, holder, holder_map, holder_instance_type, | 2515 context, receiver, holder, holder_map, holder_instance_type, |
2437 unique_name, &if_found, &var_value, next_holder, if_bailout); | 2516 unique_name, &if_found, &var_value, next_holder, if_bailout); |
2438 assembler->Bind(&if_found); | 2517 assembler.Bind(&if_found); |
2439 { | 2518 { |
2440 var_result.Bind(var_value.value()); | 2519 var_result.Bind(var_value.value()); |
2441 assembler->Goto(&end); | 2520 assembler.Goto(&end); |
2442 } | 2521 } |
2443 }; | 2522 }; |
2444 | 2523 |
2445 CodeStubAssembler::LookupInHolder lookup_element_in_holder = | 2524 CodeStubAssembler::LookupInHolder lookup_element_in_holder = |
2446 [assembler, context, &var_result, &end]( | 2525 [&assembler, context, &var_result, &end]( |
2447 Node* receiver, Node* holder, Node* holder_map, | 2526 Node* receiver, Node* holder, Node* holder_map, |
2448 Node* holder_instance_type, Node* index, Label* next_holder, | 2527 Node* holder_instance_type, Node* index, Label* next_holder, |
2449 Label* if_bailout) { | 2528 Label* if_bailout) { |
2450 // Not supported yet. | 2529 // Not supported yet. |
2451 assembler->Use(next_holder); | 2530 assembler.Use(next_holder); |
2452 assembler->Goto(if_bailout); | 2531 assembler.Goto(if_bailout); |
2453 }; | 2532 }; |
2454 | 2533 |
2455 assembler->TryPrototypeChainLookup(object, key, lookup_property_in_holder, | 2534 assembler.TryPrototypeChainLookup(object, key, lookup_property_in_holder, |
2456 lookup_element_in_holder, | 2535 lookup_element_in_holder, &return_undefined, |
2457 &return_undefined, &call_runtime); | 2536 &call_runtime); |
2458 | 2537 |
2459 assembler->Bind(&return_undefined); | 2538 assembler.Bind(&return_undefined); |
2460 { | 2539 { |
2461 var_result.Bind(assembler->UndefinedConstant()); | 2540 var_result.Bind(assembler.UndefinedConstant()); |
2462 assembler->Goto(&end); | 2541 assembler.Goto(&end); |
2463 } | 2542 } |
2464 | 2543 |
2465 assembler->Bind(&call_runtime); | 2544 assembler.Bind(&call_runtime); |
2466 { | 2545 { |
2467 var_result.Bind( | 2546 var_result.Bind( |
2468 assembler->CallRuntime(Runtime::kGetProperty, context, object, key)); | 2547 assembler.CallRuntime(Runtime::kGetProperty, context, object, key)); |
2469 assembler->Goto(&end); | 2548 assembler.Goto(&end); |
2470 } | 2549 } |
2471 | 2550 |
2472 assembler->Bind(&end); | 2551 assembler.Bind(&end); |
2473 assembler->Return(var_result.value()); | 2552 assembler.Return(var_result.value()); |
2474 } | 2553 } |
2475 | 2554 |
2476 // static | 2555 // static |
2477 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler, | 2556 compiler::Node* FastNewClosureStub::Generate(CodeStubAssembler* assembler, |
2478 compiler::Node* shared_info, | 2557 compiler::Node* shared_info, |
2479 compiler::Node* context) { | 2558 compiler::Node* context) { |
2480 typedef compiler::Node Node; | 2559 typedef compiler::Node Node; |
2481 typedef compiler::CodeAssembler::Label Label; | 2560 typedef compiler::CodeAssembler::Label Label; |
2482 typedef compiler::CodeAssembler::Variable Variable; | 2561 typedef compiler::CodeAssembler::Variable Variable; |
2483 | 2562 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2617 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); | 2696 assembler->IntPtrConstant(Code::kHeaderSize - kHeapObjectTag)); |
2618 assembler->StoreObjectFieldNoWriteBarrier( | 2697 assembler->StoreObjectFieldNoWriteBarrier( |
2619 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry); | 2698 result, JSFunction::kCodeEntryOffset, lazy_builtin_entry); |
2620 assembler->StoreObjectFieldNoWriteBarrier(result, | 2699 assembler->StoreObjectFieldNoWriteBarrier(result, |
2621 JSFunction::kNextFunctionLinkOffset, | 2700 JSFunction::kNextFunctionLinkOffset, |
2622 assembler->UndefinedConstant()); | 2701 assembler->UndefinedConstant()); |
2623 | 2702 |
2624 return result; | 2703 return result; |
2625 } | 2704 } |
2626 | 2705 |
2627 void FastNewClosureStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 2706 void FastNewClosureStub::GenerateAssembly( |
2628 assembler->Return( | 2707 compiler::CodeAssemblerState* state) const { |
2629 Generate(assembler, assembler->Parameter(0), assembler->Parameter(1))); | 2708 CodeStubAssembler assembler(state); |
2709 assembler.Return( | |
2710 Generate(&assembler, assembler.Parameter(0), assembler.Parameter(1))); | |
2630 } | 2711 } |
2631 | 2712 |
2632 // static | 2713 // static |
2633 compiler::Node* FastNewFunctionContextStub::Generate( | 2714 compiler::Node* FastNewFunctionContextStub::Generate( |
2634 CodeStubAssembler* assembler, compiler::Node* function, | 2715 CodeStubAssembler* assembler, compiler::Node* function, |
2635 compiler::Node* slots, compiler::Node* context) { | 2716 compiler::Node* slots, compiler::Node* context) { |
2636 typedef compiler::Node Node; | 2717 typedef compiler::Node Node; |
2637 | 2718 |
2638 Node* min_context_slots = | 2719 Node* min_context_slots = |
2639 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); | 2720 assembler->Int32Constant(Context::MIN_CONTEXT_SLOTS); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2676 function_context, FAST_ELEMENTS, min_context_slots, length, | 2757 function_context, FAST_ELEMENTS, min_context_slots, length, |
2677 [undefined](CodeStubAssembler* assembler, Node* context, Node* offset) { | 2758 [undefined](CodeStubAssembler* assembler, Node* context, Node* offset) { |
2678 assembler->StoreNoWriteBarrier(MachineType::PointerRepresentation(), | 2759 assembler->StoreNoWriteBarrier(MachineType::PointerRepresentation(), |
2679 context, offset, undefined); | 2760 context, offset, undefined); |
2680 }); | 2761 }); |
2681 | 2762 |
2682 return function_context; | 2763 return function_context; |
2683 } | 2764 } |
2684 | 2765 |
2685 void FastNewFunctionContextStub::GenerateAssembly( | 2766 void FastNewFunctionContextStub::GenerateAssembly( |
2686 CodeStubAssembler* assembler) const { | 2767 compiler::CodeAssemblerState* state) const { |
2687 typedef compiler::Node Node; | 2768 typedef compiler::Node Node; |
2688 Node* function = assembler->Parameter(Descriptor::kFunction); | 2769 CodeStubAssembler assembler(state); |
2689 Node* slots = assembler->Parameter(FastNewFunctionContextDescriptor::kSlots); | 2770 Node* function = assembler.Parameter(Descriptor::kFunction); |
2690 Node* context = assembler->Parameter(Descriptor::kContext); | 2771 Node* slots = assembler.Parameter(FastNewFunctionContextDescriptor::kSlots); |
2772 Node* context = assembler.Parameter(Descriptor::kContext); | |
2691 | 2773 |
2692 assembler->Return(Generate(assembler, function, slots, context)); | 2774 assembler.Return(Generate(&assembler, function, slots, context)); |
2693 } | 2775 } |
2694 | 2776 |
2695 // static | 2777 // static |
2696 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, | 2778 compiler::Node* FastCloneRegExpStub::Generate(CodeStubAssembler* assembler, |
2697 compiler::Node* closure, | 2779 compiler::Node* closure, |
2698 compiler::Node* literal_index, | 2780 compiler::Node* literal_index, |
2699 compiler::Node* pattern, | 2781 compiler::Node* pattern, |
2700 compiler::Node* flags, | 2782 compiler::Node* flags, |
2701 compiler::Node* context) { | 2783 compiler::Node* context) { |
2702 typedef CodeStubAssembler::Label Label; | 2784 typedef CodeStubAssembler::Label Label; |
(...skipping 27 matching lines...) Expand all Loading... | |
2730 { | 2812 { |
2731 result.Bind(assembler->CallRuntime(Runtime::kCreateRegExpLiteral, context, | 2813 result.Bind(assembler->CallRuntime(Runtime::kCreateRegExpLiteral, context, |
2732 closure, literal_index, pattern, flags)); | 2814 closure, literal_index, pattern, flags)); |
2733 assembler->Goto(&end); | 2815 assembler->Goto(&end); |
2734 } | 2816 } |
2735 | 2817 |
2736 assembler->Bind(&end); | 2818 assembler->Bind(&end); |
2737 return result.value(); | 2819 return result.value(); |
2738 } | 2820 } |
2739 | 2821 |
2740 void FastCloneRegExpStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 2822 void FastCloneRegExpStub::GenerateAssembly( |
2823 compiler::CodeAssemblerState* state) const { | |
2741 typedef compiler::Node Node; | 2824 typedef compiler::Node Node; |
2742 Node* closure = assembler->Parameter(Descriptor::kClosure); | 2825 CodeStubAssembler assembler(state); |
2743 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); | 2826 Node* closure = assembler.Parameter(Descriptor::kClosure); |
2744 Node* pattern = assembler->Parameter(Descriptor::kPattern); | 2827 Node* literal_index = assembler.Parameter(Descriptor::kLiteralIndex); |
2745 Node* flags = assembler->Parameter(Descriptor::kFlags); | 2828 Node* pattern = assembler.Parameter(Descriptor::kPattern); |
2746 Node* context = assembler->Parameter(Descriptor::kContext); | 2829 Node* flags = assembler.Parameter(Descriptor::kFlags); |
2830 Node* context = assembler.Parameter(Descriptor::kContext); | |
2747 | 2831 |
2748 assembler->Return( | 2832 assembler.Return( |
2749 Generate(assembler, closure, literal_index, pattern, flags, context)); | 2833 Generate(&assembler, closure, literal_index, pattern, flags, context)); |
2750 } | 2834 } |
2751 | 2835 |
2752 namespace { | 2836 namespace { |
2753 | 2837 |
2754 compiler::Node* NonEmptyShallowClone(CodeStubAssembler* assembler, | 2838 compiler::Node* NonEmptyShallowClone(CodeStubAssembler* assembler, |
2755 compiler::Node* boilerplate, | 2839 compiler::Node* boilerplate, |
2756 compiler::Node* boilerplate_map, | 2840 compiler::Node* boilerplate_map, |
2757 compiler::Node* boilerplate_elements, | 2841 compiler::Node* boilerplate_elements, |
2758 compiler::Node* allocation_site, | 2842 compiler::Node* allocation_site, |
2759 compiler::Node* capacity, | 2843 compiler::Node* capacity, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2904 elements.value()); | 2988 elements.value()); |
2905 result.Bind(array); | 2989 result.Bind(array); |
2906 assembler->Goto(&return_result); | 2990 assembler->Goto(&return_result); |
2907 } | 2991 } |
2908 | 2992 |
2909 assembler->Bind(&return_result); | 2993 assembler->Bind(&return_result); |
2910 return result.value(); | 2994 return result.value(); |
2911 } | 2995 } |
2912 | 2996 |
2913 void FastCloneShallowArrayStub::GenerateAssembly( | 2997 void FastCloneShallowArrayStub::GenerateAssembly( |
2914 CodeStubAssembler* assembler) const { | 2998 compiler::CodeAssemblerState* state) const { |
2915 typedef compiler::Node Node; | 2999 typedef compiler::Node Node; |
2916 typedef CodeStubAssembler::Label Label; | 3000 typedef CodeStubAssembler::Label Label; |
2917 Node* closure = assembler->Parameter(Descriptor::kClosure); | 3001 CodeStubAssembler assembler(state); |
2918 Node* literal_index = assembler->Parameter(Descriptor::kLiteralIndex); | |
2919 Node* constant_elements = assembler->Parameter(Descriptor::kConstantElements); | |
2920 Node* context = assembler->Parameter(Descriptor::kContext); | |
2921 Label call_runtime(assembler, Label::kDeferred); | |
2922 assembler->Return(Generate(assembler, closure, literal_index, context, | |
2923 &call_runtime, allocation_site_mode())); | |
2924 | 3002 |
2925 assembler->Bind(&call_runtime); | 3003 Node* closure = assembler.Parameter(Descriptor::kClosure); |
3004 Node* literal_index = assembler.Parameter(Descriptor::kLiteralIndex); | |
3005 Node* constant_elements = assembler.Parameter(Descriptor::kConstantElements); | |
3006 Node* context = assembler.Parameter(Descriptor::kContext); | |
3007 Label call_runtime(&assembler, Label::kDeferred); | |
3008 assembler.Return(Generate(&assembler, closure, literal_index, context, | |
3009 &call_runtime, allocation_site_mode())); | |
3010 | |
3011 assembler.Bind(&call_runtime); | |
2926 { | 3012 { |
2927 assembler->Comment("call runtime"); | 3013 assembler.Comment("call runtime"); |
2928 Node* flags = assembler->SmiConstant( | 3014 Node* flags = assembler.SmiConstant( |
2929 Smi::FromInt(ArrayLiteral::kShallowElements | | 3015 Smi::FromInt(ArrayLiteral::kShallowElements | |
2930 (allocation_site_mode() == TRACK_ALLOCATION_SITE | 3016 (allocation_site_mode() == TRACK_ALLOCATION_SITE |
2931 ? 0 | 3017 ? 0 |
2932 : ArrayLiteral::kDisableMementos))); | 3018 : ArrayLiteral::kDisableMementos))); |
2933 assembler->Return(assembler->CallRuntime(Runtime::kCreateArrayLiteral, | 3019 assembler.Return(assembler.CallRuntime(Runtime::kCreateArrayLiteral, |
2934 context, closure, literal_index, | 3020 context, closure, literal_index, |
2935 constant_elements, flags)); | 3021 constant_elements, flags)); |
2936 } | 3022 } |
2937 } | 3023 } |
2938 | 3024 |
2939 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { | 3025 void CreateAllocationSiteStub::GenerateAheadOfTime(Isolate* isolate) { |
2940 CreateAllocationSiteStub stub(isolate); | 3026 CreateAllocationSiteStub stub(isolate); |
2941 stub.GetCode(); | 3027 stub.GetCode(); |
2942 } | 3028 } |
2943 | 3029 |
2944 | 3030 |
2945 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { | 3031 void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) { |
2946 CreateWeakCellStub stub(isolate); | 3032 CreateWeakCellStub stub(isolate); |
2947 stub.GetCode(); | 3033 stub.GetCode(); |
2948 } | 3034 } |
2949 | 3035 |
2950 | 3036 |
2951 void StoreElementStub::Generate(MacroAssembler* masm) { | 3037 void StoreElementStub::Generate(MacroAssembler* masm) { |
2952 DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind()); | 3038 DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind()); |
2953 KeyedStoreIC::GenerateSlow(masm); | 3039 KeyedStoreIC::GenerateSlow(masm); |
2954 } | 3040 } |
2955 | 3041 |
2956 void StoreFastElementStub::GenerateAssembly( | 3042 void StoreFastElementStub::GenerateAssembly( |
2957 CodeStubAssembler* assembler) const { | 3043 compiler::CodeAssemblerState* state) const { |
2958 typedef CodeStubAssembler::Label Label; | 3044 typedef CodeStubAssembler::Label Label; |
2959 typedef compiler::Node Node; | 3045 typedef compiler::Node Node; |
3046 CodeStubAssembler assembler(state); | |
2960 | 3047 |
2961 assembler->Comment( | 3048 assembler.Comment( |
2962 "StoreFastElementStub: js_array=%d, elements_kind=%s, store_mode=%d", | 3049 "StoreFastElementStub: js_array=%d, elements_kind=%s, store_mode=%d", |
2963 is_js_array(), ElementsKindToString(elements_kind()), store_mode()); | 3050 is_js_array(), ElementsKindToString(elements_kind()), store_mode()); |
2964 | 3051 |
2965 Node* receiver = assembler->Parameter(Descriptor::kReceiver); | 3052 Node* receiver = assembler.Parameter(Descriptor::kReceiver); |
2966 Node* key = assembler->Parameter(Descriptor::kName); | 3053 Node* key = assembler.Parameter(Descriptor::kName); |
2967 Node* value = assembler->Parameter(Descriptor::kValue); | 3054 Node* value = assembler.Parameter(Descriptor::kValue); |
2968 Node* slot = assembler->Parameter(Descriptor::kSlot); | 3055 Node* slot = assembler.Parameter(Descriptor::kSlot); |
2969 Node* vector = assembler->Parameter(Descriptor::kVector); | 3056 Node* vector = assembler.Parameter(Descriptor::kVector); |
2970 Node* context = assembler->Parameter(Descriptor::kContext); | 3057 Node* context = assembler.Parameter(Descriptor::kContext); |
2971 | 3058 |
2972 Label miss(assembler); | 3059 Label miss(&assembler); |
2973 | 3060 |
2974 assembler->EmitElementStore(receiver, key, value, is_js_array(), | 3061 assembler.EmitElementStore(receiver, key, value, is_js_array(), |
2975 elements_kind(), store_mode(), &miss); | 3062 elements_kind(), store_mode(), &miss); |
2976 assembler->Return(value); | 3063 assembler.Return(value); |
2977 | 3064 |
2978 assembler->Bind(&miss); | 3065 assembler.Bind(&miss); |
2979 { | 3066 { |
2980 assembler->Comment("Miss"); | 3067 assembler.Comment("Miss"); |
2981 assembler->TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, | 3068 assembler.TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, |
2982 slot, vector, receiver, key); | 3069 vector, receiver, key); |
2983 } | 3070 } |
2984 } | 3071 } |
2985 | 3072 |
2986 // static | 3073 // static |
2987 void StoreFastElementStub::GenerateAheadOfTime(Isolate* isolate) { | 3074 void StoreFastElementStub::GenerateAheadOfTime(Isolate* isolate) { |
2988 if (FLAG_minimal) return; | 3075 if (FLAG_minimal) return; |
2989 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, STANDARD_STORE) | 3076 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, STANDARD_STORE) |
2990 .GetCode(); | 3077 .GetCode(); |
2991 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, | 3078 StoreFastElementStub(isolate, false, FAST_HOLEY_ELEMENTS, |
2992 STORE_AND_GROW_NO_TRANSITION).GetCode(); | 3079 STORE_AND_GROW_NO_TRANSITION).GetCode(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3056 | 3143 |
3057 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, | 3144 void ProfileEntryHookStub::EntryHookTrampoline(intptr_t function, |
3058 intptr_t stack_pointer, | 3145 intptr_t stack_pointer, |
3059 Isolate* isolate) { | 3146 Isolate* isolate) { |
3060 FunctionEntryHook entry_hook = isolate->function_entry_hook(); | 3147 FunctionEntryHook entry_hook = isolate->function_entry_hook(); |
3061 DCHECK(entry_hook != NULL); | 3148 DCHECK(entry_hook != NULL); |
3062 entry_hook(function, stack_pointer); | 3149 entry_hook(function, stack_pointer); |
3063 } | 3150 } |
3064 | 3151 |
3065 void CreateAllocationSiteStub::GenerateAssembly( | 3152 void CreateAllocationSiteStub::GenerateAssembly( |
3066 CodeStubAssembler* assembler) const { | 3153 compiler::CodeAssemblerState* state) const { |
3067 assembler->Return(assembler->CreateAllocationSiteInFeedbackVector( | 3154 CodeStubAssembler assembler(state); |
3068 assembler->Parameter(Descriptor::kVector), | 3155 assembler.Return(assembler.CreateAllocationSiteInFeedbackVector( |
3069 assembler->Parameter(Descriptor::kSlot))); | 3156 assembler.Parameter(Descriptor::kVector), |
3157 assembler.Parameter(Descriptor::kSlot))); | |
3070 } | 3158 } |
3071 | 3159 |
3072 void CreateWeakCellStub::GenerateAssembly(CodeStubAssembler* assembler) const { | 3160 void CreateWeakCellStub::GenerateAssembly( |
3073 assembler->Return(assembler->CreateWeakCellInFeedbackVector( | 3161 compiler::CodeAssemblerState* state) const { |
3074 assembler->Parameter(Descriptor::kVector), | 3162 CodeStubAssembler assembler(state); |
3075 assembler->Parameter(Descriptor::kSlot), | 3163 assembler.Return(assembler.CreateWeakCellInFeedbackVector( |
3076 assembler->Parameter(Descriptor::kValue))); | 3164 assembler.Parameter(Descriptor::kVector), |
3165 assembler.Parameter(Descriptor::kSlot), | |
3166 assembler.Parameter(Descriptor::kValue))); | |
3077 } | 3167 } |
3078 | 3168 |
3079 void ArrayNoArgumentConstructorStub::GenerateAssembly( | 3169 void ArrayNoArgumentConstructorStub::GenerateAssembly( |
3080 CodeStubAssembler* assembler) const { | 3170 compiler::CodeAssemblerState* state) const { |
3081 typedef compiler::Node Node; | 3171 typedef compiler::Node Node; |
3082 Node* native_context = assembler->LoadObjectField( | 3172 CodeStubAssembler assembler(state); |
3083 assembler->Parameter(Descriptor::kFunction), JSFunction::kContextOffset); | 3173 Node* native_context = assembler.LoadObjectField( |
3174 assembler.Parameter(Descriptor::kFunction), JSFunction::kContextOffset); | |
3084 bool track_allocation_site = | 3175 bool track_allocation_site = |
3085 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && | 3176 AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE && |
3086 override_mode() != DISABLE_ALLOCATION_SITES; | 3177 override_mode() != DISABLE_ALLOCATION_SITES; |
3087 Node* allocation_site = | 3178 Node* allocation_site = track_allocation_site |
3088 track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite) | 3179 ? assembler.Parameter(Descriptor::kAllocationSite) |
3089 : nullptr; | 3180 : nullptr; |
3090 Node* array_map = | 3181 Node* array_map = |
3091 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); | 3182 assembler.LoadJSArrayElementsMap(elements_kind(), native_context); |
3092 Node* array = assembler->AllocateJSArray( | 3183 Node* array = assembler.AllocateJSArray( |
3093 elements_kind(), array_map, | 3184 elements_kind(), array_map, |
3094 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements), | 3185 assembler.IntPtrConstant(JSArray::kPreallocatedArrayElements), |
3095 assembler->SmiConstant(Smi::kZero), allocation_site); | 3186 assembler.SmiConstant(Smi::kZero), allocation_site); |
3096 assembler->Return(array); | 3187 assembler.Return(array); |
3097 } | 3188 } |
3098 | 3189 |
3099 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( | 3190 void InternalArrayNoArgumentConstructorStub::GenerateAssembly( |
3100 CodeStubAssembler* assembler) const { | 3191 compiler::CodeAssemblerState* state) const { |
3101 typedef compiler::Node Node; | 3192 typedef compiler::Node Node; |
3193 CodeStubAssembler assembler(state); | |
3102 Node* array_map = | 3194 Node* array_map = |
3103 assembler->LoadObjectField(assembler->Parameter(Descriptor::kFunction), | 3195 assembler.LoadObjectField(assembler.Parameter(Descriptor::kFunction), |
3104 JSFunction::kPrototypeOrInitialMapOffset); | 3196 JSFunction::kPrototypeOrInitialMapOffset); |
3105 Node* array = assembler->AllocateJSArray( | 3197 Node* array = assembler.AllocateJSArray( |
3106 elements_kind(), array_map, | 3198 elements_kind(), array_map, |
3107 assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements), | 3199 assembler.IntPtrConstant(JSArray::kPreallocatedArrayElements), |
3108 assembler->SmiConstant(Smi::kZero), nullptr); | 3200 assembler.SmiConstant(Smi::kZero), nullptr); |
3109 assembler->Return(array); | 3201 assembler.Return(array); |
3110 } | 3202 } |
3111 | 3203 |
3112 namespace { | 3204 namespace { |
3113 | 3205 |
3114 template <typename Descriptor> | 3206 template <typename Descriptor> |
3115 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, | 3207 void SingleArgumentConstructorCommon(CodeStubAssembler* assembler, |
3116 ElementsKind elements_kind, | 3208 ElementsKind elements_kind, |
3117 compiler::Node* array_map, | 3209 compiler::Node* array_map, |
3118 compiler::Node* allocation_site, | 3210 compiler::Node* allocation_site, |
3119 AllocationSiteMode mode) { | 3211 AllocationSiteMode mode) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3169 Node* function = assembler->Parameter(Descriptor::kFunction); | 3261 Node* function = assembler->Parameter(Descriptor::kFunction); |
3170 Node* array_size = assembler->Parameter(Descriptor::kArraySizeSmiParameter); | 3262 Node* array_size = assembler->Parameter(Descriptor::kArraySizeSmiParameter); |
3171 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite); | 3263 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite); |
3172 assembler->TailCallRuntime(Runtime::kNewArray, context, function, | 3264 assembler->TailCallRuntime(Runtime::kNewArray, context, function, |
3173 array_size, function, allocation_site); | 3265 array_size, function, allocation_site); |
3174 } | 3266 } |
3175 } | 3267 } |
3176 } // namespace | 3268 } // namespace |
3177 | 3269 |
3178 void ArraySingleArgumentConstructorStub::GenerateAssembly( | 3270 void ArraySingleArgumentConstructorStub::GenerateAssembly( |
3179 CodeStubAssembler* assembler) const { | 3271 compiler::CodeAssemblerState* state) const { |
3180 typedef compiler::Node Node; | 3272 typedef compiler::Node Node; |
3181 Node* function = assembler->Parameter(Descriptor::kFunction); | 3273 CodeStubAssembler assembler(state); |
3274 Node* function = assembler.Parameter(Descriptor::kFunction); | |
3182 Node* native_context = | 3275 Node* native_context = |
3183 assembler->LoadObjectField(function, JSFunction::kContextOffset); | 3276 assembler.LoadObjectField(function, JSFunction::kContextOffset); |
3184 Node* array_map = | 3277 Node* array_map = |
3185 assembler->LoadJSArrayElementsMap(elements_kind(), native_context); | 3278 assembler.LoadJSArrayElementsMap(elements_kind(), native_context); |
3186 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES | 3279 AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES |
3187 ? DONT_TRACK_ALLOCATION_SITE | 3280 ? DONT_TRACK_ALLOCATION_SITE |
3188 : AllocationSite::GetMode(elements_kind()); | 3281 : AllocationSite::GetMode(elements_kind()); |
3189 Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite); | 3282 Node* allocation_site = assembler.Parameter(Descriptor::kAllocationSite); |
3190 SingleArgumentConstructorCommon<Descriptor>(assembler, elements_kind(), | 3283 SingleArgumentConstructorCommon<Descriptor>(&assembler, elements_kind(), |
3191 array_map, allocation_site, mode); | 3284 array_map, allocation_site, mode); |
3192 } | 3285 } |
3193 | 3286 |
3194 void InternalArraySingleArgumentConstructorStub::GenerateAssembly( | 3287 void InternalArraySingleArgumentConstructorStub::GenerateAssembly( |
3195 CodeStubAssembler* assembler) const { | 3288 compiler::CodeAssemblerState* state) const { |
3196 typedef compiler::Node Node; | 3289 typedef compiler::Node Node; |
3197 Node* function = assembler->Parameter(Descriptor::kFunction); | 3290 CodeStubAssembler assembler(state); |
3198 Node* array_map = assembler->LoadObjectField( | 3291 Node* function = assembler.Parameter(Descriptor::kFunction); |
3292 Node* array_map = assembler.LoadObjectField( | |
3199 function, JSFunction::kPrototypeOrInitialMapOffset); | 3293 function, JSFunction::kPrototypeOrInitialMapOffset); |
3200 SingleArgumentConstructorCommon<Descriptor>( | 3294 SingleArgumentConstructorCommon<Descriptor>( |
3201 assembler, elements_kind(), array_map, assembler->UndefinedConstant(), | 3295 &assembler, elements_kind(), array_map, assembler.UndefinedConstant(), |
3202 DONT_TRACK_ALLOCATION_SITE); | 3296 DONT_TRACK_ALLOCATION_SITE); |
3203 } | 3297 } |
3204 | 3298 |
3205 void GrowArrayElementsStub::GenerateAssembly( | 3299 void GrowArrayElementsStub::GenerateAssembly( |
3206 CodeStubAssembler* assembler) const { | 3300 compiler::CodeAssemblerState* state) const { |
3207 typedef compiler::Node Node; | 3301 typedef compiler::Node Node; |
3208 CodeStubAssembler::Label runtime(assembler, | 3302 CodeStubAssembler assembler(state); |
3303 CodeStubAssembler::Label runtime(&assembler, | |
3209 CodeStubAssembler::Label::kDeferred); | 3304 CodeStubAssembler::Label::kDeferred); |
3210 | 3305 |
3211 Node* object = assembler->Parameter(Descriptor::kObject); | 3306 Node* object = assembler.Parameter(Descriptor::kObject); |
3212 Node* key = assembler->Parameter(Descriptor::kKey); | 3307 Node* key = assembler.Parameter(Descriptor::kKey); |
3213 Node* context = assembler->Parameter(Descriptor::kContext); | 3308 Node* context = assembler.Parameter(Descriptor::kContext); |
3214 ElementsKind kind = elements_kind(); | 3309 ElementsKind kind = elements_kind(); |
3215 | 3310 |
3216 Node* elements = assembler->LoadElements(object); | 3311 Node* elements = assembler.LoadElements(object); |
3217 Node* new_elements = | 3312 Node* new_elements = |
3218 assembler->TryGrowElementsCapacity(object, elements, kind, key, &runtime); | 3313 assembler.TryGrowElementsCapacity(object, elements, kind, key, &runtime); |
3219 assembler->Return(new_elements); | 3314 assembler.Return(new_elements); |
3220 | 3315 |
3221 assembler->Bind(&runtime); | 3316 assembler.Bind(&runtime); |
3222 // TODO(danno): Make this a tail call when the stub is only used from TurboFan | 3317 // TODO(danno): Make this a tail call when the stub is only used from TurboFan |
3223 // code. This musn't be a tail call for now, since the caller site in lithium | 3318 // code. This musn't be a tail call for now, since the caller site in lithium |
3224 // creates a safepoint. This safepoint musn't have a different number of | 3319 // creates a safepoint. This safepoint musn't have a different number of |
3225 // arguments on the stack in the case that a GC happens from the slow-case | 3320 // arguments on the stack in the case that a GC happens from the slow-case |
3226 // allocation path (zero, since all the stubs inputs are in registers) and | 3321 // allocation path (zero, since all the stubs inputs are in registers) and |
3227 // when the call happens (it would be two in the tail call case due to the | 3322 // when the call happens (it would be two in the tail call case due to the |
3228 // tail call pushing the arguments on the stack for the runtime call). By not | 3323 // tail call pushing the arguments on the stack for the runtime call). By not |
3229 // tail-calling, the runtime call case also has zero arguments on the stack | 3324 // tail-calling, the runtime call case also has zero arguments on the stack |
3230 // for the stub frame. | 3325 // for the stub frame. |
3231 assembler->Return(assembler->CallRuntime(Runtime::kGrowArrayElements, context, | 3326 assembler.Return( |
3232 object, key)); | 3327 assembler.CallRuntime(Runtime::kGrowArrayElements, context, object, key)); |
3233 } | 3328 } |
3234 | 3329 |
3235 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) | 3330 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) |
3236 : PlatformCodeStub(isolate) {} | 3331 : PlatformCodeStub(isolate) {} |
3237 | 3332 |
3238 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) | 3333 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) |
3239 : PlatformCodeStub(isolate) {} | 3334 : PlatformCodeStub(isolate) {} |
3240 | 3335 |
3241 } // namespace internal | 3336 } // namespace internal |
3242 } // namespace v8 | 3337 } // namespace v8 |
OLD | NEW |