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

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

Issue 300283002: Introduce FieldIndex to unify and abstract property/field offset (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix mutable boxed double runtime function Created 6 years, 6 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
« no previous file with comments | « src/code-stubs.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/field-index.h"
8 #include "src/hydrogen.h" 9 #include "src/hydrogen.h"
9 #include "src/lithium.h" 10 #include "src/lithium.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 14
14 15
15 static LChunk* OptimizeGraph(HGraph* graph) { 16 static LChunk* OptimizeGraph(HGraph* graph) {
16 DisallowHeapAllocation no_allocation; 17 DisallowHeapAllocation no_allocation;
17 DisallowHandleAllocation no_handles; 18 DisallowHandleAllocation no_handles;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // This is initialized in BuildGraph() 53 // This is initialized in BuildGraph()
53 ASSERT(arguments_length_ != NULL); 54 ASSERT(arguments_length_ != NULL);
54 return arguments_length_; 55 return arguments_length_;
55 } 56 }
56 CompilationInfo* info() { return &info_; } 57 CompilationInfo* info() { return &info_; }
57 HydrogenCodeStub* stub() { return info_.code_stub(); } 58 HydrogenCodeStub* stub() { return info_.code_stub(); }
58 HContext* context() { return context_; } 59 HContext* context() { return context_; }
59 Isolate* isolate() { return info_.isolate(); } 60 Isolate* isolate() { return info_.isolate(); }
60 61
61 HLoadNamedField* BuildLoadNamedField(HValue* object, 62 HLoadNamedField* BuildLoadNamedField(HValue* object,
62 Representation representation, 63 FieldIndex index);
63 int offset,
64 bool is_inobject);
65 64
66 enum ArgumentClass { 65 enum ArgumentClass {
67 NONE, 66 NONE,
68 SINGLE, 67 SINGLE,
69 MULTIPLE 68 MULTIPLE
70 }; 69 };
71 70
72 HValue* BuildArrayConstructor(ElementsKind kind, 71 HValue* BuildArrayConstructor(ElementsKind kind,
73 AllocationSiteOverrideMode override_mode, 72 AllocationSiteOverrideMode override_mode,
74 ArgumentClass argument_class); 73 ArgumentClass argument_class);
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 return load; 545 return load;
547 } 546 }
548 547
549 548
550 Handle<Code> KeyedLoadFastElementStub::GenerateCode() { 549 Handle<Code> KeyedLoadFastElementStub::GenerateCode() {
551 return DoGenerateCode(this); 550 return DoGenerateCode(this);
552 } 551 }
553 552
554 553
555 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField( 554 HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField(
556 HValue* object, 555 HValue* object, FieldIndex index) {
557 Representation representation, 556 Representation representation = index.is_double()
558 int offset, 557 ? Representation::Double()
559 bool is_inobject) { 558 : Representation::Tagged();
560 HObjectAccess access = is_inobject 559 int offset = index.offset();
560 HObjectAccess access = index.is_inobject()
561 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation) 561 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation)
562 : HObjectAccess::ForBackingStoreOffset(offset, representation); 562 : HObjectAccess::ForBackingStoreOffset(offset, representation);
563 if (representation.IsDouble()) { 563 if (index.is_double()) {
564 // Load the heap number. 564 // Load the heap number.
565 object = Add<HLoadNamedField>( 565 object = Add<HLoadNamedField>(
566 object, static_cast<HValue*>(NULL), 566 object, static_cast<HValue*>(NULL),
567 access.WithRepresentation(Representation::Tagged())); 567 access.WithRepresentation(Representation::Tagged()));
568 // Load the double value from it. 568 // Load the double value from it.
569 access = HObjectAccess::ForHeapNumberValue(); 569 access = HObjectAccess::ForHeapNumberValue();
570 } 570 }
571 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access); 571 return Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), access);
572 } 572 }
573 573
574 574
575 template<> 575 template<>
576 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { 576 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
577 return BuildLoadNamedField(GetParameter(0), 577 return BuildLoadNamedField(GetParameter(0), casted_stub()->index());
578 casted_stub()->representation(),
579 casted_stub()->offset(),
580 casted_stub()->is_inobject());
581 } 578 }
582 579
583 580
584 Handle<Code> LoadFieldStub::GenerateCode() { 581 Handle<Code> LoadFieldStub::GenerateCode() {
585 return DoGenerateCode(this); 582 return DoGenerateCode(this);
586 } 583 }
587 584
588 585
589 template<> 586 template<>
590 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() { 587 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() {
591 HValue* string = BuildLoadNamedField( 588 HValue* string = BuildLoadNamedField(GetParameter(0),
592 GetParameter(0), Representation::Tagged(), JSValue::kValueOffset, true); 589 FieldIndex::ForInObjectOffset(JSValue::kValueOffset));
593 return BuildLoadNamedField( 590 return BuildLoadNamedField(string,
594 string, Representation::Tagged(), String::kLengthOffset, true); 591 FieldIndex::ForInObjectOffset(String::kLengthOffset));
595 } 592 }
596 593
597 594
598 Handle<Code> StringLengthStub::GenerateCode() { 595 Handle<Code> StringLengthStub::GenerateCode() {
599 return DoGenerateCode(this); 596 return DoGenerateCode(this);
600 } 597 }
601 598
602 599
603 template <> 600 template <>
604 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { 601 HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() {
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 return BuildRegExpConstructResult(length, index, input); 1411 return BuildRegExpConstructResult(length, index, input);
1415 } 1412 }
1416 1413
1417 1414
1418 Handle<Code> RegExpConstructResultStub::GenerateCode() { 1415 Handle<Code> RegExpConstructResultStub::GenerateCode() {
1419 return DoGenerateCode(this); 1416 return DoGenerateCode(this);
1420 } 1417 }
1421 1418
1422 1419
1423 } } // namespace v8::internal 1420 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698