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 #ifndef V8_IC_HANDLER_COMPILER_H_ | 5 #ifndef V8_IC_HANDLER_COMPILER_H_ |
6 #define V8_IC_HANDLER_COMPILER_H_ | 6 #define V8_IC_HANDLER_COMPILER_H_ |
7 | 7 |
8 #include "src/ic/access-compiler.h" | 8 #include "src/ic/access-compiler.h" |
9 #include "src/ic/ic-state.h" | 9 #include "src/ic/ic-state.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 class CallOptimization; | 14 class CallOptimization; |
15 | 15 |
16 enum PrototypeCheckType { CHECK_ALL_MAPS, SKIP_RECEIVER }; | 16 enum PrototypeCheckType { CHECK_ALL_MAPS, SKIP_RECEIVER }; |
| 17 enum ReturnHolder { RETURN_HOLDER, DONT_RETURN_ANYTHING }; |
17 | 18 |
18 class PropertyHandlerCompiler : public PropertyAccessCompiler { | 19 class PropertyHandlerCompiler : public PropertyAccessCompiler { |
19 public: | 20 public: |
20 static Handle<Code> Find(Handle<Name> name, Handle<Map> map, Code::Kind kind, | 21 static Handle<Code> Find(Handle<Name> name, Handle<Map> map, Code::Kind kind, |
21 CacheHolderFlag cache_holder, Code::StubType type); | 22 CacheHolderFlag cache_holder, Code::StubType type); |
22 | 23 |
23 protected: | 24 protected: |
24 PropertyHandlerCompiler(Isolate* isolate, Code::Kind kind, Handle<Map> map, | 25 PropertyHandlerCompiler(Isolate* isolate, Code::Kind kind, Handle<Map> map, |
25 Handle<JSObject> holder, CacheHolderFlag cache_holder) | 26 Handle<JSObject> holder, CacheHolderFlag cache_holder) |
26 : PropertyAccessCompiler(isolate, kind, cache_holder), | 27 : PropertyAccessCompiler(isolate, kind, cache_holder), |
27 map_(map), | 28 map_(map), |
28 holder_(holder) {} | 29 holder_(holder) {} |
29 | 30 |
30 virtual ~PropertyHandlerCompiler() {} | 31 virtual ~PropertyHandlerCompiler() {} |
31 | 32 |
32 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, | 33 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, |
33 Label* miss) { | 34 Label* miss, ReturnHolder return_what) { |
34 UNREACHABLE(); | 35 UNREACHABLE(); |
35 return receiver(); | 36 return receiver(); |
36 } | 37 } |
37 | 38 |
38 virtual void FrontendFooter(Handle<Name> name, Label* miss) { UNREACHABLE(); } | 39 virtual void FrontendFooter(Handle<Name> name, Label* miss) { UNREACHABLE(); } |
39 | 40 |
40 // Frontend loads from receiver(), returns holder register which may be | 41 // Frontend loads from receiver(), returns holder register which may be |
41 // different. | 42 // different. |
42 Register Frontend(Handle<Name> name); | 43 Register Frontend(Handle<Name> name); |
43 void NonexistentFrontendHeader(Handle<Name> name, Label* miss, | 44 void NonexistentFrontendHeader(Handle<Name> name, Label* miss, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // code for security check in case of global object holders. Helps to make | 89 // code for security check in case of global object holders. Helps to make |
89 // sure that the current IC is still valid. | 90 // sure that the current IC is still valid. |
90 // | 91 // |
91 // The scratch and holder registers are always clobbered, but the object | 92 // The scratch and holder registers are always clobbered, but the object |
92 // register is only clobbered if it the same as the holder register. The | 93 // register is only clobbered if it the same as the holder register. The |
93 // function returns a register containing the holder - either object_reg or | 94 // function returns a register containing the holder - either object_reg or |
94 // holder_reg. | 95 // holder_reg. |
95 Register CheckPrototypes(Register object_reg, Register holder_reg, | 96 Register CheckPrototypes(Register object_reg, Register holder_reg, |
96 Register scratch1, Register scratch2, | 97 Register scratch1, Register scratch2, |
97 Handle<Name> name, Label* miss, | 98 Handle<Name> name, Label* miss, |
98 PrototypeCheckType check = CHECK_ALL_MAPS); | 99 PrototypeCheckType check, ReturnHolder return_what); |
99 | 100 |
100 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name); | 101 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name); |
101 void set_holder(Handle<JSObject> holder) { holder_ = holder; } | 102 void set_holder(Handle<JSObject> holder) { holder_ = holder; } |
102 Handle<Map> map() const { return map_; } | 103 Handle<Map> map() const { return map_; } |
103 void set_map(Handle<Map> map) { map_ = map; } | 104 void set_map(Handle<Map> map) { map_ = map; } |
104 Handle<JSObject> holder() const { return holder_; } | 105 Handle<JSObject> holder() const { return holder_; } |
105 | 106 |
106 private: | 107 private: |
107 Handle<Map> map_; | 108 Handle<Map> map_; |
108 Handle<JSObject> holder_; | 109 Handle<JSObject> holder_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // stack. The arguments are pushed by the (platform-specific) | 166 // stack. The arguments are pushed by the (platform-specific) |
166 // PushInterceptorArguments and read by LoadPropertyWithInterceptorOnly and | 167 // PushInterceptorArguments and read by LoadPropertyWithInterceptorOnly and |
167 // LoadWithInterceptor. | 168 // LoadWithInterceptor. |
168 static const int kInterceptorArgsNameIndex = 0; | 169 static const int kInterceptorArgsNameIndex = 0; |
169 static const int kInterceptorArgsThisIndex = 1; | 170 static const int kInterceptorArgsThisIndex = 1; |
170 static const int kInterceptorArgsHolderIndex = 2; | 171 static const int kInterceptorArgsHolderIndex = 2; |
171 static const int kInterceptorArgsLength = 3; | 172 static const int kInterceptorArgsLength = 3; |
172 | 173 |
173 protected: | 174 protected: |
174 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, | 175 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, |
175 Label* miss); | 176 Label* miss, ReturnHolder return_what); |
176 | 177 |
177 virtual void FrontendFooter(Handle<Name> name, Label* miss); | 178 virtual void FrontendFooter(Handle<Name> name, Label* miss); |
178 | 179 |
179 private: | 180 private: |
180 Handle<Code> CompileLoadNonexistent(Handle<Name> name); | 181 Handle<Code> CompileLoadNonexistent(Handle<Name> name); |
181 void GenerateLoadConstant(Handle<Object> value); | 182 void GenerateLoadConstant(Handle<Object> value); |
182 void GenerateLoadCallback(Register reg, | 183 void GenerateLoadCallback(Register reg, |
183 Handle<ExecutableAccessorInfo> callback); | 184 Handle<ExecutableAccessorInfo> callback); |
184 void GenerateLoadCallback(const CallOptimization& call_optimization, | 185 void GenerateLoadCallback(const CallOptimization& call_optimization, |
185 Handle<Map> receiver_map); | 186 Handle<Map> receiver_map); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 240 |
240 static void GenerateStoreViaSetterForDeopt(MacroAssembler* masm) { | 241 static void GenerateStoreViaSetterForDeopt(MacroAssembler* masm) { |
241 GenerateStoreViaSetter(masm, Handle<Map>::null(), no_reg, no_reg, -1, -1, | 242 GenerateStoreViaSetter(masm, Handle<Map>::null(), no_reg, no_reg, -1, -1, |
242 no_reg); | 243 no_reg); |
243 } | 244 } |
244 | 245 |
245 static void GenerateSlow(MacroAssembler* masm); | 246 static void GenerateSlow(MacroAssembler* masm); |
246 | 247 |
247 protected: | 248 protected: |
248 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, | 249 virtual Register FrontendHeader(Register object_reg, Handle<Name> name, |
249 Label* miss); | 250 Label* miss, ReturnHolder return_what); |
250 | 251 |
251 virtual void FrontendFooter(Handle<Name> name, Label* miss); | 252 virtual void FrontendFooter(Handle<Name> name, Label* miss); |
252 void GenerateRestoreName(Label* label, Handle<Name> name); | 253 void GenerateRestoreName(Label* label, Handle<Name> name); |
253 | 254 |
254 private: | 255 private: |
255 void GenerateRestoreName(Handle<Name> name); | 256 void GenerateRestoreName(Handle<Name> name); |
256 void GenerateRestoreMap(Handle<Map> transition, Register scratch, | 257 void GenerateRestoreMap(Handle<Map> transition, Register scratch, |
257 Label* miss); | 258 Label* miss); |
258 | 259 |
259 void GenerateConstantCheck(Register map_reg, int descriptor, | 260 void GenerateConstantCheck(Register map_reg, int descriptor, |
(...skipping 30 matching lines...) Expand all Loading... |
290 | 291 |
291 void CompileElementHandlers(MapHandleList* receiver_maps, | 292 void CompileElementHandlers(MapHandleList* receiver_maps, |
292 CodeHandleList* handlers); | 293 CodeHandleList* handlers); |
293 | 294 |
294 static void GenerateStoreSlow(MacroAssembler* masm); | 295 static void GenerateStoreSlow(MacroAssembler* masm); |
295 }; | 296 }; |
296 } | 297 } |
297 } // namespace v8::internal | 298 } // namespace v8::internal |
298 | 299 |
299 #endif // V8_IC_HANDLER_COMPILER_H_ | 300 #endif // V8_IC_HANDLER_COMPILER_H_ |
OLD | NEW |