OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
7 #include "src/compiler/graph-inl.h" | 7 #include "src/compiler/graph-inl.h" |
8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-aux-data-inl.h" | 10 #include "src/compiler/node-aux-data-inl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 32 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
33 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 33 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
34 // stub for the underlying IC stub code. | 34 // stub for the underlying IC stub code. |
35 class LoadICStubShim : public HydrogenCodeStub { | 35 class LoadICStubShim : public HydrogenCodeStub { |
36 public: | 36 public: |
37 LoadICStubShim(Isolate* isolate, ContextualMode contextual_mode) | 37 LoadICStubShim(Isolate* isolate, ContextualMode contextual_mode) |
38 : HydrogenCodeStub(isolate), contextual_mode_(contextual_mode) { | 38 : HydrogenCodeStub(isolate), contextual_mode_(contextual_mode) { |
39 i::compiler::GetInterfaceDescriptor(isolate, this); | 39 i::compiler::GetInterfaceDescriptor(isolate, this); |
40 } | 40 } |
41 | 41 |
42 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 42 virtual Handle<Code> GenerateCode() OVERRIDE { |
43 ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_); | 43 ExtraICState extra_state = LoadIC::ComputeExtraICState(contextual_mode_); |
44 return LoadIC::initialize_stub(isolate(), extra_state); | 44 return LoadIC::initialize_stub(isolate(), extra_state); |
45 } | 45 } |
46 | 46 |
47 virtual void InitializeInterfaceDescriptor( | 47 virtual void InitializeInterfaceDescriptor( |
48 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 48 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
49 CallInterfaceDescriptor* call_descriptor = | 49 CallInterfaceDescriptor* call_descriptor = |
50 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); | 50 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); |
51 descriptor->Initialize(MajorKey(), call_descriptor); | 51 descriptor->Initialize(MajorKey(), call_descriptor); |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
55 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 55 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
56 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 56 virtual int NotMissMinorKey() const OVERRIDE { return 0; } |
57 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 57 virtual bool UseSpecialCache() OVERRIDE { return true; } |
58 | 58 |
59 ContextualMode contextual_mode_; | 59 ContextualMode contextual_mode_; |
60 }; | 60 }; |
61 | 61 |
62 | 62 |
63 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 63 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
64 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 64 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
65 // stub for the underlying IC stub code. | 65 // stub for the underlying IC stub code. |
66 class KeyedLoadICStubShim : public HydrogenCodeStub { | 66 class KeyedLoadICStubShim : public HydrogenCodeStub { |
67 public: | 67 public: |
68 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { | 68 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { |
69 i::compiler::GetInterfaceDescriptor(isolate, this); | 69 i::compiler::GetInterfaceDescriptor(isolate, this); |
70 } | 70 } |
71 | 71 |
72 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 72 virtual Handle<Code> GenerateCode() OVERRIDE { |
73 return isolate()->builtins()->KeyedLoadIC_Initialize(); | 73 return isolate()->builtins()->KeyedLoadIC_Initialize(); |
74 } | 74 } |
75 | 75 |
76 virtual void InitializeInterfaceDescriptor( | 76 virtual void InitializeInterfaceDescriptor( |
77 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 77 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
78 CallInterfaceDescriptor* call_descriptor = | 78 CallInterfaceDescriptor* call_descriptor = |
79 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); | 79 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); |
80 descriptor->Initialize(MajorKey(), call_descriptor); | 80 descriptor->Initialize(MajorKey(), call_descriptor); |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 84 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
85 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 85 virtual int NotMissMinorKey() const OVERRIDE { return 0; } |
86 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 86 virtual bool UseSpecialCache() OVERRIDE { return true; } |
87 }; | 87 }; |
88 | 88 |
89 | 89 |
90 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 90 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
91 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 91 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
92 // stub for the underlying IC stub code. | 92 // stub for the underlying IC stub code. |
93 class StoreICStubShim : public HydrogenCodeStub { | 93 class StoreICStubShim : public HydrogenCodeStub { |
94 public: | 94 public: |
95 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 95 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) |
96 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 96 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { |
97 i::compiler::GetInterfaceDescriptor(isolate, this); | 97 i::compiler::GetInterfaceDescriptor(isolate, this); |
98 } | 98 } |
99 | 99 |
100 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 100 virtual Handle<Code> GenerateCode() OVERRIDE { |
101 return StoreIC::initialize_stub(isolate(), strict_mode_); | 101 return StoreIC::initialize_stub(isolate(), strict_mode_); |
102 } | 102 } |
103 | 103 |
104 virtual void InitializeInterfaceDescriptor( | 104 virtual void InitializeInterfaceDescriptor( |
105 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 105 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
106 CallInterfaceDescriptor* call_descriptor = | 106 CallInterfaceDescriptor* call_descriptor = |
107 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); | 107 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); |
108 descriptor->Initialize(MajorKey(), call_descriptor); | 108 descriptor->Initialize(MajorKey(), call_descriptor); |
109 } | 109 } |
110 | 110 |
111 private: | 111 private: |
112 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 112 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
113 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 113 virtual int NotMissMinorKey() const OVERRIDE { return 0; } |
114 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 114 virtual bool UseSpecialCache() OVERRIDE { return true; } |
115 | 115 |
116 StrictMode strict_mode_; | 116 StrictMode strict_mode_; |
117 }; | 117 }; |
118 | 118 |
119 | 119 |
120 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 120 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
121 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 121 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
122 // stub for the underlying IC stub code. | 122 // stub for the underlying IC stub code. |
123 class KeyedStoreICStubShim : public HydrogenCodeStub { | 123 class KeyedStoreICStubShim : public HydrogenCodeStub { |
124 public: | 124 public: |
125 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 125 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) |
126 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 126 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { |
127 i::compiler::GetInterfaceDescriptor(isolate, this); | 127 i::compiler::GetInterfaceDescriptor(isolate, this); |
128 } | 128 } |
129 | 129 |
130 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 130 virtual Handle<Code> GenerateCode() OVERRIDE { |
131 return strict_mode_ == SLOPPY | 131 return strict_mode_ == SLOPPY |
132 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 132 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
133 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 133 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
134 } | 134 } |
135 | 135 |
136 virtual void InitializeInterfaceDescriptor( | 136 virtual void InitializeInterfaceDescriptor( |
137 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 137 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
138 CallInterfaceDescriptor* call_descriptor = | 138 CallInterfaceDescriptor* call_descriptor = |
139 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); | 139 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); |
140 descriptor->Initialize(MajorKey(), call_descriptor); | 140 descriptor->Initialize(MajorKey(), call_descriptor); |
141 } | 141 } |
142 | 142 |
143 private: | 143 private: |
144 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 144 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
145 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 145 virtual int NotMissMinorKey() const OVERRIDE { return 0; } |
146 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 146 virtual bool UseSpecialCache() OVERRIDE { return true; } |
147 | 147 |
148 StrictMode strict_mode_; | 148 StrictMode strict_mode_; |
149 }; | 149 }; |
150 | 150 |
151 | 151 |
152 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, | 152 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, |
153 MachineOperatorBuilder* machine) | 153 MachineOperatorBuilder* machine) |
154 : info_(info), | 154 : info_(info), |
155 jsgraph_(jsgraph), | 155 jsgraph_(jsgraph), |
156 linkage_(new (jsgraph->zone()) Linkage(info)), | 156 linkage_(new (jsgraph->zone()) Linkage(info)), |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 544 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
545 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 545 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
546 int arity = OperatorProperties::GetValueInputCount(node->op()); | 546 int arity = OperatorProperties::GetValueInputCount(node->op()); |
547 ReplaceWithRuntimeCall(node, function, arity); | 547 ReplaceWithRuntimeCall(node, function, arity); |
548 return node; | 548 return node; |
549 } | 549 } |
550 | 550 |
551 } // namespace compiler | 551 } // namespace compiler |
552 } // namespace internal | 552 } // namespace internal |
553 } // namespace v8 | 553 } // namespace v8 |
OLD | NEW |