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

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

Issue 255543003: CodeStubs contain their corresponding Isolate* now. (part 2) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 53 }
54 54
55 55
56 class CodeStubGraphBuilderBase : public HGraphBuilder { 56 class CodeStubGraphBuilderBase : public HGraphBuilder {
57 public: 57 public:
58 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub) 58 CodeStubGraphBuilderBase(Isolate* isolate, HydrogenCodeStub* stub)
59 : HGraphBuilder(&info_), 59 : HGraphBuilder(&info_),
60 arguments_length_(NULL), 60 arguments_length_(NULL),
61 info_(stub, isolate), 61 info_(stub, isolate),
62 context_(NULL) { 62 context_(NULL) {
63 descriptor_ = stub->GetInterfaceDescriptor(isolate); 63 descriptor_ = stub->GetInterfaceDescriptor();
64 parameters_.Reset(new HParameter*[descriptor_->register_param_count_]); 64 parameters_.Reset(new HParameter*[descriptor_->register_param_count_]);
65 } 65 }
66 virtual bool BuildGraph(); 66 virtual bool BuildGraph();
67 67
68 protected: 68 protected:
69 virtual HValue* BuildCodeStub() = 0; 69 virtual HValue* BuildCodeStub() = 0;
70 HParameter* GetParameter(int parameter) { 70 HParameter* GetParameter(int parameter) {
71 ASSERT(parameter < descriptor_->register_param_count_); 71 ASSERT(parameter < descriptor_->register_param_count_);
72 return parameters_[parameter]; 72 return parameters_[parameter];
73 } 73 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined); 231 builder.IfNot<HCompareObjectEqAndBranch, HValue*>(undefined, undefined);
232 builder.Then(); 232 builder.Then();
233 builder.ElseDeopt("Forced deopt to runtime"); 233 builder.ElseDeopt("Forced deopt to runtime");
234 return undefined; 234 return undefined;
235 } 235 }
236 236
237 Stub* casted_stub() { return static_cast<Stub*>(stub()); } 237 Stub* casted_stub() { return static_cast<Stub*>(stub()); }
238 }; 238 };
239 239
240 240
241 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(Isolate* isolate) { 241 Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode() {
242 Factory* factory = isolate->factory(); 242 Factory* factory = isolate()->factory();
243 243
244 // Generate the new code. 244 // Generate the new code.
245 MacroAssembler masm(isolate, NULL, 256); 245 MacroAssembler masm(isolate(), NULL, 256);
246 246
247 { 247 {
248 // Update the static counter each time a new code stub is generated. 248 // Update the static counter each time a new code stub is generated.
249 isolate->counters()->code_stubs()->Increment(); 249 isolate()->counters()->code_stubs()->Increment();
250 250
251 // Generate the code for the stub. 251 // Generate the code for the stub.
252 masm.set_generating_stub(true); 252 masm.set_generating_stub(true);
253 NoCurrentFrameScope scope(&masm); 253 NoCurrentFrameScope scope(&masm);
254 GenerateLightweightMiss(&masm); 254 GenerateLightweightMiss(&masm);
255 } 255 }
256 256
257 // Create the code object. 257 // Create the code object.
258 CodeDesc desc; 258 CodeDesc desc;
259 masm.GetCode(&desc); 259 masm.GetCode(&desc);
260 260
261 // Copy the generated code into a heap object. 261 // Copy the generated code into a heap object.
262 Code::Flags flags = Code::ComputeFlags( 262 Code::Flags flags = Code::ComputeFlags(
263 GetCodeKind(), 263 GetCodeKind(),
264 GetICState(), 264 GetICState(),
265 GetExtraICState(), 265 GetExtraICState(),
266 GetStubType()); 266 GetStubType());
267 Handle<Code> new_object = factory->NewCode( 267 Handle<Code> new_object = factory->NewCode(
268 desc, flags, masm.CodeObject(), NeedsImmovableCode()); 268 desc, flags, masm.CodeObject(), NeedsImmovableCode());
269 return new_object; 269 return new_object;
270 } 270 }
271 271
272 272
273 template <class Stub> 273 template <class Stub>
274 static Handle<Code> DoGenerateCode(Isolate* isolate, Stub* stub) { 274 static Handle<Code> DoGenerateCode(Stub* stub) {
275 Isolate* isolate = stub->isolate();
275 CodeStub::Major major_key = 276 CodeStub::Major major_key =
276 static_cast<HydrogenCodeStub*>(stub)->MajorKey(); 277 static_cast<HydrogenCodeStub*>(stub)->MajorKey();
277 CodeStubInterfaceDescriptor* descriptor = 278 CodeStubInterfaceDescriptor* descriptor =
278 isolate->code_stub_interface_descriptor(major_key); 279 isolate->code_stub_interface_descriptor(major_key);
279 if (descriptor->register_param_count_ < 0) { 280 if (descriptor->register_param_count_ < 0) {
280 stub->InitializeInterfaceDescriptor(isolate, descriptor); 281 stub->InitializeInterfaceDescriptor(descriptor);
281 } 282 }
282 283
283 // If we are uninitialized we can use a light-weight stub to enter 284 // If we are uninitialized we can use a light-weight stub to enter
284 // the runtime that is significantly faster than using the standard 285 // the runtime that is significantly faster than using the standard
285 // stub-failure deopt mechanism. 286 // stub-failure deopt mechanism.
286 if (stub->IsUninitialized() && descriptor->has_miss_handler()) { 287 if (stub->IsUninitialized() && descriptor->has_miss_handler()) {
287 ASSERT(!descriptor->stack_parameter_count_.is_valid()); 288 ASSERT(!descriptor->stack_parameter_count_.is_valid());
288 return stub->GenerateLightweightMissCode(isolate); 289 return stub->GenerateLightweightMissCode();
289 } 290 }
290 ElapsedTimer timer; 291 ElapsedTimer timer;
291 if (FLAG_profile_hydrogen_code_stub_compilation) { 292 if (FLAG_profile_hydrogen_code_stub_compilation) {
292 timer.Start(); 293 timer.Start();
293 } 294 }
294 CodeStubGraphBuilder<Stub> builder(isolate, stub); 295 CodeStubGraphBuilder<Stub> builder(isolate, stub);
295 LChunk* chunk = OptimizeGraph(builder.CreateGraph()); 296 LChunk* chunk = OptimizeGraph(builder.CreateGraph());
296 Handle<Code> code = chunk->Codegen(); 297 Handle<Code> code = chunk->Codegen();
297 if (FLAG_profile_hydrogen_code_stub_compilation) { 298 if (FLAG_profile_hydrogen_code_stub_compilation) {
298 double ms = timer.Elapsed().InMillisecondsF(); 299 double ms = timer.Elapsed().InMillisecondsF();
(...skipping 23 matching lines...) Expand all
322 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); 323 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER);
323 Add<HPushArgument>(value); 324 Add<HPushArgument>(value);
324 Push(Add<HInvokeFunction>(function, 1)); 325 Push(Add<HInvokeFunction>(function, 1));
325 326
326 if_number.End(); 327 if_number.End();
327 328
328 return Pop(); 329 return Pop();
329 } 330 }
330 331
331 332
332 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { 333 Handle<Code> ToNumberStub::GenerateCode() {
333 return DoGenerateCode(isolate, this); 334 return DoGenerateCode(this);
334 } 335 }
335 336
336 337
337 template <> 338 template <>
338 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { 339 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
339 info()->MarkAsSavesCallerDoubles(); 340 info()->MarkAsSavesCallerDoubles();
340 HValue* number = GetParameter(NumberToStringStub::kNumber); 341 HValue* number = GetParameter(NumberToStringStub::kNumber);
341 return BuildNumberToString(number, Type::Number(zone())); 342 return BuildNumberToString(number, Type::Number(zone()));
342 } 343 }
343 344
344 345
345 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { 346 Handle<Code> NumberToStringStub::GenerateCode() {
346 return DoGenerateCode(isolate, this); 347 return DoGenerateCode(this);
347 } 348 }
348 349
349 350
350 template <> 351 template <>
351 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { 352 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
352 Factory* factory = isolate()->factory(); 353 Factory* factory = isolate()->factory();
353 HValue* undefined = graph()->GetConstantUndefined(); 354 HValue* undefined = graph()->GetConstantUndefined();
354 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); 355 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
355 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); 356 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode();
356 int length = casted_stub()->length(); 357 int length = casted_stub()->length();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 environment()->Push(push_value); 410 environment()->Push(push_value);
410 } 411 }
411 412
412 checker.ElseDeopt("Uninitialized boilerplate literals"); 413 checker.ElseDeopt("Uninitialized boilerplate literals");
413 checker.End(); 414 checker.End();
414 415
415 return environment()->Pop(); 416 return environment()->Pop();
416 } 417 }
417 418
418 419
419 Handle<Code> FastCloneShallowArrayStub::GenerateCode(Isolate* isolate) { 420 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
420 return DoGenerateCode(isolate, this); 421 return DoGenerateCode(this);
421 } 422 }
422 423
423 424
424 template <> 425 template <>
425 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { 426 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
426 HValue* undefined = graph()->GetConstantUndefined(); 427 HValue* undefined = graph()->GetConstantUndefined();
427 428
428 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), 429 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0),
429 GetParameter(1), 430 GetParameter(1),
430 static_cast<HValue*>(NULL), 431 static_cast<HValue*>(NULL),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 477 }
477 478
478 environment()->Push(object); 479 environment()->Push(object);
479 checker.ElseDeopt("Uninitialized boilerplate in fast clone"); 480 checker.ElseDeopt("Uninitialized boilerplate in fast clone");
480 checker.End(); 481 checker.End();
481 482
482 return environment()->Pop(); 483 return environment()->Pop();
483 } 484 }
484 485
485 486
486 Handle<Code> FastCloneShallowObjectStub::GenerateCode(Isolate* isolate) { 487 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
487 return DoGenerateCode(isolate, this); 488 return DoGenerateCode(this);
488 } 489 }
489 490
490 491
491 template <> 492 template <>
492 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { 493 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
493 HValue* size = Add<HConstant>(AllocationSite::kSize); 494 HValue* size = Add<HConstant>(AllocationSite::kSize);
494 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, 495 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED,
495 JS_OBJECT_TYPE); 496 JS_OBJECT_TYPE);
496 497
497 // Store the map 498 // Store the map
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 object); 547 object);
547 548
548 HInstruction* feedback_vector = GetParameter(0); 549 HInstruction* feedback_vector = GetParameter(0);
549 HInstruction* slot = GetParameter(1); 550 HInstruction* slot = GetParameter(1);
550 Add<HStoreKeyed>(feedback_vector, slot, object, FAST_ELEMENTS, 551 Add<HStoreKeyed>(feedback_vector, slot, object, FAST_ELEMENTS,
551 INITIALIZING_STORE); 552 INITIALIZING_STORE);
552 return feedback_vector; 553 return feedback_vector;
553 } 554 }
554 555
555 556
556 Handle<Code> CreateAllocationSiteStub::GenerateCode(Isolate* isolate) { 557 Handle<Code> CreateAllocationSiteStub::GenerateCode() {
557 return DoGenerateCode(isolate, this); 558 return DoGenerateCode(this);
558 } 559 }
559 560
560 561
561 template <> 562 template <>
562 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() { 563 HValue* CodeStubGraphBuilder<KeyedLoadFastElementStub>::BuildCodeStub() {
563 HInstruction* load = BuildUncheckedMonomorphicElementAccess( 564 HInstruction* load = BuildUncheckedMonomorphicElementAccess(
564 GetParameter(0), GetParameter(1), NULL, 565 GetParameter(0), GetParameter(1), NULL,
565 casted_stub()->is_js_array(), casted_stub()->elements_kind(), 566 casted_stub()->is_js_array(), casted_stub()->elements_kind(),
566 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE); 567 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE);
567 return load; 568 return load;
568 } 569 }
569 570
570 571
571 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { 572 Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
572 return DoGenerateCode(isolate, this); 573 return DoGenerateCode(this);
573 } 574 }
574 575
575 576
576 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( 577 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField(
577 HValue* object, 578 HValue* object,
578 Representation representation, 579 Representation representation,
579 int offset, 580 int offset,
580 bool is_inobject) { 581 bool is_inobject) {
581 HObjectAccess access = is_inobject 582 HObjectAccess access = is_inobject
582 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) 583 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation)
(...skipping 12 matching lines...) Expand all
595 596
596 template<> 597 template<>
597 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { 598 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
598 return BuildLoadNamedField(GetParameter(0), 599 return BuildLoadNamedField(GetParameter(0),
599 casted_stub()->representation(), 600 casted_stub()->representation(),
600 casted_stub()->offset(), 601 casted_stub()->offset(),
601 casted_stub()->is_inobject()); 602 casted_stub()->is_inobject());
602 } 603 }
603 604
604 605
605 Handle<Code> LoadFieldStub::GenerateCode(Isolate* isolate) { 606 Handle<Code> LoadFieldStub::GenerateCode() {
606 return DoGenerateCode(isolate, this); 607 return DoGenerateCode(this);
607 } 608 }
608 609
609 610
610 template<> 611 template<>
611 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() { 612 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() {
612 HValue* string = BuildLoadNamedField( 613 HValue* string = BuildLoadNamedField(
613 GetParameter(0), Representation::Tagged(), JSValue::kValueOffset, true); 614 GetParameter(0), Representation::Tagged(), JSValue::kValueOffset, true);
614 return BuildLoadNamedField( 615 return BuildLoadNamedField(
615 string, Representation::Tagged(), String::kLengthOffset, true); 616 string, Representation::Tagged(), String::kLengthOffset, true);
616 } 617 }
617 618
618 619
619 Handle<Code> StringLengthStub::GenerateCode(Isolate* isolate) { 620 Handle<Code> StringLengthStub::GenerateCode() {
620 return DoGenerateCode(isolate, this); 621 return DoGenerateCode(this);
621 } 622 }
622 623
623 624
624 template <> 625 template <>
625 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { 626 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() {
626 BuildUncheckedMonomorphicElementAccess( 627 BuildUncheckedMonomorphicElementAccess(
627 GetParameter(0), GetParameter(1), GetParameter(2), 628 GetParameter(0), GetParameter(1), GetParameter(2),
628 casted_stub()->is_js_array(), casted_stub()->elements_kind(), 629 casted_stub()->is_js_array(), casted_stub()->elements_kind(),
629 STORE, NEVER_RETURN_HOLE, casted_stub()->store_mode()); 630 STORE, NEVER_RETURN_HOLE, casted_stub()->store_mode());
630 631
631 return GetParameter(2); 632 return GetParameter(2);
632 } 633 }
633 634
634 635
635 Handle<Code> KeyedStoreFastElementStub::GenerateCode(Isolate* isolate) { 636 Handle<Code> KeyedStoreFastElementStub::GenerateCode() {
636 return DoGenerateCode(isolate, this); 637 return DoGenerateCode(this);
637 } 638 }
638 639
639 640
640 template <> 641 template <>
641 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { 642 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
642 info()->MarkAsSavesCallerDoubles(); 643 info()->MarkAsSavesCallerDoubles();
643 644
644 BuildTransitionElementsKind(GetParameter(0), 645 BuildTransitionElementsKind(GetParameter(0),
645 GetParameter(1), 646 GetParameter(1),
646 casted_stub()->from_kind(), 647 casted_stub()->from_kind(),
647 casted_stub()->to_kind(), 648 casted_stub()->to_kind(),
648 casted_stub()->is_js_array()); 649 casted_stub()->is_js_array());
649 650
650 return GetParameter(0); 651 return GetParameter(0);
651 } 652 }
652 653
653 654
654 Handle<Code> TransitionElementsKindStub::GenerateCode(Isolate* isolate) { 655 Handle<Code> TransitionElementsKindStub::GenerateCode() {
655 return DoGenerateCode(isolate, this); 656 return DoGenerateCode(this);
656 } 657 }
657 658
658 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor( 659 HValue* CodeStubGraphBuilderBase::BuildArrayConstructor(
659 ElementsKind kind, 660 ElementsKind kind,
660 AllocationSiteOverrideMode override_mode, 661 AllocationSiteOverrideMode override_mode,
661 ArgumentClass argument_class) { 662 ArgumentClass argument_class) {
662 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor); 663 HValue* constructor = GetParameter(ArrayConstructorStubBase::kConstructor);
663 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite); 664 HValue* alloc_site = GetParameter(ArrayConstructorStubBase::kAllocationSite);
664 JSArrayBuilder array_builder(this, kind, alloc_site, constructor, 665 JSArrayBuilder array_builder(this, kind, alloc_site, constructor,
665 override_mode); 666 override_mode);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 762
762 763
763 template <> 764 template <>
764 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() { 765 HValue* CodeStubGraphBuilder<ArrayNoArgumentConstructorStub>::BuildCodeStub() {
765 ElementsKind kind = casted_stub()->elements_kind(); 766 ElementsKind kind = casted_stub()->elements_kind();
766 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 767 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
767 return BuildArrayConstructor(kind, override_mode, NONE); 768 return BuildArrayConstructor(kind, override_mode, NONE);
768 } 769 }
769 770
770 771
771 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode(Isolate* isolate) { 772 Handle<Code> ArrayNoArgumentConstructorStub::GenerateCode() {
772 return DoGenerateCode(isolate, this); 773 return DoGenerateCode(this);
773 } 774 }
774 775
775 776
776 template <> 777 template <>
777 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>:: 778 HValue* CodeStubGraphBuilder<ArraySingleArgumentConstructorStub>::
778 BuildCodeStub() { 779 BuildCodeStub() {
779 ElementsKind kind = casted_stub()->elements_kind(); 780 ElementsKind kind = casted_stub()->elements_kind();
780 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 781 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
781 return BuildArrayConstructor(kind, override_mode, SINGLE); 782 return BuildArrayConstructor(kind, override_mode, SINGLE);
782 } 783 }
783 784
784 785
785 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode( 786 Handle<Code> ArraySingleArgumentConstructorStub::GenerateCode() {
786 Isolate* isolate) { 787 return DoGenerateCode(this);
787 return DoGenerateCode(isolate, this);
788 } 788 }
789 789
790 790
791 template <> 791 template <>
792 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() { 792 HValue* CodeStubGraphBuilder<ArrayNArgumentsConstructorStub>::BuildCodeStub() {
793 ElementsKind kind = casted_stub()->elements_kind(); 793 ElementsKind kind = casted_stub()->elements_kind();
794 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode(); 794 AllocationSiteOverrideMode override_mode = casted_stub()->override_mode();
795 return BuildArrayConstructor(kind, override_mode, MULTIPLE); 795 return BuildArrayConstructor(kind, override_mode, MULTIPLE);
796 } 796 }
797 797
798 798
799 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode(Isolate* isolate) { 799 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() {
800 return DoGenerateCode(isolate, this); 800 return DoGenerateCode(this);
801 } 801 }
802 802
803 803
804 template <> 804 template <>
805 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>:: 805 HValue* CodeStubGraphBuilder<InternalArrayNoArgumentConstructorStub>::
806 BuildCodeStub() { 806 BuildCodeStub() {
807 ElementsKind kind = casted_stub()->elements_kind(); 807 ElementsKind kind = casted_stub()->elements_kind();
808 return BuildInternalArrayConstructor(kind, NONE); 808 return BuildInternalArrayConstructor(kind, NONE);
809 } 809 }
810 810
811 811
812 Handle<Code> InternalArrayNoArgumentConstructorStub::GenerateCode( 812 Handle<Code> InternalArrayNoArgumentConstructorStub::GenerateCode() {
813 Isolate* isolate) { 813 return DoGenerateCode(this);
814 return DoGenerateCode(isolate, this);
815 } 814 }
816 815
817 816
818 template <> 817 template <>
819 HValue* CodeStubGraphBuilder<InternalArraySingleArgumentConstructorStub>:: 818 HValue* CodeStubGraphBuilder<InternalArraySingleArgumentConstructorStub>::
820 BuildCodeStub() { 819 BuildCodeStub() {
821 ElementsKind kind = casted_stub()->elements_kind(); 820 ElementsKind kind = casted_stub()->elements_kind();
822 return BuildInternalArrayConstructor(kind, SINGLE); 821 return BuildInternalArrayConstructor(kind, SINGLE);
823 } 822 }
824 823
825 824
826 Handle<Code> InternalArraySingleArgumentConstructorStub::GenerateCode( 825 Handle<Code> InternalArraySingleArgumentConstructorStub::GenerateCode() {
827 Isolate* isolate) { 826 return DoGenerateCode(this);
828 return DoGenerateCode(isolate, this);
829 } 827 }
830 828
831 829
832 template <> 830 template <>
833 HValue* CodeStubGraphBuilder<InternalArrayNArgumentsConstructorStub>:: 831 HValue* CodeStubGraphBuilder<InternalArrayNArgumentsConstructorStub>::
834 BuildCodeStub() { 832 BuildCodeStub() {
835 ElementsKind kind = casted_stub()->elements_kind(); 833 ElementsKind kind = casted_stub()->elements_kind();
836 return BuildInternalArrayConstructor(kind, MULTIPLE); 834 return BuildInternalArrayConstructor(kind, MULTIPLE);
837 } 835 }
838 836
839 837
840 Handle<Code> InternalArrayNArgumentsConstructorStub::GenerateCode( 838 Handle<Code> InternalArrayNArgumentsConstructorStub::GenerateCode() {
841 Isolate* isolate) { 839 return DoGenerateCode(this);
842 return DoGenerateCode(isolate, this);
843 } 840 }
844 841
845 842
846 template <> 843 template <>
847 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { 844 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() {
848 Isolate* isolate = graph()->isolate(); 845 Isolate* isolate = graph()->isolate();
849 CompareNilICStub* stub = casted_stub(); 846 CompareNilICStub* stub = casted_stub();
850 HIfContinuation continuation; 847 HIfContinuation continuation;
851 Handle<Map> sentinel_map(isolate->heap()->meta_map()); 848 Handle<Map> sentinel_map(isolate->heap()->meta_map());
852 Type* type = stub->GetType(zone(), sentinel_map); 849 Type* type = stub->GetType(zone(), sentinel_map);
853 BuildCompareNil(GetParameter(0), type, &continuation); 850 BuildCompareNil(GetParameter(0), type, &continuation);
854 IfBuilder if_nil(this, &continuation); 851 IfBuilder if_nil(this, &continuation);
855 if_nil.Then(); 852 if_nil.Then();
856 if (continuation.IsFalseReachable()) { 853 if (continuation.IsFalseReachable()) {
857 if_nil.Else(); 854 if_nil.Else();
858 if_nil.Return(graph()->GetConstant0()); 855 if_nil.Return(graph()->GetConstant0());
859 } 856 }
860 if_nil.End(); 857 if_nil.End();
861 return continuation.IsTrueReachable() 858 return continuation.IsTrueReachable()
862 ? graph()->GetConstant1() 859 ? graph()->GetConstant1()
863 : graph()->GetConstantUndefined(); 860 : graph()->GetConstantUndefined();
864 } 861 }
865 862
866 863
867 Handle<Code> CompareNilICStub::GenerateCode(Isolate* isolate) { 864 Handle<Code> CompareNilICStub::GenerateCode() {
868 return DoGenerateCode(isolate, this); 865 return DoGenerateCode(this);
869 } 866 }
870 867
871 868
872 template <> 869 template <>
873 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { 870 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
874 BinaryOpIC::State state = casted_stub()->state(); 871 BinaryOpIC::State state = casted_stub()->state();
875 872
876 HValue* left = GetParameter(BinaryOpICStub::kLeft); 873 HValue* left = GetParameter(BinaryOpICStub::kLeft);
877 HValue* right = GetParameter(BinaryOpICStub::kRight); 874 HValue* right = GetParameter(BinaryOpICStub::kRight);
878 875
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 if_heap_number.Else(); 967 if_heap_number.Else();
971 Push(result); 968 Push(result);
972 if_heap_number.End(); 969 if_heap_number.End();
973 result = Pop(); 970 result = Pop();
974 } 971 }
975 972
976 return result; 973 return result;
977 } 974 }
978 975
979 976
980 Handle<Code> BinaryOpICStub::GenerateCode(Isolate* isolate) { 977 Handle<Code> BinaryOpICStub::GenerateCode() {
981 return DoGenerateCode(isolate, this); 978 return DoGenerateCode(this);
982 } 979 }
983 980
984 981
985 template <> 982 template <>
986 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() { 983 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() {
987 BinaryOpIC::State state = casted_stub()->state(); 984 BinaryOpIC::State state = casted_stub()->state();
988 985
989 HValue* allocation_site = GetParameter( 986 HValue* allocation_site = GetParameter(
990 BinaryOpWithAllocationSiteStub::kAllocationSite); 987 BinaryOpWithAllocationSiteStub::kAllocationSite);
991 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft); 988 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft);
992 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight); 989 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight);
993 990
994 Type* left_type = state.GetLeftType(zone()); 991 Type* left_type = state.GetLeftType(zone());
995 Type* right_type = state.GetRightType(zone()); 992 Type* right_type = state.GetRightType(zone());
996 Type* result_type = state.GetResultType(zone()); 993 Type* result_type = state.GetResultType(zone());
997 HAllocationMode allocation_mode(allocation_site); 994 HAllocationMode allocation_mode(allocation_site);
998 995
999 return BuildBinaryOperation(state.op(), left, right, 996 return BuildBinaryOperation(state.op(), left, right,
1000 left_type, right_type, result_type, 997 left_type, right_type, result_type,
1001 state.fixed_right_arg(), allocation_mode); 998 state.fixed_right_arg(), allocation_mode);
1002 } 999 }
1003 1000
1004 1001
1005 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode(Isolate* isolate) { 1002 Handle<Code> BinaryOpWithAllocationSiteStub::GenerateCode() {
1006 return DoGenerateCode(isolate, this); 1003 return DoGenerateCode(this);
1007 } 1004 }
1008 1005
1009 1006
1010 template <> 1007 template <>
1011 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() { 1008 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() {
1012 StringAddStub* stub = casted_stub(); 1009 StringAddStub* stub = casted_stub();
1013 StringAddFlags flags = stub->flags(); 1010 StringAddFlags flags = stub->flags();
1014 PretenureFlag pretenure_flag = stub->pretenure_flag(); 1011 PretenureFlag pretenure_flag = stub->pretenure_flag();
1015 1012
1016 HValue* left = GetParameter(StringAddStub::kLeft); 1013 HValue* left = GetParameter(StringAddStub::kLeft);
1017 HValue* right = GetParameter(StringAddStub::kRight); 1014 HValue* right = GetParameter(StringAddStub::kRight);
1018 1015
1019 // Make sure that both arguments are strings if not known in advance. 1016 // Make sure that both arguments are strings if not known in advance.
1020 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { 1017 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
1021 left = BuildCheckString(left); 1018 left = BuildCheckString(left);
1022 } 1019 }
1023 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { 1020 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) {
1024 right = BuildCheckString(right); 1021 right = BuildCheckString(right);
1025 } 1022 }
1026 1023
1027 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag)); 1024 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag));
1028 } 1025 }
1029 1026
1030 1027
1031 Handle<Code> StringAddStub::GenerateCode(Isolate* isolate) { 1028 Handle<Code> StringAddStub::GenerateCode() {
1032 return DoGenerateCode(isolate, this); 1029 return DoGenerateCode(this);
1033 } 1030 }
1034 1031
1035 1032
1036 template <> 1033 template <>
1037 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { 1034 HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() {
1038 ToBooleanStub* stub = casted_stub(); 1035 ToBooleanStub* stub = casted_stub();
1039 1036
1040 IfBuilder if_true(this); 1037 IfBuilder if_true(this);
1041 if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); 1038 if_true.If<HBranch>(GetParameter(0), stub->GetTypes());
1042 if_true.Then(); 1039 if_true.Then();
1043 if_true.Return(graph()->GetConstant1()); 1040 if_true.Return(graph()->GetConstant1());
1044 if_true.Else(); 1041 if_true.Else();
1045 if_true.End(); 1042 if_true.End();
1046 return graph()->GetConstant0(); 1043 return graph()->GetConstant0();
1047 } 1044 }
1048 1045
1049 1046
1050 Handle<Code> ToBooleanStub::GenerateCode(Isolate* isolate) { 1047 Handle<Code> ToBooleanStub::GenerateCode() {
1051 return DoGenerateCode(isolate, this); 1048 return DoGenerateCode(this);
1052 } 1049 }
1053 1050
1054 1051
1055 template <> 1052 template <>
1056 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { 1053 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
1057 StoreGlobalStub* stub = casted_stub(); 1054 StoreGlobalStub* stub = casted_stub();
1058 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate()); 1055 Handle<Object> hole(isolate()->heap()->the_hole_value(), isolate());
1059 Handle<Object> placeholer_value(Smi::FromInt(0), isolate()); 1056 Handle<Object> placeholer_value(Smi::FromInt(0), isolate());
1060 Handle<PropertyCell> placeholder_cell = 1057 Handle<PropertyCell> placeholder_cell =
1061 isolate()->factory()->NewPropertyCell(placeholer_value); 1058 isolate()->factory()->NewPropertyCell(placeholer_value);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 builder.Deopt("Unexpected cell contents in global store"); 1090 builder.Deopt("Unexpected cell contents in global store");
1094 builder.Else(); 1091 builder.Else();
1095 Add<HStoreNamedField>(cell, access, value); 1092 Add<HStoreNamedField>(cell, access, value);
1096 builder.End(); 1093 builder.End();
1097 } 1094 }
1098 1095
1099 return value; 1096 return value;
1100 } 1097 }
1101 1098
1102 1099
1103 Handle<Code> StoreGlobalStub::GenerateCode(Isolate* isolate) { 1100 Handle<Code> StoreGlobalStub::GenerateCode() {
1104 return DoGenerateCode(isolate, this); 1101 return DoGenerateCode(this);
1105 } 1102 }
1106 1103
1107 1104
1108 template<> 1105 template<>
1109 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() { 1106 HValue* CodeStubGraphBuilder<ElementsTransitionAndStoreStub>::BuildCodeStub() {
1110 HValue* value = GetParameter(0); 1107 HValue* value = GetParameter(0);
1111 HValue* map = GetParameter(1); 1108 HValue* map = GetParameter(1);
1112 HValue* key = GetParameter(2); 1109 HValue* key = GetParameter(2);
1113 HValue* object = GetParameter(3); 1110 HValue* object = GetParameter(3);
1114 1111
(...skipping 12 matching lines...) Expand all
1127 casted_stub()->is_jsarray(), 1124 casted_stub()->is_jsarray(),
1128 casted_stub()->to_kind(), 1125 casted_stub()->to_kind(),
1129 STORE, ALLOW_RETURN_HOLE, 1126 STORE, ALLOW_RETURN_HOLE,
1130 casted_stub()->store_mode()); 1127 casted_stub()->store_mode());
1131 } 1128 }
1132 1129
1133 return value; 1130 return value;
1134 } 1131 }
1135 1132
1136 1133
1137 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode(Isolate* isolate) { 1134 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() {
1138 return DoGenerateCode(isolate, this); 1135 return DoGenerateCode(this);
1139 } 1136 }
1140 1137
1141 1138
1142 void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode( 1139 void CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode(
1143 HValue* js_function, 1140 HValue* js_function,
1144 HValue* native_context, 1141 HValue* native_context,
1145 IfBuilder* builder, 1142 IfBuilder* builder,
1146 HValue* optimized_map, 1143 HValue* optimized_map,
1147 HValue* map_index) { 1144 HValue* map_index) {
1148 HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt()); 1145 HValue* osr_ast_id_none = Add<HConstant>(BailoutId::None().ToInt());
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 if (FLAG_cache_optimized_code) { 1334 if (FLAG_cache_optimized_code) {
1338 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context); 1335 BuildInstallFromOptimizedCodeMap(js_function, shared_info, native_context);
1339 } else { 1336 } else {
1340 BuildInstallCode(js_function, shared_info); 1337 BuildInstallCode(js_function, shared_info);
1341 } 1338 }
1342 1339
1343 return js_function; 1340 return js_function;
1344 } 1341 }
1345 1342
1346 1343
1347 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { 1344 Handle<Code> FastNewClosureStub::GenerateCode() {
1348 return DoGenerateCode(isolate, this); 1345 return DoGenerateCode(this);
1349 } 1346 }
1350 1347
1351 1348
1352 template<> 1349 template<>
1353 HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() { 1350 HValue* CodeStubGraphBuilder<FastNewContextStub>::BuildCodeStub() {
1354 int length = casted_stub()->slots() + Context::MIN_CONTEXT_SLOTS; 1351 int length = casted_stub()->slots() + Context::MIN_CONTEXT_SLOTS;
1355 1352
1356 // Get the function. 1353 // Get the function.
1357 HParameter* function = GetParameter(FastNewContextStub::kFunction); 1354 HParameter* function = GetParameter(FastNewContextStub::kFunction);
1358 1355
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) { 1389 for (int i = Context::MIN_CONTEXT_SLOTS; i < length; ++i) {
1393 Add<HStoreNamedField>(function_context, 1390 Add<HStoreNamedField>(function_context,
1394 HObjectAccess::ForContextSlot(i), 1391 HObjectAccess::ForContextSlot(i),
1395 graph()->GetConstantUndefined()); 1392 graph()->GetConstantUndefined());
1396 } 1393 }
1397 1394
1398 return function_context; 1395 return function_context;
1399 } 1396 }
1400 1397
1401 1398
1402 Handle<Code> FastNewContextStub::GenerateCode(Isolate* isolate) { 1399 Handle<Code> FastNewContextStub::GenerateCode() {
1403 return DoGenerateCode(isolate, this); 1400 return DoGenerateCode(this);
1404 } 1401 }
1405 1402
1406 1403
1407 template<> 1404 template<>
1408 HValue* CodeStubGraphBuilder<KeyedLoadDictionaryElementStub>::BuildCodeStub() { 1405 HValue* CodeStubGraphBuilder<KeyedLoadDictionaryElementStub>::BuildCodeStub() {
1409 HValue* receiver = GetParameter(0); 1406 HValue* receiver = GetParameter(0);
1410 HValue* key = GetParameter(1); 1407 HValue* key = GetParameter(1);
1411 1408
1412 Add<HCheckSmi>(key); 1409 Add<HCheckSmi>(key);
1413 1410
1414 return BuildUncheckedDictionaryElementLoad(receiver, key); 1411 return BuildUncheckedDictionaryElementLoad(receiver, key);
1415 } 1412 }
1416 1413
1417 1414
1418 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { 1415 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode() {
1419 return DoGenerateCode(isolate, this); 1416 return DoGenerateCode(this);
1420 } 1417 }
1421 1418
1422 1419
1423 template<> 1420 template<>
1424 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { 1421 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() {
1425 // Determine the parameters. 1422 // Determine the parameters.
1426 HValue* length = GetParameter(RegExpConstructResultStub::kLength); 1423 HValue* length = GetParameter(RegExpConstructResultStub::kLength);
1427 HValue* index = GetParameter(RegExpConstructResultStub::kIndex); 1424 HValue* index = GetParameter(RegExpConstructResultStub::kIndex);
1428 HValue* input = GetParameter(RegExpConstructResultStub::kInput); 1425 HValue* input = GetParameter(RegExpConstructResultStub::kInput);
1429 1426
1430 return BuildRegExpConstructResult(length, index, input); 1427 return BuildRegExpConstructResult(length, index, input);
1431 } 1428 }
1432 1429
1433 1430
1434 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { 1431 Handle<Code> RegExpConstructResultStub::GenerateCode() {
1435 return DoGenerateCode(isolate, this); 1432 return DoGenerateCode(this);
1436 } 1433 }
1437 1434
1438 1435
1439 } } // namespace v8::internal 1436 } } // namespace v8::internal
OLDNEW
« src/arm/macro-assembler-arm.cc ('K') | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698