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() V8_OVERRIDE { | 42 virtual Handle<Code> GenerateCode() V8_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) V8_OVERRIDE { |
49 Register registers[] = {InterfaceDescriptor::ContextRegister(), | 49 CallInterfaceDescriptor* call_descriptor = |
50 LoadConvention::ReceiverRegister(), | 50 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); |
51 LoadConvention::NameRegister()}; | 51 descriptor->Initialize(MajorKey(), call_descriptor); |
52 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
53 } | 52 } |
54 | 53 |
55 private: | 54 private: |
56 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 55 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } |
57 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 56 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
58 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 57 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } |
59 | 58 |
60 ContextualMode contextual_mode_; | 59 ContextualMode contextual_mode_; |
61 }; | 60 }; |
62 | 61 |
63 | 62 |
64 // 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 |
65 // 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 |
66 // stub for the underlying IC stub code. | 65 // stub for the underlying IC stub code. |
67 class KeyedLoadICStubShim : public HydrogenCodeStub { | 66 class KeyedLoadICStubShim : public HydrogenCodeStub { |
68 public: | 67 public: |
69 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { | 68 explicit KeyedLoadICStubShim(Isolate* isolate) : HydrogenCodeStub(isolate) { |
70 i::compiler::GetInterfaceDescriptor(isolate, this); | 69 i::compiler::GetInterfaceDescriptor(isolate, this); |
71 } | 70 } |
72 | 71 |
73 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 72 virtual Handle<Code> GenerateCode() V8_OVERRIDE { |
74 return isolate()->builtins()->KeyedLoadIC_Initialize(); | 73 return isolate()->builtins()->KeyedLoadIC_Initialize(); |
75 } | 74 } |
76 | 75 |
77 virtual void InitializeInterfaceDescriptor( | 76 virtual void InitializeInterfaceDescriptor( |
78 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 77 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { |
79 Register registers[] = {InterfaceDescriptor::ContextRegister(), | 78 CallInterfaceDescriptor* call_descriptor = |
80 LoadConvention::ReceiverRegister(), | 79 isolate()->call_descriptor(CallDescriptorKey::LoadICCall); |
81 LoadConvention::NameRegister()}; | 80 descriptor->Initialize(MajorKey(), call_descriptor); |
82 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
83 } | 81 } |
84 | 82 |
85 private: | 83 private: |
86 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 84 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } |
87 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 85 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
88 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 86 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } |
89 }; | 87 }; |
90 | 88 |
91 | 89 |
92 // 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 |
93 // 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 |
94 // stub for the underlying IC stub code. | 92 // stub for the underlying IC stub code. |
95 class StoreICStubShim : public HydrogenCodeStub { | 93 class StoreICStubShim : public HydrogenCodeStub { |
96 public: | 94 public: |
97 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 95 StoreICStubShim(Isolate* isolate, StrictMode strict_mode) |
98 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 96 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { |
99 i::compiler::GetInterfaceDescriptor(isolate, this); | 97 i::compiler::GetInterfaceDescriptor(isolate, this); |
100 } | 98 } |
101 | 99 |
102 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 100 virtual Handle<Code> GenerateCode() V8_OVERRIDE { |
103 return StoreIC::initialize_stub(isolate(), strict_mode_); | 101 return StoreIC::initialize_stub(isolate(), strict_mode_); |
104 } | 102 } |
105 | 103 |
106 virtual void InitializeInterfaceDescriptor( | 104 virtual void InitializeInterfaceDescriptor( |
107 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 105 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { |
108 Register registers[] = {InterfaceDescriptor::ContextRegister(), | 106 CallInterfaceDescriptor* call_descriptor = |
109 StoreConvention::ReceiverRegister(), | 107 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); |
110 StoreConvention::NameRegister(), | 108 descriptor->Initialize(MajorKey(), call_descriptor); |
111 StoreConvention::ValueRegister()}; | |
112 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
113 } | 109 } |
114 | 110 |
115 private: | 111 private: |
116 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 112 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } |
117 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 113 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
118 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 114 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } |
119 | 115 |
120 StrictMode strict_mode_; | 116 StrictMode strict_mode_; |
121 }; | 117 }; |
122 | 118 |
123 | 119 |
124 // 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 |
125 // 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 |
126 // stub for the underlying IC stub code. | 122 // stub for the underlying IC stub code. |
127 class KeyedStoreICStubShim : public HydrogenCodeStub { | 123 class KeyedStoreICStubShim : public HydrogenCodeStub { |
128 public: | 124 public: |
129 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) | 125 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode) |
130 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { | 126 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) { |
131 i::compiler::GetInterfaceDescriptor(isolate, this); | 127 i::compiler::GetInterfaceDescriptor(isolate, this); |
132 } | 128 } |
133 | 129 |
134 virtual Handle<Code> GenerateCode() V8_OVERRIDE { | 130 virtual Handle<Code> GenerateCode() V8_OVERRIDE { |
135 return strict_mode_ == SLOPPY | 131 return strict_mode_ == SLOPPY |
136 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 132 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
137 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 133 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
138 } | 134 } |
139 | 135 |
140 virtual void InitializeInterfaceDescriptor( | 136 virtual void InitializeInterfaceDescriptor( |
141 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { | 137 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE { |
142 Register registers[] = {InterfaceDescriptor::ContextRegister(), | 138 CallInterfaceDescriptor* call_descriptor = |
143 StoreConvention::ReceiverRegister(), | 139 isolate()->call_descriptor(CallDescriptorKey::StoreICCall); |
144 StoreConvention::NameRegister(), | 140 descriptor->Initialize(MajorKey(), call_descriptor); |
145 StoreConvention::ValueRegister()}; | |
146 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
147 } | 141 } |
148 | 142 |
149 private: | 143 private: |
150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } | 144 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } |
151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } | 145 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } |
152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } | 146 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } |
153 | 147 |
154 StrictMode strict_mode_; | 148 StrictMode strict_mode_; |
155 }; | 149 }; |
156 | 150 |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { | 537 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { |
544 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); | 538 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); |
545 int arity = OperatorProperties::GetValueInputCount(node->op()); | 539 int arity = OperatorProperties::GetValueInputCount(node->op()); |
546 ReplaceWithRuntimeCall(node, function, arity); | 540 ReplaceWithRuntimeCall(node, function, arity); |
547 return node; | 541 return node; |
548 } | 542 } |
549 | 543 |
550 } // namespace compiler | 544 } // namespace compiler |
551 } // namespace internal | 545 } // namespace internal |
552 } // namespace v8 | 546 } // namespace v8 |
OLD | NEW |