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

Side by Side Diff: src/stub-cache.cc

Issue 12092043: Support slow-mode prototypes for load and call ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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/stub-cache.h ('k') | src/x64/stub-cache-x64.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 primary->key = name; 95 primary->key = name;
96 primary->value = code; 96 primary->value = code;
97 primary->map = map; 97 primary->map = map;
98 isolate()->counters()->megamorphic_stub_cache_updates()->Increment(); 98 isolate()->counters()->megamorphic_stub_cache_updates()->Increment();
99 return code; 99 return code;
100 } 100 }
101 101
102 102
103 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<String> name, 103 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<String> name,
104 Handle<JSObject> receiver) { 104 Handle<JSObject> receiver) {
105 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties());
106 // If no global objects are present in the prototype chain, the load 105 // If no global objects are present in the prototype chain, the load
107 // nonexistent IC stub can be shared for all names for a given map 106 // nonexistent IC stub can be shared for all names for a given map
108 // and we use the empty string for the map cache in that case. If 107 // and we use the empty string for the map cache in that case. If
109 // there are global objects involved, we need to check global 108 // there are global objects involved, we need to check global
110 // property cells in the stub and therefore the stub will be 109 // property cells in the stub and therefore the stub will be
111 // specific to the name. 110 // specific to the name.
112 Handle<String> cache_name = factory()->empty_string(); 111 Handle<String> cache_name = factory()->empty_string();
113 if (receiver->IsGlobalObject()) cache_name = name; 112 Handle<JSObject> current;
114 Handle<JSObject> last = receiver; 113 Handle<Object> next = receiver;
115 while (last->GetPrototype() != heap()->null_value()) { 114 Handle<GlobalObject> global;
116 last = Handle<JSObject>(JSObject::cast(last->GetPrototype())); 115 do {
117 if (last->IsGlobalObject()) cache_name = name; 116 current = Handle<JSObject>::cast(next);
118 } 117 next = Handle<Object>(current->GetPrototype());
118 if (current->IsGlobalObject()) {
119 global = Handle<GlobalObject>::cast(current);
120 cache_name = name;
121 } else if (!current->HasFastProperties()) {
122 cache_name = name;
123 }
124 } while (!next->IsNull());
125
119 // Compile the stub that is either shared for all names or 126 // Compile the stub that is either shared for all names or
120 // name specific if there are global objects involved. 127 // name specific if there are global objects involved.
121 Code::Flags flags = 128 Code::Flags flags =
122 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NONEXISTENT); 129 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NONEXISTENT);
123 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags), 130 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags),
124 isolate_); 131 isolate_);
125 if (probe->IsCode()) return Handle<Code>::cast(probe); 132 if (probe->IsCode()) return Handle<Code>::cast(probe);
126 133
127 LoadStubCompiler compiler(isolate_); 134 LoadStubCompiler compiler(isolate_);
128 Handle<Code> code = 135 Handle<Code> code =
129 compiler.CompileLoadNonexistent(cache_name, receiver, last); 136 compiler.CompileLoadNonexistent(cache_name, receiver, current, global);
130 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name)); 137 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name));
131 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code)); 138 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code));
132 JSObject::UpdateMapCodeCache(receiver, cache_name, code); 139 JSObject::UpdateMapCodeCache(receiver, cache_name, code);
133 return code; 140 return code;
134 } 141 }
135 142
136 143
137 Handle<Code> StubCache::ComputeLoadField(Handle<String> name, 144 Handle<Code> StubCache::ComputeLoadField(Handle<String> name,
138 Handle<JSObject> receiver, 145 Handle<JSObject> receiver,
139 Handle<JSObject> holder, 146 Handle<JSObject> holder,
140 PropertyIndex field_index) { 147 PropertyIndex field_index) {
141 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 148 InlineCacheHolderFlag cache_holder =
149 IC::GetCodeCacheForObject(*receiver, *holder);
150 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
142 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::FIELD); 151 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::FIELD);
143 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 152 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
144 isolate_); 153 isolate_);
145 if (probe->IsCode()) return Handle<Code>::cast(probe); 154 if (probe->IsCode()) return Handle<Code>::cast(probe);
146 155
147 LoadStubCompiler compiler(isolate_); 156 LoadStubCompiler compiler(isolate_);
148 Handle<Code> code = 157 Handle<Code> code =
149 compiler.CompileLoadField(receiver, holder, field_index, name); 158 compiler.CompileLoadField(receiver, holder, field_index, name);
150 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 159 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
151 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 160 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
152 JSObject::UpdateMapCodeCache(receiver, name, code); 161 JSObject::UpdateMapCodeCache(map_holder, name, code);
153 return code; 162 return code;
154 } 163 }
155 164
156 165
157 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, 166 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name,
158 Handle<JSObject> receiver, 167 Handle<JSObject> receiver,
159 Handle<JSObject> holder, 168 Handle<JSObject> holder,
160 Handle<AccessorInfo> callback) { 169 Handle<AccessorInfo> callback) {
161 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); 170 ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
162 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 171 InlineCacheHolderFlag cache_holder =
172 IC::GetCodeCacheForObject(*receiver, *holder);
173 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
163 Code::Flags flags = 174 Code::Flags flags =
164 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); 175 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS);
165 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 176 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
166 isolate_); 177 isolate_);
167 if (probe->IsCode()) return Handle<Code>::cast(probe); 178 if (probe->IsCode()) return Handle<Code>::cast(probe);
168 179
169 LoadStubCompiler compiler(isolate_); 180 LoadStubCompiler compiler(isolate_);
170 Handle<Code> code = 181 Handle<Code> code =
171 compiler.CompileLoadCallback(name, receiver, holder, callback); 182 compiler.CompileLoadCallback(name, receiver, holder, callback);
172 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 183 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
173 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 184 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
174 JSObject::UpdateMapCodeCache(receiver, name, code); 185 JSObject::UpdateMapCodeCache(map_holder, name, code);
175 return code; 186 return code;
176 } 187 }
177 188
178 189
179 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name, 190 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name,
180 Handle<JSObject> receiver, 191 Handle<JSObject> receiver,
181 Handle<JSObject> holder, 192 Handle<JSObject> holder,
182 Handle<JSFunction> getter) { 193 Handle<JSFunction> getter) {
183 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 194 InlineCacheHolderFlag cache_holder =
195 IC::GetCodeCacheForObject(*receiver, *holder);
196 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
184 Code::Flags flags = 197 Code::Flags flags =
185 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); 198 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS);
186 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 199 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
187 isolate_); 200 isolate_);
188 if (probe->IsCode()) return Handle<Code>::cast(probe); 201 if (probe->IsCode()) return Handle<Code>::cast(probe);
189 202
190 LoadStubCompiler compiler(isolate_); 203 LoadStubCompiler compiler(isolate_);
191 Handle<Code> code = 204 Handle<Code> code =
192 compiler.CompileLoadViaGetter(name, receiver, holder, getter); 205 compiler.CompileLoadViaGetter(name, receiver, holder, getter);
193 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 206 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
194 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 207 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
195 JSObject::UpdateMapCodeCache(receiver, name, code); 208 JSObject::UpdateMapCodeCache(map_holder, name, code);
196 return code; 209 return code;
197 } 210 }
198 211
199 212
200 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, 213 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name,
201 Handle<JSObject> receiver, 214 Handle<JSObject> receiver,
202 Handle<JSObject> holder, 215 Handle<JSObject> holder,
203 Handle<JSFunction> value) { 216 Handle<JSFunction> value) {
204 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 217 InlineCacheHolderFlag cache_holder =
218 IC::GetCodeCacheForObject(*receiver, *holder);
219 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
205 Code::Flags flags = 220 Code::Flags flags =
206 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CONSTANT_FUNCTION); 221 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CONSTANT_FUNCTION);
207 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 222 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
208 isolate_); 223 isolate_);
209 if (probe->IsCode()) return Handle<Code>::cast(probe); 224 if (probe->IsCode()) return Handle<Code>::cast(probe);
210 225
211 LoadStubCompiler compiler(isolate_); 226 LoadStubCompiler compiler(isolate_);
212 Handle<Code> code = 227 Handle<Code> code =
213 compiler.CompileLoadConstant(receiver, holder, value, name); 228 compiler.CompileLoadConstant(receiver, holder, value, name);
214 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 229 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
215 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 230 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
216 JSObject::UpdateMapCodeCache(receiver, name, code); 231 JSObject::UpdateMapCodeCache(map_holder, name, code);
217 return code; 232 return code;
218 } 233 }
219 234
220 235
221 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name, 236 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name,
222 Handle<JSObject> receiver, 237 Handle<JSObject> receiver,
223 Handle<JSObject> holder) { 238 Handle<JSObject> holder) {
224 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 239 InlineCacheHolderFlag cache_holder =
240 IC::GetCodeCacheForObject(*receiver, *holder);
241 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
225 Code::Flags flags = 242 Code::Flags flags =
226 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::INTERCEPTOR); 243 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::INTERCEPTOR);
227 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 244 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
228 isolate_); 245 isolate_);
229 if (probe->IsCode()) return Handle<Code>::cast(probe); 246 if (probe->IsCode()) return Handle<Code>::cast(probe);
230 247
231 LoadStubCompiler compiler(isolate_); 248 LoadStubCompiler compiler(isolate_);
232 Handle<Code> code = 249 Handle<Code> code =
233 compiler.CompileLoadInterceptor(receiver, holder, name); 250 compiler.CompileLoadInterceptor(receiver, holder, name);
234 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 251 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
235 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 252 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
236 JSObject::UpdateMapCodeCache(receiver, name, code); 253 JSObject::UpdateMapCodeCache(map_holder, name, code);
237 return code; 254 return code;
238 } 255 }
239 256
240 257
241 Handle<Code> StubCache::ComputeLoadNormal() { 258 Handle<Code> StubCache::ComputeLoadNormal() {
242 return isolate_->builtins()->LoadIC_Normal(); 259 return isolate_->builtins()->LoadIC_Normal();
243 } 260 }
244 261
245 262
246 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name, 263 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name,
247 Handle<JSObject> receiver, 264 Handle<JSObject> receiver,
248 Handle<GlobalObject> holder, 265 Handle<GlobalObject> holder,
249 Handle<JSGlobalPropertyCell> cell, 266 Handle<JSGlobalPropertyCell> cell,
250 bool is_dont_delete) { 267 bool is_dont_delete) {
251 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 268 InlineCacheHolderFlag cache_holder =
269 IC::GetCodeCacheForObject(*receiver, *holder);
270 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
252 Code::Flags flags = 271 Code::Flags flags =
253 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL); 272 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL);
254 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 273 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
255 isolate_); 274 isolate_);
256 if (probe->IsCode()) return Handle<Code>::cast(probe); 275 if (probe->IsCode()) return Handle<Code>::cast(probe);
257 276
258 LoadStubCompiler compiler(isolate_); 277 LoadStubCompiler compiler(isolate_);
259 Handle<Code> code = 278 Handle<Code> code =
260 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); 279 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete);
261 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); 280 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name));
262 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); 281 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code));
263 JSObject::UpdateMapCodeCache(receiver, name, code); 282 JSObject::UpdateMapCodeCache(map_holder, name, code);
264 return code; 283 return code;
265 } 284 }
266 285
267 286
268 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name, 287 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name,
269 Handle<JSObject> receiver, 288 Handle<JSObject> receiver,
270 Handle<JSObject> holder, 289 Handle<JSObject> holder,
271 PropertyIndex field_index) { 290 PropertyIndex field_index) {
272 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 291 InlineCacheHolderFlag cache_holder =
292 IC::GetCodeCacheForObject(*receiver, *holder);
293 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
273 Code::Flags flags = 294 Code::Flags flags =
274 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::FIELD); 295 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::FIELD);
275 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 296 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
276 isolate_); 297 isolate_);
277 if (probe->IsCode()) return Handle<Code>::cast(probe); 298 if (probe->IsCode()) return Handle<Code>::cast(probe);
278 299
279 KeyedLoadStubCompiler compiler(isolate_); 300 KeyedLoadStubCompiler compiler(isolate_);
280 Handle<Code> code = 301 Handle<Code> code =
281 compiler.CompileLoadField(name, receiver, holder, field_index); 302 compiler.CompileLoadField(name, receiver, holder, field_index);
282 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 303 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
283 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 304 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
284 JSObject::UpdateMapCodeCache(receiver, name, code); 305 JSObject::UpdateMapCodeCache(map_holder, name, code);
285 return code; 306 return code;
286 } 307 }
287 308
288 309
289 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name, 310 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name,
290 Handle<JSObject> receiver, 311 Handle<JSObject> receiver,
291 Handle<JSObject> holder, 312 Handle<JSObject> holder,
292 Handle<JSFunction> value) { 313 Handle<JSFunction> value) {
293 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 314 InlineCacheHolderFlag cache_holder =
315 IC::GetCodeCacheForObject(*receiver, *holder);
316 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
294 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, 317 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC,
295 Code::CONSTANT_FUNCTION); 318 Code::CONSTANT_FUNCTION);
296 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 319 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
297 isolate_); 320 isolate_);
298 if (probe->IsCode()) return Handle<Code>::cast(probe); 321 if (probe->IsCode()) return Handle<Code>::cast(probe);
299 322
300 KeyedLoadStubCompiler compiler(isolate_); 323 KeyedLoadStubCompiler compiler(isolate_);
301 Handle<Code> code = 324 Handle<Code> code =
302 compiler.CompileLoadConstant(name, receiver, holder, value); 325 compiler.CompileLoadConstant(name, receiver, holder, value);
303 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 326 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
304 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 327 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
305 JSObject::UpdateMapCodeCache(receiver, name, code); 328 JSObject::UpdateMapCodeCache(map_holder, name, code);
306 return code; 329 return code;
307 } 330 }
308 331
309 332
310 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name, 333 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name,
311 Handle<JSObject> receiver, 334 Handle<JSObject> receiver,
312 Handle<JSObject> holder) { 335 Handle<JSObject> holder) {
313 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 336 InlineCacheHolderFlag cache_holder =
337 IC::GetCodeCacheForObject(*receiver, *holder);
338 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
314 Code::Flags flags = 339 Code::Flags flags =
315 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::INTERCEPTOR); 340 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::INTERCEPTOR);
316 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 341 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
317 isolate_); 342 isolate_);
318 if (probe->IsCode()) return Handle<Code>::cast(probe); 343 if (probe->IsCode()) return Handle<Code>::cast(probe);
319 344
320 KeyedLoadStubCompiler compiler(isolate_); 345 KeyedLoadStubCompiler compiler(isolate_);
321 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name); 346 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name);
322 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 347 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
323 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 348 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
324 JSObject::UpdateMapCodeCache(receiver, name, code); 349 JSObject::UpdateMapCodeCache(map_holder, name, code);
325 return code; 350 return code;
326 } 351 }
327 352
328 353
329 Handle<Code> StubCache::ComputeKeyedLoadCallback( 354 Handle<Code> StubCache::ComputeKeyedLoadCallback(
330 Handle<String> name, 355 Handle<String> name,
331 Handle<JSObject> receiver, 356 Handle<JSObject> receiver,
332 Handle<JSObject> holder, 357 Handle<JSObject> holder,
333 Handle<AccessorInfo> callback) { 358 Handle<AccessorInfo> callback) {
334 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); 359 InlineCacheHolderFlag cache_holder =
360 IC::GetCodeCacheForObject(*receiver, *holder);
361 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder));
335 Code::Flags flags = 362 Code::Flags flags =
336 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); 363 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS);
337 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 364 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags),
338 isolate_); 365 isolate_);
339 if (probe->IsCode()) return Handle<Code>::cast(probe); 366 if (probe->IsCode()) return Handle<Code>::cast(probe);
340 367
341 KeyedLoadStubCompiler compiler(isolate_); 368 KeyedLoadStubCompiler compiler(isolate_);
342 Handle<Code> code = 369 Handle<Code> code =
343 compiler.CompileLoadCallback(name, receiver, holder, callback); 370 compiler.CompileLoadCallback(name, receiver, holder, callback);
344 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); 371 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name));
345 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); 372 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code));
346 JSObject::UpdateMapCodeCache(receiver, name, code); 373 JSObject::UpdateMapCodeCache(map_holder, name, code);
347 return code; 374 return code;
348 } 375 }
349 376
350 377
351 Handle<Code> StubCache::ComputeStoreField(Handle<String> name, 378 Handle<Code> StubCache::ComputeStoreField(Handle<String> name,
352 Handle<JSObject> receiver, 379 Handle<JSObject> receiver,
353 int field_index, 380 int field_index,
354 Handle<Map> transition, 381 Handle<Map> transition,
355 StrictModeFlag strict_mode) { 382 StrictModeFlag strict_mode) {
356 Code::StubType type = 383 Code::StubType type =
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 Handle<FunctionTemplateInfo>( 1669 Handle<FunctionTemplateInfo>(
1643 FunctionTemplateInfo::cast(signature->receiver())); 1670 FunctionTemplateInfo::cast(signature->receiver()));
1644 } 1671 }
1645 } 1672 }
1646 1673
1647 is_simple_api_call_ = true; 1674 is_simple_api_call_ = true;
1648 } 1675 }
1649 1676
1650 1677
1651 } } // namespace v8::internal 1678 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698