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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 HValue* GetArgumentsLength() { | 74 HValue* GetArgumentsLength() { |
75 // This is initialized in BuildGraph() | 75 // This is initialized in BuildGraph() |
76 ASSERT(arguments_length_ != NULL); | 76 ASSERT(arguments_length_ != NULL); |
77 return arguments_length_; | 77 return arguments_length_; |
78 } | 78 } |
79 CompilationInfo* info() { return &info_; } | 79 CompilationInfo* info() { return &info_; } |
80 HydrogenCodeStub* stub() { return info_.code_stub(); } | 80 HydrogenCodeStub* stub() { return info_.code_stub(); } |
81 HContext* context() { return context_; } | 81 HContext* context() { return context_; } |
82 Isolate* isolate() { return info_.isolate(); } | 82 Isolate* isolate() { return info_.isolate(); } |
83 | 83 |
| 84 HLoadNamedField* BuildLoadNamedField(HValue* object, |
| 85 Representation representation, |
| 86 int offset, |
| 87 bool is_inobject); |
| 88 |
84 enum ArgumentClass { | 89 enum ArgumentClass { |
85 NONE, | 90 NONE, |
86 SINGLE, | 91 SINGLE, |
87 MULTIPLE | 92 MULTIPLE |
88 }; | 93 }; |
89 | 94 |
90 HValue* BuildArrayConstructor(ElementsKind kind, | 95 HValue* BuildArrayConstructor(ElementsKind kind, |
91 AllocationSiteOverrideMode override_mode, | 96 AllocationSiteOverrideMode override_mode, |
92 ArgumentClass argument_class); | 97 ArgumentClass argument_class); |
93 HValue* BuildInternalArrayConstructor(ElementsKind kind, | 98 HValue* BuildInternalArrayConstructor(ElementsKind kind, |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE); | 557 LOAD, NEVER_RETURN_HOLE, STANDARD_STORE); |
553 return load; | 558 return load; |
554 } | 559 } |
555 | 560 |
556 | 561 |
557 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { | 562 Handle<Code> KeyedLoadFastElementStub::GenerateCode(Isolate* isolate) { |
558 return DoGenerateCode(isolate, this); | 563 return DoGenerateCode(isolate, this); |
559 } | 564 } |
560 | 565 |
561 | 566 |
| 567 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( |
| 568 HValue* object, |
| 569 Representation representation, |
| 570 int offset, |
| 571 bool is_inobject) { |
| 572 HObjectAccess access = is_inobject |
| 573 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) |
| 574 : HObjectAccess::ForBackingStoreOffset(offset, representation); |
| 575 if (representation.IsDouble()) { |
| 576 // Load the heap number. |
| 577 object = Add<HLoadNamedField>( |
| 578 object, static_cast<HValue*>(NULL), |
| 579 access.WithRepresentation(Representation::Tagged())); |
| 580 // Load the double value from it. |
| 581 access = HObjectAccess::ForHeapNumberValue(); |
| 582 } |
| 583 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); |
| 584 } |
| 585 |
| 586 |
562 template<> | 587 template<> |
563 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { | 588 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { |
564 Representation rep = casted_stub()->representation(); | 589 return BuildLoadNamedField(GetParameter(0), |
565 int offset = casted_stub()->offset(); | 590 casted_stub()->representation(), |
566 HObjectAccess access = casted_stub()->is_inobject() ? | 591 casted_stub()->offset(), |
567 HObjectAccess::ForObservableJSObjectOffset(offset, rep) : | 592 casted_stub()->is_inobject()); |
568 HObjectAccess::ForBackingStoreOffset(offset, rep); | |
569 return AddLoadNamedField(GetParameter(0), access); | |
570 } | 593 } |
571 | 594 |
572 | 595 |
573 Handle<Code> LoadFieldStub::GenerateCode(Isolate* isolate) { | 596 Handle<Code> LoadFieldStub::GenerateCode(Isolate* isolate) { |
574 return DoGenerateCode(isolate, this); | 597 return DoGenerateCode(isolate, this); |
575 } | 598 } |
576 | 599 |
577 | 600 |
578 template<> | 601 template<> |
579 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() { | 602 HValue* CodeStubGraphBuilder<KeyedLoadFieldStub>::BuildCodeStub() { |
580 Representation rep = casted_stub()->representation(); | 603 return BuildLoadNamedField(GetParameter(0), |
581 int offset = casted_stub()->offset(); | 604 casted_stub()->representation(), |
582 HObjectAccess access = casted_stub()->is_inobject() ? | 605 casted_stub()->offset(), |
583 HObjectAccess::ForObservableJSObjectOffset(offset, rep) : | 606 casted_stub()->is_inobject()); |
584 HObjectAccess::ForBackingStoreOffset(offset, rep); | |
585 return AddLoadNamedField(GetParameter(0), access); | |
586 } | 607 } |
587 | 608 |
588 | 609 |
589 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { | 610 Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { |
590 return DoGenerateCode(isolate, this); | 611 return DoGenerateCode(isolate, this); |
591 } | 612 } |
592 | 613 |
593 | 614 |
594 template <> | 615 template <> |
595 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { | 616 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 return BuildRegExpConstructResult(length, index, input); | 1417 return BuildRegExpConstructResult(length, index, input); |
1397 } | 1418 } |
1398 | 1419 |
1399 | 1420 |
1400 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { | 1421 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { |
1401 return DoGenerateCode(isolate, this); | 1422 return DoGenerateCode(isolate, this); |
1402 } | 1423 } |
1403 | 1424 |
1404 | 1425 |
1405 } } // namespace v8::internal | 1426 } } // namespace v8::internal |
OLD | NEW |