OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 current_block()->Finish(hreturn_instruction); | 210 current_block()->Finish(hreturn_instruction); |
211 set_current_block(NULL); | 211 set_current_block(NULL); |
212 } | 212 } |
213 return true; | 213 return true; |
214 } | 214 } |
215 | 215 |
216 | 216 |
217 template <class Stub> | 217 template <class Stub> |
218 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { | 218 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { |
219 public: | 219 public: |
220 explicit CodeStubGraphBuilder(Stub* stub) | 220 explicit CodeStubGraphBuilder(Isolate* isolate, Stub* stub) |
221 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {} | 221 : CodeStubGraphBuilderBase(isolate, stub) {} |
222 | 222 |
223 protected: | 223 protected: |
224 virtual HValue* BuildCodeStub() { | 224 virtual HValue* BuildCodeStub() { |
225 if (casted_stub()->IsUninitialized()) { | 225 if (casted_stub()->IsUninitialized()) { |
226 return BuildCodeUninitializedStub(); | 226 return BuildCodeUninitializedStub(); |
227 } else { | 227 } else { |
228 return BuildCodeInitializedStub(); | 228 return BuildCodeInitializedStub(); |
229 } | 229 } |
230 } | 230 } |
231 | 231 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 GetExtraICState(), | 278 GetExtraICState(), |
279 GetStubType(), | 279 GetStubType(), |
280 GetStubFlags()); | 280 GetStubFlags()); |
281 Handle<Code> new_object = factory->NewCode( | 281 Handle<Code> new_object = factory->NewCode( |
282 desc, flags, masm.CodeObject(), NeedsImmovableCode()); | 282 desc, flags, masm.CodeObject(), NeedsImmovableCode()); |
283 return new_object; | 283 return new_object; |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 template <class Stub> | 287 template <class Stub> |
288 static Handle<Code> DoGenerateCode(Stub* stub) { | 288 static Handle<Code> DoGenerateCode(Isolate* isolate, Stub* stub) { |
289 Isolate* isolate = Isolate::Current(); | |
290 CodeStub::Major major_key = | 289 CodeStub::Major major_key = |
291 static_cast<HydrogenCodeStub*>(stub)->MajorKey(); | 290 static_cast<HydrogenCodeStub*>(stub)->MajorKey(); |
292 CodeStubInterfaceDescriptor* descriptor = | 291 CodeStubInterfaceDescriptor* descriptor = |
293 isolate->code_stub_interface_descriptor(major_key); | 292 isolate->code_stub_interface_descriptor(major_key); |
294 if (descriptor->register_param_count_ < 0) { | 293 if (descriptor->register_param_count_ < 0) { |
295 stub->InitializeInterfaceDescriptor(isolate, descriptor); | 294 stub->InitializeInterfaceDescriptor(isolate, descriptor); |
296 } | 295 } |
297 | 296 |
298 // If we are uninitialized we can use a light-weight stub to enter | 297 // If we are uninitialized we can use a light-weight stub to enter |
299 // the runtime that is significantly faster than using the standard | 298 // the runtime that is significantly faster than using the standard |
300 // stub-failure deopt mechanism. | 299 // stub-failure deopt mechanism. |
301 if (stub->IsUninitialized() && descriptor->has_miss_handler()) { | 300 if (stub->IsUninitialized() && descriptor->has_miss_handler()) { |
302 ASSERT(descriptor->stack_parameter_count_ == NULL); | 301 ASSERT(descriptor->stack_parameter_count_ == NULL); |
303 return stub->GenerateLightweightMissCode(isolate); | 302 return stub->GenerateLightweightMissCode(isolate); |
304 } | 303 } |
305 CodeStubGraphBuilder<Stub> builder(stub); | 304 CodeStubGraphBuilder<Stub> builder(isolate, stub); |
306 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); | 305 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); |
307 return chunk->Codegen(); | 306 return chunk->Codegen(); |
308 } | 307 } |
309 | 308 |
310 | 309 |
311 template <> | 310 template <> |
312 HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() { | 311 HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() { |
313 HValue* value = GetParameter(0); | 312 HValue* value = GetParameter(0); |
314 | 313 |
315 // Check if the parameter is already a SMI or heap number. | 314 // Check if the parameter is already a SMI or heap number. |
(...skipping 11 matching lines...) Expand all Loading... |
327 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); | 326 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); |
328 Add<HPushArgument>(value); | 327 Add<HPushArgument>(value); |
329 Push(Add<HInvokeFunction>(function, 1)); | 328 Push(Add<HInvokeFunction>(function, 1)); |
330 | 329 |
331 if_number.End(); | 330 if_number.End(); |
332 | 331 |
333 return Pop(); | 332 return Pop(); |
334 } | 333 } |
335 | 334 |
336 | 335 |
337 Handle<Code> ToNumberStub::GenerateCode() { | 336 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { |
338 return DoGenerateCode(this); | 337 return DoGenerateCode(isolate, this); |
339 } | 338 } |
340 | 339 |
341 | 340 |
342 template <> | 341 template <> |
343 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { | 342 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
344 Factory* factory = isolate()->factory(); | 343 Factory* factory = isolate()->factory(); |
345 HValue* undefined = graph()->GetConstantUndefined(); | 344 HValue* undefined = graph()->GetConstantUndefined(); |
346 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); | 345 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
347 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); | 346 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); |
348 int length = casted_stub()->length(); | 347 int length = casted_stub()->length(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 length)); | 393 length)); |
395 } | 394 } |
396 | 395 |
397 checker.ElseDeopt("Uninitialized boilerplate literals"); | 396 checker.ElseDeopt("Uninitialized boilerplate literals"); |
398 checker.End(); | 397 checker.End(); |
399 | 398 |
400 return environment()->Pop(); | 399 return environment()->Pop(); |
401 } | 400 } |
402 | 401 |
403 | 402 |
404 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { | 403 Handle<Code> FastCloneShallowArrayStub::GenerateCode(Isolate* isolate) { |
405 return DoGenerateCode(this); | 404 return DoGenerateCode(isolate, this); |
406 } | 405 } |
407 | 406 |
408 | 407 |
409 template <> | 408 template <> |
410 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { | 409 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
411 Zone* zone = this->zone(); | 410 Zone* zone = this->zone(); |
412 HValue* undefined = graph()->GetConstantUndefined(); | 411 HValue* undefined = graph()->GetConstantUndefined(); |
413 | 412 |
414 HInstruction* boilerplate = Add<HLoadKeyed>(GetParameter(0), | 413 HInstruction* boilerplate = Add<HLoadKeyed>(GetParameter(0), |
415 GetParameter(1), | 414 GetParameter(1), |
(...skipping 25 matching lines...) Expand all Loading... |
441 } | 440 } |
442 | 441 |
443 environment()->Push(object); | 442 environment()->Push(object); |
444 checker.ElseDeopt("Uninitialized boilerplate in fast clone"); | 443 checker.ElseDeopt("Uninitialized boilerplate in fast clone"); |
445 checker.End(); | 444 checker.End(); |
446 | 445 |
447 return environment()->Pop(); | 446 return environment()->Pop(); |
448 } | 447 } |
449 | 448 |
450 | 449 |
451 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { | 450 Handle<Code> FastCloneShallowObjectStub::GenerateCode(Isolate* isolate) { |
452 return DoGenerateCode(this); | 451 return DoGenerateCode(isolate, this); |
453 } | 452 } |
454 | 453 |
455 | 454 |
456 template <> | 455 template <> |
457 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 456 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { |
458 HValue* size = Add<HConstant>(AllocationSite::kSize); | 457 HValue* size = Add<HConstant>(AllocationSite::kSize); |
459 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, | 458 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, |
460 JS_OBJECT_TYPE); | 459 JS_OBJECT_TYPE); |
461 | 460 |
462 // Store the map | 461 // Store the map |
(...skipping 24 matching lines...) Expand all Loading... |
487 // TODO(mvstanton): Add a debug_code check to verify the input cell is really | 486 // TODO(mvstanton): Add a debug_code check to verify the input cell is really |
488 // a cell. (perhaps with a new instruction, HAssert). | 487 // a cell. (perhaps with a new instruction, HAssert). |
489 HInstruction* cell = GetParameter(0); | 488 HInstruction* cell = GetParameter(0); |
490 HObjectAccess access = HObjectAccess::ForCellValue(); | 489 HObjectAccess access = HObjectAccess::ForCellValue(); |
491 store = Add<HStoreNamedField>(cell, access, object); | 490 store = Add<HStoreNamedField>(cell, access, object); |
492 store->SkipWriteBarrier(); | 491 store->SkipWriteBarrier(); |
493 return cell; | 492 return cell; |
494 } | 493 } |
495 | 494 |
496 | 495 |
497 Handle<Code> CreateAllocationSiteStub::GenerateCode() { | 496 Handle<Code> CreateAllocationSiteStub::GenerateCode(Isolate* isolate) { |
498 return DoGenerateCode(this); | 497 return DoGenerateCode(isolate, this); |
499 } | 498 } |
500 | 499 |
501 | 500 |
502 template <> | 501 template <> |
503 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { | 502 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { |
504 HInstruction* load = BuildUncheckedMonomorphicElementAccess( | 503 HInstruction* load = BuildUncheckedMonomorphicElementAccess( |
505 GetParameter(0), GetParameter(1), NULL, | 504 GetParameter(0), GetParameter(1), NULL, |
506 casted_stub()->is_js_array(), casted_stub()->elements_kind(), | 505 casted_stub()->is_js_array(), casted_stub()->elements_kind(), |
507 false, NEVER_RETURN_HOLE, STANDARD_STORE); | 506 false, NEVER_RETURN_HOLE, STANDARD_STORE); |
508 return load; | 507 return load; |
509 } | 508 } |
510 | 509 |
511 | 510 |
512 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { | 511 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { |
513 return DoGenerateCode(this); | 512 return DoGenerateCode(isolate, this); |
514 } | 513 } |
515 | 514 |
516 | 515 |
517 template<> | 516 template<> |
518 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { | 517 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { |
519 Representation rep = casted_stub()->representation(); | 518 Representation rep = casted_stub()->representation(); |
520 HObjectAccess access = casted_stub()->is_inobject() ? | 519 HObjectAccess access = casted_stub()->is_inobject() ? |
521 HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) : | 520 HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) : |
522 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); | 521 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); |
523 return AddInstruction(BuildLoadNamedField(GetParameter(0), access)); | 522 return AddInstruction(BuildLoadNamedField(GetParameter(0), access)); |
524 } | 523 } |
525 | 524 |
526 | 525 |
527 Handle<Code> LoadFieldStub::GenerateCode() { | 526 Handle<Code> LoadFieldStub::GenerateCode(Isolate* isolate) { |
528 return DoGenerateCode(this); | 527 return DoGenerateCode(isolate, this); |
529 } | 528 } |
530 | 529 |
531 | 530 |
532 template<> | 531 template<> |
533 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() { | 532 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() { |
534 Representation rep = casted_stub()->representation(); | 533 Representation rep = casted_stub()->representation(); |
535 HObjectAccess access = casted_stub()->is_inobject() ? | 534 HObjectAccess access = casted_stub()->is_inobject() ? |
536 HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) : | 535 HObjectAccess::ForJSObjectOffset(casted_stub()->offset(), rep) : |
537 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); | 536 HObjectAccess::ForBackingStoreOffset(casted_stub()->offset(), rep); |
538 return AddInstruction(BuildLoadNamedField(GetParameter(0), access)); | 537 return AddInstruction(BuildLoadNamedField(GetParameter(0), access)); |
539 } | 538 } |
540 | 539 |
541 | 540 |
542 Handle<Code> KeyedLoadFieldStub::GenerateCode() { | 541 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { |
543 return DoGenerateCode(this); | 542 return DoGenerateCode(isolate, this); |
544 } | 543 } |
545 | 544 |
546 | 545 |
547 template <> | 546 template <> |
548 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { | 547 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { |
549 BuildUncheckedMonomorphicElementAccess( | 548 BuildUncheckedMonomorphicElementAccess( |
550 GetParameter(0), GetParameter(1), GetParameter(2), | 549 GetParameter(0), GetParameter(1), GetParameter(2), |
551 casted_stub()->is_js_array(), casted_stub()->elements_kind(), | 550 casted_stub()->is_js_array(), casted_stub()->elements_kind(), |
552 true, NEVER_RETURN_HOLE, casted_stub()->store_mode()); | 551 true, NEVER_RETURN_HOLE, casted_stub()->store_mode()); |
553 | 552 |
554 return GetParameter(2); | 553 return GetParameter(2); |
555 } | 554 } |
556 | 555 |
557 | 556 |
558 Handle<Code> KeyedStoreFastElementStub::GenerateCode() { | 557 Handle<Code> KeyedStoreFastElementStub::GenerateCode(Isolate* isolate) { |
559 return DoGenerateCode(this); | 558 return DoGenerateCode(isolate, this); |
560 } | 559 } |
561 | 560 |
562 | 561 |
563 template <> | 562 template <> |
564 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { | 563 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { |
565 info()->MarkAsSavesCallerDoubles(); | 564 info()->MarkAsSavesCallerDoubles(); |
566 | 565 |
567 BuildTransitionElementsKind(GetParameter(0), | 566 BuildTransitionElementsKind(GetParameter(0), |
568 GetParameter(1), | 567 GetParameter(1), |
569 casted_stub()->from_kind(), | 568 casted_stub()->from_kind(), |
570 casted_stub()->to_kind(), | 569 casted_stub()->to_kind(), |
571 true); | 570 true); |
572 | 571 |
573 return GetParameter(0); | 572 return GetParameter(0); |
574 } | 573 } |
575 | 574 |
576 | 575 |
577 Handle<Code> TransitionElementsKindStub::GenerateCode() { | 576 Handle<Code> TransitionElementsKindStub::GenerateCode(Isolate* isolate) { |
578 return DoGenerateCode(this); | 577 return DoGenerateCode(isolate, this); |
579 } | 578 } |
580 | 579 |
581 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( | 580 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( |
582 ElementsKind kind, | 581 ElementsKind kind, |
583 ContextCheckMode context_mode, | 582 ContextCheckMode context_mode, |
584 AllocationSiteOverrideMode override_mode, | 583 AllocationSiteOverrideMode override_mode, |
585 ArgumentClass argument_class) { | 584 ArgumentClass argument_class) { |
586 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); | 585 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); |
587 if (context_mode == CONTEXT_CHECK_REQUIRED) { | 586 if (context_mode == CONTEXT_CHECK_REQUIRED) { |
588 HInstruction* array_function = BuildGetArrayFunction(); | 587 HInstruction* array_function = BuildGetArrayFunction(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 | 701 |
703 template <> | 702 template <> |
704 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { | 703 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { |
705 ElementsKind kind = casted_stub()->elements_kind(); | 704 ElementsKind kind = casted_stub()->elements_kind(); |
706 ContextCheckMode context_mode = casted_stub()->context_mode(); | 705 ContextCheckMode context_mode = casted_stub()->context_mode(); |
707 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); | 706 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); |
708 return BuildArrayConstructor(kind, context_mode, override_mode, NONE); | 707 return BuildArrayConstructor(kind, context_mode, override_mode, NONE); |
709 } | 708 } |
710 | 709 |
711 | 710 |
712 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode() { | 711 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode(Isolate* isolate) { |
713 return DoGenerateCode(this); | 712 return DoGenerateCode(isolate, this); |
714 } | 713 } |
715 | 714 |
716 | 715 |
717 template <> | 716 template <> |
718 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>:: | 717 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>:: |
719 BuildCodeStub() { | 718 BuildCodeStub() { |
720 ElementsKind kind = casted_stub()->elements_kind(); | 719 ElementsKind kind = casted_stub()->elements_kind(); |
721 ContextCheckMode context_mode = casted_stub()->context_mode(); | 720 ContextCheckMode context_mode = casted_stub()->context_mode(); |
722 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); | 721 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); |
723 return BuildArrayConstructor(kind, context_mode, override_mode, SINGLE); | 722 return BuildArrayConstructor(kind, context_mode, override_mode, SINGLE); |
724 } | 723 } |
725 | 724 |
726 | 725 |
727 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode() { | 726 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode( |
728 return DoGenerateCode(this); | 727 Isolate* isolate) { |
| 728 return DoGenerateCode(isolate, this); |
729 } | 729 } |
730 | 730 |
731 | 731 |
732 template <> | 732 template <> |
733 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { | 733 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { |
734 ElementsKind kind = casted_stub()->elements_kind(); | 734 ElementsKind kind = casted_stub()->elements_kind(); |
735 ContextCheckMode context_mode = casted_stub()->context_mode(); | 735 ContextCheckMode context_mode = casted_stub()->context_mode(); |
736 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); | 736 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); |
737 return BuildArrayConstructor(kind, context_mode, override_mode, MULTIPLE); | 737 return BuildArrayConstructor(kind, context_mode, override_mode, MULTIPLE); |
738 } | 738 } |
739 | 739 |
740 | 740 |
741 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 741 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode(Isolate* isolate) { |
742 return DoGenerateCode(this); | 742 return DoGenerateCode(isolate, this); |
743 } | 743 } |
744 | 744 |
745 | 745 |
746 template <> | 746 template <> |
747 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>:: | 747 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>:: |
748 BuildCodeStub() { | 748 BuildCodeStub() { |
749 ElementsKind kind = casted_stub()->elements_kind(); | 749 ElementsKind kind = casted_stub()->elements_kind(); |
750 return BuildInternalArrayConstructor(kind, NONE); | 750 return BuildInternalArrayConstructor(kind, NONE); |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 Handle<Code> InternalArrayNoArgumentConstructorStub::GenerateCode() { | 754 Handle<Code> InternalArrayNoArgumentConstructorStub::GenerateCode( |
755 return DoGenerateCode(this); | 755 Isolate* isolate) { |
| 756 return DoGenerateCode(isolate, this); |
756 } | 757 } |
757 | 758 |
758 | 759 |
759 template <> | 760 template <> |
760 HValue* CodeStubGraphBuilder<InternalArraySingleArgumentConstructorStub>:: | 761 HValue* CodeStubGraphBuilder<InternalArraySingleArgumentConstructorStub>:: |
761 BuildCodeStub() { | 762 BuildCodeStub() { |
762 ElementsKind kind = casted_stub()->elements_kind(); | 763 ElementsKind kind = casted_stub()->elements_kind(); |
763 return BuildInternalArrayConstructor(kind, SINGLE); | 764 return BuildInternalArrayConstructor(kind, SINGLE); |
764 } | 765 } |
765 | 766 |
766 | 767 |
767 Handle<Code> InternalArraySingleArgumentConstructorStub::GenerateCode() { | 768 Handle<Code> InternalArraySingleArgumentConstructorStub::GenerateCode( |
768 return DoGenerateCode(this); | 769 Isolate* isolate) { |
| 770 return DoGenerateCode(isolate, this); |
769 } | 771 } |
770 | 772 |
771 | 773 |
772 template <> | 774 template <> |
773 HValue* CodeStubGraphBuilder<InternalArrayNArgumentsConstructorStub>:: | 775 HValue* CodeStubGraphBuilder<InternalArrayNArgumentsConstructorStub>:: |
774 BuildCodeStub() { | 776 BuildCodeStub() { |
775 ElementsKind kind = casted_stub()->elements_kind(); | 777 ElementsKind kind = casted_stub()->elements_kind(); |
776 return BuildInternalArrayConstructor(kind, MULTIPLE); | 778 return BuildInternalArrayConstructor(kind, MULTIPLE); |
777 } | 779 } |
778 | 780 |
779 | 781 |
780 Handle<Code> InternalArrayNArgumentsConstructorStub::GenerateCode() { | 782 Handle<Code> InternalArrayNArgumentsConstructorStub::GenerateCode( |
781 return DoGenerateCode(this); | 783 Isolate* isolate) { |
| 784 return DoGenerateCode(isolate, this); |
782 } | 785 } |
783 | 786 |
784 | 787 |
785 template <> | 788 template <> |
786 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { | 789 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { |
787 Isolate* isolate = graph()->isolate(); | 790 Isolate* isolate = graph()->isolate(); |
788 CompareNilICStub* stub = casted_stub(); | 791 CompareNilICStub* stub = casted_stub(); |
789 HIfContinuation continuation; | 792 HIfContinuation continuation; |
790 Handle<Map> sentinel_map(isolate->heap()->meta_map()); | 793 Handle<Map> sentinel_map(isolate->heap()->meta_map()); |
791 Handle<Type> type = stub->GetType(isolate, sentinel_map); | 794 Handle<Type> type = stub->GetType(isolate, sentinel_map); |
792 BuildCompareNil(GetParameter(0), type, RelocInfo::kNoPosition, &continuation); | 795 BuildCompareNil(GetParameter(0), type, RelocInfo::kNoPosition, &continuation); |
793 IfBuilder if_nil(this, &continuation); | 796 IfBuilder if_nil(this, &continuation); |
794 if_nil.Then(); | 797 if_nil.Then(); |
795 if (continuation.IsFalseReachable()) { | 798 if (continuation.IsFalseReachable()) { |
796 if_nil.Else(); | 799 if_nil.Else(); |
797 if_nil.Return(graph()->GetConstant0()); | 800 if_nil.Return(graph()->GetConstant0()); |
798 } | 801 } |
799 if_nil.End(); | 802 if_nil.End(); |
800 return continuation.IsTrueReachable() | 803 return continuation.IsTrueReachable() |
801 ? graph()->GetConstant1() | 804 ? graph()->GetConstant1() |
802 : graph()->GetConstantUndefined(); | 805 : graph()->GetConstantUndefined(); |
803 } | 806 } |
804 | 807 |
805 | 808 |
806 Handle<Code> CompareNilICStub::GenerateCode() { | 809 Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) { |
807 return DoGenerateCode(this); | 810 return DoGenerateCode(isolate, this); |
808 } | 811 } |
809 | 812 |
810 | 813 |
811 template <> | 814 template <> |
812 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { | 815 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { |
813 ToBooleanStub* stub = casted_stub(); | 816 ToBooleanStub* stub = casted_stub(); |
814 | 817 |
815 IfBuilder if_true(this); | 818 IfBuilder if_true(this); |
816 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); | 819 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); |
817 if_true.Then(); | 820 if_true.Then(); |
818 if_true.Return(graph()->GetConstant1()); | 821 if_true.Return(graph()->GetConstant1()); |
819 if_true.Else(); | 822 if_true.Else(); |
820 if_true.End(); | 823 if_true.End(); |
821 return graph()->GetConstant0(); | 824 return graph()->GetConstant0(); |
822 } | 825 } |
823 | 826 |
824 | 827 |
825 Handle<Code> ToBooleanStub::GenerateCode() { | 828 Handle<Code> ToBooleanStub::GenerateCode(Isolate* isolate) { |
826 return DoGenerateCode(this); | 829 return DoGenerateCode(isolate, this); |
827 } | 830 } |
828 | 831 |
829 | 832 |
830 template <> | 833 template <> |
831 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { | 834 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { |
832 StoreGlobalStub* stub = casted_stub(); | 835 StoreGlobalStub* stub = casted_stub(); |
833 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate()); | 836 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate()); |
834 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); | 837 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); |
835 Handle<PropertyCell> placeholder_cell = | 838 Handle<PropertyCell> placeholder_cell = |
836 isolate()->factory()->NewPropertyCell(placeholer_value); | 839 isolate()->factory()->NewPropertyCell(placeholer_value); |
(...skipping 27 matching lines...) Expand all Loading... |
864 builder.Deopt("Unexpected cell contents in global store"); | 867 builder.Deopt("Unexpected cell contents in global store"); |
865 builder.Else(); | 868 builder.Else(); |
866 Add<HStoreNamedField>(cell, access, value); | 869 Add<HStoreNamedField>(cell, access, value); |
867 builder.End(); | 870 builder.End(); |
868 } | 871 } |
869 | 872 |
870 return value; | 873 return value; |
871 } | 874 } |
872 | 875 |
873 | 876 |
874 Handle<Code> StoreGlobalStub::GenerateCode() { | 877 Handle<Code> StoreGlobalStub::GenerateCode(Isolate* isolate) { |
875 return DoGenerateCode(this); | 878 return DoGenerateCode(isolate, this); |
876 } | 879 } |
877 | 880 |
878 | 881 |
879 template<> | 882 template<> |
880 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { | 883 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { |
881 HValue* value = GetParameter(0); | 884 HValue* value = GetParameter(0); |
882 HValue* map = GetParameter(1); | 885 HValue* map = GetParameter(1); |
883 HValue* key = GetParameter(2); | 886 HValue* key = GetParameter(2); |
884 HValue* object = GetParameter(3); | 887 HValue* object = GetParameter(3); |
885 | 888 |
(...skipping 13 matching lines...) Expand all Loading... |
899 casted_stub()->is_jsarray(), | 902 casted_stub()->is_jsarray(), |
900 casted_stub()->to_kind(), | 903 casted_stub()->to_kind(), |
901 true, ALLOW_RETURN_HOLE, | 904 true, ALLOW_RETURN_HOLE, |
902 casted_stub()->store_mode()); | 905 casted_stub()->store_mode()); |
903 } | 906 } |
904 | 907 |
905 return value; | 908 return value; |
906 } | 909 } |
907 | 910 |
908 | 911 |
909 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 912 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode(Isolate* isolate) { |
910 return DoGenerateCode(this); | 913 return DoGenerateCode(isolate, this); |
911 } | 914 } |
912 | 915 |
913 | 916 |
914 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode( | 917 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode( |
915 HValue* js_function, | 918 HValue* js_function, |
916 HValue* native_context, | 919 HValue* native_context, |
917 HValue* code_object) { | 920 HValue* code_object) { |
918 Counters* counters = isolate()->counters(); | 921 Counters* counters = isolate()->counters(); |
919 AddIncrementCounter(counters->fast_new_closure_install_optimized(), | 922 AddIncrementCounter(counters->fast_new_closure_install_optimized(), |
920 context()); | 923 context()); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 if (FLAG_cache_optimized_code) { | 1092 if (FLAG_cache_optimized_code) { |
1090 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); | 1093 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); |
1091 } else { | 1094 } else { |
1092 BuildInstallCode(js_function, shared_info); | 1095 BuildInstallCode(js_function, shared_info); |
1093 } | 1096 } |
1094 | 1097 |
1095 return js_function; | 1098 return js_function; |
1096 } | 1099 } |
1097 | 1100 |
1098 | 1101 |
1099 Handle<Code> FastNewClosureStub::GenerateCode() { | 1102 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
1100 return DoGenerateCode(this); | 1103 return DoGenerateCode(isolate, this); |
1101 } | 1104 } |
1102 | 1105 |
1103 | 1106 |
1104 } } // namespace v8::internal | 1107 } } // namespace v8::internal |
OLD | NEW |