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

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

Issue 25548009: Centralize handler caching and probing in ic.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Undo moving fallback IC handling Created 7 years, 2 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') | no next file » | 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 113
114 Handle<Code> StubCache::FindIC(Handle<Name> name, 114 Handle<Code> StubCache::FindIC(Handle<Name> name,
115 Handle<JSObject> stub_holder, 115 Handle<JSObject> stub_holder,
116 Code::Kind kind, 116 Code::Kind kind,
117 Code::ExtraICState extra_ic_state) { 117 Code::ExtraICState extra_ic_state) {
118 return FindIC(name, Handle<Map>(stub_holder->map()), kind, extra_ic_state); 118 return FindIC(name, Handle<Map>(stub_holder->map()), kind, extra_ic_state);
119 } 119 }
120 120
121 121
122 Handle<Code> StubCache::FindLoadHandler(Handle<Name> name, 122 Handle<Code> StubCache::FindHandler(Handle<Name> name,
123 Handle<JSObject> receiver, 123 Handle<JSObject> receiver,
124 Code::Kind kind) { 124 Code::Kind kind,
125 Code::Flags flags = Code::ComputeMonomorphicFlags( 125 StrictModeFlag strict_mode) {
126 Code::HANDLER, Code::kNoExtraICState, Code::NORMAL, kind); 126 Code::ExtraICState extra_ic_state = Code::kNoExtraICState;
127 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 127 if (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC) {
128 isolate_); 128 extra_ic_state = Code::ComputeExtraICState(
129 if (probe->IsCode()) return Handle<Code>::cast(probe); 129 STANDARD_STORE, strict_mode);
130 return Handle<Code>::null(); 130 }
131 }
132
133
134 Handle<Code> StubCache::FindStoreHandler(Handle<Name> name,
135 Handle<JSObject> receiver,
136 Code::Kind kind,
137 StrictModeFlag strict_mode) {
138 Code::ExtraICState extra_ic_state = Code::ComputeExtraICState(
139 STANDARD_STORE, strict_mode);
140 Code::Flags flags = Code::ComputeMonomorphicFlags( 131 Code::Flags flags = Code::ComputeMonomorphicFlags(
141 Code::HANDLER, extra_ic_state, Code::NORMAL, kind); 132 Code::HANDLER, extra_ic_state, Code::NORMAL, kind);
142 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), 133 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags),
143 isolate_); 134 isolate_);
144 if (probe->IsCode()) return Handle<Code>::cast(probe); 135 if (probe->IsCode()) return Handle<Code>::cast(probe);
145 return Handle<Code>::null(); 136 return Handle<Code>::null();
146 } 137 }
147 138
148 139
149 Handle<Code> StubCache::ComputeMonomorphicIC(Handle<HeapObject> receiver, 140 Handle<Code> StubCache::ComputeMonomorphicIC(Handle<HeapObject> receiver,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (current->IsGlobalObject()) { 184 if (current->IsGlobalObject()) {
194 global = Handle<GlobalObject>::cast(current); 185 global = Handle<GlobalObject>::cast(current);
195 cache_name = name; 186 cache_name = name;
196 } else if (!current->HasFastProperties()) { 187 } else if (!current->HasFastProperties()) {
197 cache_name = name; 188 cache_name = name;
198 } 189 }
199 } while (!next->IsNull()); 190 } while (!next->IsNull());
200 191
201 // Compile the stub that is either shared for all names or 192 // Compile the stub that is either shared for all names or
202 // name specific if there are global objects involved. 193 // name specific if there are global objects involved.
203 Handle<Code> handler = FindLoadHandler(cache_name, receiver, Code::LOAD_IC); 194 Handle<Code> handler = FindHandler(cache_name, receiver, Code::LOAD_IC);
204 if (!handler.is_null()) return handler; 195 if (!handler.is_null()) return handler;
205 196
206 LoadStubCompiler compiler(isolate_); 197 LoadStubCompiler compiler(isolate_);
207 handler = 198 handler =
208 compiler.CompileLoadNonexistent(receiver, current, cache_name, global); 199 compiler.CompileLoadNonexistent(receiver, current, cache_name, global);
209 HeapObject::UpdateMapCodeCache(receiver, cache_name, handler); 200 HeapObject::UpdateMapCodeCache(receiver, cache_name, handler);
210 return handler; 201 return handler;
211 } 202 }
212 203
213 204
214 Handle<Code> StubCache::ComputeLoadField(Handle<Name> name, 205 Handle<Code> StubCache::ComputeLoadField(Handle<Name> name,
215 Handle<JSObject> receiver, 206 Handle<JSObject> receiver,
216 Handle<JSObject> holder, 207 Handle<JSObject> holder,
217 PropertyIndex field, 208 PropertyIndex field,
218 Representation representation) { 209 Representation representation) {
219 if (receiver.is_identical_to(holder)) { 210 if (receiver.is_identical_to(holder)) {
220 LoadFieldStub stub(field.is_inobject(holder), 211 LoadFieldStub stub(field.is_inobject(holder),
221 field.translate(holder), 212 field.translate(holder),
222 representation); 213 representation);
223 return stub.GetCode(isolate()); 214 return stub.GetCode(isolate());
224 } 215 }
225 216
226 Handle<Code> stub = FindLoadHandler(name, receiver, Code::LOAD_IC);
227 if (!stub.is_null()) return stub;
228
229 LoadStubCompiler compiler(isolate_); 217 LoadStubCompiler compiler(isolate_);
230 Handle<Code> handler = 218 return compiler.CompileLoadField(
231 compiler.CompileLoadField(receiver, holder, name, field, representation); 219 receiver, holder, name, field, representation);
232 HeapObject::UpdateMapCodeCache(receiver, name, handler);
233 return handler;
234 } 220 }
235 221
236 222
237 Handle<Code> StubCache::ComputeLoadCallback( 223 Handle<Code> StubCache::ComputeLoadCallback(
238 Handle<Name> name, 224 Handle<Name> name,
239 Handle<JSObject> receiver, 225 Handle<JSObject> receiver,
240 Handle<JSObject> holder, 226 Handle<JSObject> holder,
241 Handle<ExecutableAccessorInfo> callback) { 227 Handle<ExecutableAccessorInfo> callback) {
242 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); 228 ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
243 Handle<Code> stub = FindLoadHandler(name, receiver, Code::LOAD_IC);
244 if (!stub.is_null()) return stub;
245
246 LoadStubCompiler compiler(isolate_); 229 LoadStubCompiler compiler(isolate_);
247 Handle<Code> handler = 230 return compiler.CompileLoadCallback(receiver, holder, name, callback);
248 compiler.CompileLoadCallback(receiver, holder, name, callback);
249 HeapObject::UpdateMapCodeCache(receiver, name, handler);
250 return handler;
251 } 231 }
252 232
253 233
254 Handle<Code> StubCache::ComputeLoadCallback( 234 Handle<Code> StubCache::ComputeLoadCallback(
255 Handle<Name> name, 235 Handle<Name> name,
256 Handle<JSObject> receiver, 236 Handle<JSObject> receiver,
257 Handle<JSObject> holder, 237 Handle<JSObject> holder,
258 const CallOptimization& call_optimization) { 238 const CallOptimization& call_optimization) {
259 Handle<Code> stub = FindLoadHandler(name, receiver, Code::LOAD_IC);
260 if (!stub.is_null()) return stub;
261
262 LoadStubCompiler compiler(isolate_); 239 LoadStubCompiler compiler(isolate_);
263 Handle<Code> handler = 240 return compiler.CompileLoadCallback(
264 compiler.CompileLoadCallback(receiver, holder, name, call_optimization); 241 receiver, holder, name, call_optimization);
265 HeapObject::UpdateMapCodeCache(receiver, name, handler);
266 return handler;
267 } 242 }
268 243
269 244
270 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name, 245 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<Name> name,
271 Handle<JSObject> receiver, 246 Handle<JSObject> receiver,
272 Handle<JSObject> holder, 247 Handle<JSObject> holder,
273 Handle<JSFunction> getter) { 248 Handle<JSFunction> getter) {
274 Handle<Code> stub = FindLoadHandler(name, receiver, Code::LOAD_IC);
275 if (!stub.is_null()) return stub;
276
277 LoadStubCompiler compiler(isolate_); 249 LoadStubCompiler compiler(isolate_);
278 Handle<Code> handler = 250 return compiler.CompileLoadViaGetter(receiver, holder, name, getter);
279 compiler.CompileLoadViaGetter(receiver, holder, name, getter);
280 HeapObject::UpdateMapCodeCache(receiver, name, handler);
281 return handler;
282 } 251 }
283 252
284 253
285 Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name, 254 Handle<Code> StubCache::ComputeLoadConstant(Handle<Name> name,
286 Handle<JSObject> receiver, 255 Handle<JSObject> receiver,
287 Handle<JSObject> holder, 256 Handle<JSObject> holder,
288 Handle<Object> value) { 257 Handle<Object> value) {
289 Handle<Code> handler = FindLoadHandler(name, receiver, Code::LOAD_IC);
290 if (!handler.is_null()) return handler;
291
292 LoadStubCompiler compiler(isolate_); 258 LoadStubCompiler compiler(isolate_);
293 handler = compiler.CompileLoadConstant(receiver, holder, name, value); 259 return compiler.CompileLoadConstant(receiver, holder, name, value);
294 HeapObject::UpdateMapCodeCache(receiver, name, handler);
295
296 return handler;
297 } 260 }
298 261
299 262
300 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<Name> name, 263 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<Name> name,
301 Handle<JSObject> receiver, 264 Handle<JSObject> receiver,
302 Handle<JSObject> holder) { 265 Handle<JSObject> holder) {
303 Handle<Code> stub = FindLoadHandler(name, receiver, Code::LOAD_IC);
304 if (!stub.is_null()) return stub;
305
306 LoadStubCompiler compiler(isolate_); 266 LoadStubCompiler compiler(isolate_);
307 Handle<Code> handler = 267 return compiler.CompileLoadInterceptor(receiver, holder, name);
308 compiler.CompileLoadInterceptor(receiver, holder, name);
309 HeapObject::UpdateMapCodeCache(receiver, name, handler);
310 return handler;
311 } 268 }
312 269
313 270
314 Handle<Code> StubCache::ComputeLoadNormal(Handle<Name> name, 271 Handle<Code> StubCache::ComputeLoadNormal(Handle<Name> name,
315 Handle<JSObject> receiver) { 272 Handle<JSObject> receiver) {
316 return isolate_->builtins()->LoadIC_Normal(); 273 return isolate_->builtins()->LoadIC_Normal();
317 } 274 }
318 275
319 276
320 Handle<Code> StubCache::ComputeLoadGlobal(Handle<Name> name, 277 Handle<Code> StubCache::ComputeLoadGlobal(Handle<Name> name,
(...skipping 18 matching lines...) Expand all
339 PropertyIndex field, 296 PropertyIndex field,
340 Representation representation) { 297 Representation representation) {
341 if (receiver.is_identical_to(holder)) { 298 if (receiver.is_identical_to(holder)) {
342 // TODO(titzer): this should use an HObjectAccess 299 // TODO(titzer): this should use an HObjectAccess
343 KeyedLoadFieldStub stub(field.is_inobject(holder), 300 KeyedLoadFieldStub stub(field.is_inobject(holder),
344 field.translate(holder), 301 field.translate(holder),
345 representation); 302 representation);
346 return stub.GetCode(isolate()); 303 return stub.GetCode(isolate());
347 } 304 }
348 305
349 Handle<Code> stub = FindLoadHandler(name, receiver, Code::KEYED_LOAD_IC);
350 if (!stub.is_null()) return stub;
351
352 KeyedLoadStubCompiler compiler(isolate_); 306 KeyedLoadStubCompiler compiler(isolate_);
353 Handle<Code> handler = 307 return compiler.CompileLoadField(
354 compiler.CompileLoadField(receiver, holder, name, field, representation); 308 receiver, holder, name, field, representation);
355 HeapObject::UpdateMapCodeCache(receiver, name, handler);
356 return handler;
357 } 309 }
358 310
359 311
360 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name, 312 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<Name> name,
361 Handle<JSObject> receiver, 313 Handle<JSObject> receiver,
362 Handle<JSObject> holder, 314 Handle<JSObject> holder,
363 Handle<Object> value) { 315 Handle<Object> value) {
364 Handle<Code> handler = FindLoadHandler(name, receiver, Code::KEYED_LOAD_IC);
365 if (!handler.is_null()) return handler;
366
367 KeyedLoadStubCompiler compiler(isolate_); 316 KeyedLoadStubCompiler compiler(isolate_);
368 handler = compiler.CompileLoadConstant(receiver, holder, name, value); 317 return compiler.CompileLoadConstant(
369 HeapObject::UpdateMapCodeCache(receiver, name, handler); 318 receiver, holder, name, value);
370 return handler;
371 } 319 }
372 320
373 321
374 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name, 322 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<Name> name,
375 Handle<JSObject> receiver, 323 Handle<JSObject> receiver,
376 Handle<JSObject> holder) { 324 Handle<JSObject> holder) {
377 Handle<Code> stub = FindLoadHandler(name, receiver, Code::KEYED_LOAD_IC);
378 if (!stub.is_null()) return stub;
379
380 KeyedLoadStubCompiler compiler(isolate_); 325 KeyedLoadStubCompiler compiler(isolate_);
381 Handle<Code> handler = 326 return compiler.CompileLoadInterceptor(receiver, holder, name);
382 compiler.CompileLoadInterceptor(receiver, holder, name);
383 HeapObject::UpdateMapCodeCache(receiver, name, handler);
384 return handler;
385 } 327 }
386 328
387 329
388 Handle<Code> StubCache::ComputeKeyedLoadCallback( 330 Handle<Code> StubCache::ComputeKeyedLoadCallback(
389 Handle<Name> name, 331 Handle<Name> name,
390 Handle<JSObject> receiver, 332 Handle<JSObject> receiver,
391 Handle<JSObject> holder, 333 Handle<JSObject> holder,
392 Handle<ExecutableAccessorInfo> callback) { 334 Handle<ExecutableAccessorInfo> callback) {
393 Handle<Code> stub = FindLoadHandler(name, receiver, Code::KEYED_LOAD_IC);
394 if (!stub.is_null()) return stub;
395
396 KeyedLoadStubCompiler compiler(isolate_); 335 KeyedLoadStubCompiler compiler(isolate_);
397 Handle<Code> handler = 336 return compiler.CompileLoadCallback(receiver, holder, name, callback);
398 compiler.CompileLoadCallback(receiver, holder, name, callback);
399 HeapObject::UpdateMapCodeCache(receiver, name, handler);
400 return handler;
401 } 337 }
402 338
403 339
404 Handle<Code> StubCache::ComputeKeyedLoadCallback( 340 Handle<Code> StubCache::ComputeKeyedLoadCallback(
405 Handle<Name> name, 341 Handle<Name> name,
406 Handle<JSObject> receiver, 342 Handle<JSObject> receiver,
407 Handle<JSObject> holder, 343 Handle<JSObject> holder,
408 const CallOptimization& call_optimization) { 344 const CallOptimization& call_optimization) {
409 Handle<Code> stub = FindLoadHandler(name, receiver, Code::KEYED_LOAD_IC);
410 if (!stub.is_null()) return stub;
411
412 KeyedLoadStubCompiler compiler(isolate_); 345 KeyedLoadStubCompiler compiler(isolate_);
413 Handle<Code> handler = 346 return compiler.CompileLoadCallback(
414 compiler.CompileLoadCallback(receiver, holder, name, call_optimization); 347 receiver, holder, name, call_optimization);
415 HeapObject::UpdateMapCodeCache(receiver, name, handler);
416 return handler;
417 } 348 }
418 349
419 350
420 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, 351 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name,
421 Handle<JSObject> receiver, 352 Handle<JSObject> receiver,
422 LookupResult* lookup, 353 LookupResult* lookup,
423 StrictModeFlag strict_mode) { 354 StrictModeFlag strict_mode) {
424 Handle<Code> stub = FindStoreHandler(
425 name, receiver, Code::STORE_IC, strict_mode);
426 if (!stub.is_null()) return stub;
427
428 StoreStubCompiler compiler(isolate_, strict_mode); 355 StoreStubCompiler compiler(isolate_, strict_mode);
429 Handle<Code> handler = compiler.CompileStoreField(receiver, lookup, name); 356 return compiler.CompileStoreField(receiver, lookup, name);
430 HeapObject::UpdateMapCodeCache(receiver, name, handler);
431 return handler;
432 } 357 }
433 358
434 359
435 Handle<Code> StubCache::ComputeStoreTransition(Handle<Name> name, 360 Handle<Code> StubCache::ComputeStoreTransition(Handle<Name> name,
436 Handle<JSObject> receiver, 361 Handle<JSObject> receiver,
437 LookupResult* lookup, 362 LookupResult* lookup,
438 Handle<Map> transition, 363 Handle<Map> transition,
439 StrictModeFlag strict_mode) { 364 StrictModeFlag strict_mode) {
440 Handle<Code> stub = FindStoreHandler(
441 name, receiver, Code::STORE_IC, strict_mode);
442 if (!stub.is_null()) return stub;
443
444 StoreStubCompiler compiler(isolate_, strict_mode); 365 StoreStubCompiler compiler(isolate_, strict_mode);
445 Handle<Code> handler = 366 return compiler.CompileStoreTransition(receiver, lookup, transition, name);
446 compiler.CompileStoreTransition(receiver, lookup, transition, name);
447 HeapObject::UpdateMapCodeCache(receiver, name, handler);
448 return handler;
449 } 367 }
450 368
451 369
452 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { 370 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) {
453 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); 371 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
454 Handle<Name> name = 372 Handle<Name> name =
455 isolate()->factory()->KeyedLoadElementMonomorphic_string(); 373 isolate()->factory()->KeyedLoadElementMonomorphic_string();
456 374
457 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); 375 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_);
458 if (probe->IsCode()) return Handle<Code>::cast(probe); 376 if (probe->IsCode()) return Handle<Code>::cast(probe);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 448 }
531 449
532 450
533 Handle<Code> StubCache::ComputeStoreCallback( 451 Handle<Code> StubCache::ComputeStoreCallback(
534 Handle<Name> name, 452 Handle<Name> name,
535 Handle<JSObject> receiver, 453 Handle<JSObject> receiver,
536 Handle<JSObject> holder, 454 Handle<JSObject> holder,
537 Handle<ExecutableAccessorInfo> callback, 455 Handle<ExecutableAccessorInfo> callback,
538 StrictModeFlag strict_mode) { 456 StrictModeFlag strict_mode) {
539 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); 457 ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
540 Handle<Code> stub = FindStoreHandler(
541 name, receiver, Code::STORE_IC, strict_mode);
542 if (!stub.is_null()) return stub;
543
544 StoreStubCompiler compiler(isolate_, strict_mode); 458 StoreStubCompiler compiler(isolate_, strict_mode);
545 Handle<Code> handler = compiler.CompileStoreCallback( 459 return compiler.CompileStoreCallback(receiver, holder, name, callback);
546 receiver, holder, name, callback);
547 HeapObject::UpdateMapCodeCache(receiver, name, handler);
548 return handler;
549 } 460 }
550 461
551 462
552 Handle<Code> StubCache::ComputeStoreCallback( 463 Handle<Code> StubCache::ComputeStoreCallback(
553 Handle<Name> name, 464 Handle<Name> name,
554 Handle<JSObject> receiver, 465 Handle<JSObject> receiver,
555 Handle<JSObject> holder, 466 Handle<JSObject> holder,
556 const CallOptimization& call_optimization, 467 const CallOptimization& call_optimization,
557 StrictModeFlag strict_mode) { 468 StrictModeFlag strict_mode) {
558 Handle<Code> stub = FindStoreHandler(
559 name, receiver, Code::STORE_IC, strict_mode);
560 if (!stub.is_null()) return stub;
561
562 StoreStubCompiler compiler(isolate_, strict_mode); 469 StoreStubCompiler compiler(isolate_, strict_mode);
563 Handle<Code> handler = compiler.CompileStoreCallback( 470 return compiler.CompileStoreCallback(
564 receiver, holder, name, call_optimization); 471 receiver, holder, name, call_optimization);
565 HeapObject::UpdateMapCodeCache(receiver, name, handler);
566 return handler;
567 } 472 }
568 473
569 474
570 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<Name> name, 475 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<Name> name,
571 Handle<JSObject> receiver, 476 Handle<JSObject> receiver,
572 Handle<JSObject> holder, 477 Handle<JSObject> holder,
573 Handle<JSFunction> setter, 478 Handle<JSFunction> setter,
574 StrictModeFlag strict_mode) { 479 StrictModeFlag strict_mode) {
575 Handle<Code> stub = FindStoreHandler(
576 name, receiver, Code::STORE_IC, strict_mode);
577 if (!stub.is_null()) return stub;
578
579 StoreStubCompiler compiler(isolate_, strict_mode); 480 StoreStubCompiler compiler(isolate_, strict_mode);
580 Handle<Code> handler = compiler.CompileStoreViaSetter( 481 return compiler.CompileStoreViaSetter(receiver, holder, name, setter);
581 receiver, holder, name, setter);
582 HeapObject::UpdateMapCodeCache(receiver, name, handler);
583 return handler;
584 } 482 }
585 483
586 484
587 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<Name> name, 485 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<Name> name,
588 Handle<JSObject> receiver, 486 Handle<JSObject> receiver,
589 StrictModeFlag strict_mode) { 487 StrictModeFlag strict_mode) {
590 Handle<Code> stub = FindStoreHandler(
591 name, receiver, Code::STORE_IC, strict_mode);
592 if (!stub.is_null()) return stub;
593
594 StoreStubCompiler compiler(isolate_, strict_mode); 488 StoreStubCompiler compiler(isolate_, strict_mode);
595 Handle<Code> handler = compiler.CompileStoreInterceptor(receiver, name); 489 return compiler.CompileStoreInterceptor(receiver, name);
596 HeapObject::UpdateMapCodeCache(receiver, name, handler);
597 return handler;
598 } 490 }
599 491
600 492
601 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, 493 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name,
602 Handle<JSObject> receiver, 494 Handle<JSObject> receiver,
603 LookupResult* lookup, 495 LookupResult* lookup,
604 StrictModeFlag strict_mode) { 496 StrictModeFlag strict_mode) {
605 Handle<Code> stub = FindStoreHandler(
606 name, receiver, Code::KEYED_STORE_IC, strict_mode);
607 if (!stub.is_null()) return stub;
608
609 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); 497 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
610 Handle<Code> handler = compiler.CompileStoreField(receiver, lookup, name); 498 return compiler.CompileStoreField(receiver, lookup, name);
611 HeapObject::UpdateMapCodeCache(receiver, name, handler);
612 return handler;
613 } 499 }
614 500
615 501
616 Handle<Code> StubCache::ComputeKeyedStoreTransition( 502 Handle<Code> StubCache::ComputeKeyedStoreTransition(
617 Handle<Name> name, 503 Handle<Name> name,
618 Handle<JSObject> receiver, 504 Handle<JSObject> receiver,
619 LookupResult* lookup, 505 LookupResult* lookup,
620 Handle<Map> transition, 506 Handle<Map> transition,
621 StrictModeFlag strict_mode) { 507 StrictModeFlag strict_mode) {
622 Handle<Code> stub = FindStoreHandler(
623 name, receiver, Code::KEYED_STORE_IC, strict_mode);
624 if (!stub.is_null()) return stub;
625
626 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); 508 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
627 Handle<Code> handler = 509 return compiler.CompileStoreTransition(receiver, lookup, transition, name);
628 compiler.CompileStoreTransition(receiver, lookup, transition, name);
629 HeapObject::UpdateMapCodeCache(receiver, name, handler);
630 return handler;
631 } 510 }
632 511
633 512
634 #define CALL_LOGGER_TAG(kind, type) \ 513 #define CALL_LOGGER_TAG(kind, type) \
635 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) 514 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type)
636 515
637 Handle<Code> StubCache::ComputeCallConstant(int argc, 516 Handle<Code> StubCache::ComputeCallConstant(int argc,
638 Code::Kind kind, 517 Code::Kind kind,
639 Code::ExtraICState extra_state, 518 Code::ExtraICState extra_state,
640 Handle<Name> name, 519 Handle<Name> name,
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 Handle<FunctionTemplateInfo>( 2028 Handle<FunctionTemplateInfo>(
2150 FunctionTemplateInfo::cast(signature->receiver())); 2029 FunctionTemplateInfo::cast(signature->receiver()));
2151 } 2030 }
2152 } 2031 }
2153 2032
2154 is_simple_api_call_ = true; 2033 is_simple_api_call_ = true;
2155 } 2034 }
2156 2035
2157 2036
2158 } } // namespace v8::internal 2037 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698