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 28 matching lines...) Expand all Loading... |
39 i::compiler::GetInterfaceDescriptor(isolate, this); | 39 i::compiler::GetInterfaceDescriptor(isolate, this); |
40 } | 40 } |
41 | 41 |
42 virtual Handle<Code> GenerateCode() 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) OVERRIDE { | 48 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
49 CallInterfaceDescriptor* call_descriptor = | 49 LoadDescriptor call_descriptor(isolate()); |
50 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); | |
51 descriptor->Initialize(MajorKey(), call_descriptor); | 50 descriptor->Initialize(MajorKey(), call_descriptor); |
52 } | 51 } |
53 | 52 |
54 private: | 53 private: |
55 virtual Major MajorKey() const OVERRIDE { return NoCache; } | 54 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
56 virtual bool UseSpecialCache() OVERRIDE { return true; } | 55 virtual bool UseSpecialCache() OVERRIDE { return true; } |
57 | 56 |
58 ContextualMode contextual_mode_; | 57 ContextualMode contextual_mode_; |
59 }; | 58 }; |
60 | 59 |
61 | 60 |
62 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 61 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
63 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 62 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
64 // stub for the underlying IC stub code. | 63 // stub for the underlying IC stub code. |
65 class KeyedLoadICStubShim : public HydrogenCodeStub { | 64 class KeyedLoadICStubShim : public HydrogenCodeStub { |
66 public: | 65 public: |
67 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { | 66 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { |
68 i::compiler::GetInterfaceDescriptor(isolate, this); | 67 i::compiler::GetInterfaceDescriptor(isolate, this); |
69 } | 68 } |
70 | 69 |
71 virtual Handle<Code> GenerateCode() OVERRIDE { | 70 virtual Handle<Code> GenerateCode() OVERRIDE { |
72 return isolate()->builtins()->KeyedLoadIC_Initialize(); | 71 return isolate()->builtins()->KeyedLoadIC_Initialize(); |
73 } | 72 } |
74 | 73 |
75 virtual void InitializeInterfaceDescriptor( | 74 virtual void InitializeInterfaceDescriptor( |
76 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 75 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
77 CallInterfaceDescriptor* call_descriptor = | 76 LoadDescriptor call_descriptor(isolate()); |
78 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); | |
79 descriptor->Initialize(MajorKey(), call_descriptor); | 77 descriptor->Initialize(MajorKey(), call_descriptor); |
80 } | 78 } |
81 | 79 |
82 private: | 80 private: |
83 virtual Major MajorKey() const OVERRIDE { return NoCache; } | 81 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
84 virtual bool UseSpecialCache() OVERRIDE { return true; } | 82 virtual bool UseSpecialCache() OVERRIDE { return true; } |
85 }; | 83 }; |
86 | 84 |
87 | 85 |
88 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 86 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
89 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 87 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
90 // stub for the underlying IC stub code. | 88 // stub for the underlying IC stub code. |
91 class StoreICStubShim : public HydrogenCodeStub { | 89 class StoreICStubShim : public HydrogenCodeStub { |
92 public: | 90 public: |
93 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 91 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) |
94 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 92 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { |
95 i::compiler::GetInterfaceDescriptor(isolate, this); | 93 i::compiler::GetInterfaceDescriptor(isolate, this); |
96 } | 94 } |
97 | 95 |
98 virtual Handle<Code> GenerateCode() OVERRIDE { | 96 virtual Handle<Code> GenerateCode() OVERRIDE { |
99 return StoreIC::initialize_stub(isolate(), strict_mode_); | 97 return StoreIC::initialize_stub(isolate(), strict_mode_); |
100 } | 98 } |
101 | 99 |
102 virtual void InitializeInterfaceDescriptor( | 100 virtual void InitializeInterfaceDescriptor( |
103 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 101 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
104 CallInterfaceDescriptor* call_descriptor = | 102 StoreDescriptor call_descriptor(isolate()); |
105 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); | |
106 descriptor->Initialize(MajorKey(), call_descriptor); | 103 descriptor->Initialize(MajorKey(), call_descriptor); |
107 } | 104 } |
108 | 105 |
109 private: | 106 private: |
110 virtual Major MajorKey() const OVERRIDE { return NoCache; } | 107 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
111 virtual bool UseSpecialCache() OVERRIDE { return true; } | 108 virtual bool UseSpecialCache() OVERRIDE { return true; } |
112 | 109 |
113 StrictMode strict_mode_; | 110 StrictMode strict_mode_; |
114 }; | 111 }; |
115 | 112 |
116 | 113 |
117 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub | 114 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub |
118 // which doesn't have an interface descriptor yet. It mimics a hydrogen code | 115 // which doesn't have an interface descriptor yet. It mimics a hydrogen code |
119 // stub for the underlying IC stub code. | 116 // stub for the underlying IC stub code. |
120 class KeyedStoreICStubShim : public HydrogenCodeStub { | 117 class KeyedStoreICStubShim : public HydrogenCodeStub { |
121 public: | 118 public: |
122 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 119 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) |
123 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 120 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { |
124 i::compiler::GetInterfaceDescriptor(isolate, this); | 121 i::compiler::GetInterfaceDescriptor(isolate, this); |
125 } | 122 } |
126 | 123 |
127 virtual Handle<Code> GenerateCode() OVERRIDE { | 124 virtual Handle<Code> GenerateCode() OVERRIDE { |
128 return strict_mode_ == SLOPPY | 125 return strict_mode_ == SLOPPY |
129 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 126 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
130 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 127 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
131 } | 128 } |
132 | 129 |
133 virtual void InitializeInterfaceDescriptor( | 130 virtual void InitializeInterfaceDescriptor( |
134 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { | 131 CodeStubInterfaceDescriptor* descriptor) OVERRIDE { |
135 CallInterfaceDescriptor* call_descriptor = | 132 StoreDescriptor call_descriptor(isolate()); |
136 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); | |
137 descriptor->Initialize(MajorKey(), call_descriptor); | 133 descriptor->Initialize(MajorKey(), call_descriptor); |
138 } | 134 } |
139 | 135 |
140 private: | 136 private: |
141 virtual Major MajorKey() const OVERRIDE { return NoCache; } | 137 virtual Major MajorKey() const OVERRIDE { return NoCache; } |
142 virtual bool UseSpecialCache() OVERRIDE { return true; } | 138 virtual bool UseSpecialCache() OVERRIDE { return true; } |
143 | 139 |
144 StrictMode strict_mode_; | 140 StrictMode strict_mode_; |
145 }; | 141 }; |
146 | 142 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 557 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
562 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 558 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
563 int arity = OperatorProperties::GetValueInputCount(node->op()); | 559 int arity = OperatorProperties::GetValueInputCount(node->op()); |
564 ReplaceWithRuntimeCall(node, function, arity); | 560 ReplaceWithRuntimeCall(node, function, arity); |
565 return node; | 561 return node; |
566 } | 562 } |
567 | 563 |
568 } // namespace compiler | 564 } // namespace compiler |
569 } // namespace internal | 565 } // namespace internal |
570 } // namespace v8 | 566 } // namespace v8 |
OLD | NEW |