OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 // Get the constant function and compute the code stub for this | 445 // Get the constant function and compute the code stub for this |
446 // call; used for rewriting to monomorphic state and making sure | 446 // call; used for rewriting to monomorphic state and making sure |
447 // that the code stub is in the stub cache. | 447 // that the code stub is in the stub cache. |
448 JSFunction* function = lookup->GetConstantFunction(); | 448 JSFunction* function = lookup->GetConstantFunction(); |
449 code = StubCache::ComputeCallConstant(argc, in_loop, *name, *object, | 449 code = StubCache::ComputeCallConstant(argc, in_loop, *name, *object, |
450 lookup->holder(), function); | 450 lookup->holder(), function); |
451 break; | 451 break; |
452 } | 452 } |
453 case NORMAL: { | 453 case NORMAL: { |
454 if (!object->IsJSObject()) return; | 454 if (!object->IsJSObject()) return; |
455 if (object->IsGlobalObject()) { | 455 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
456 // The stub generated for the global object picks the value directly | 456 |
457 // from the property cell. So the property must be directly on the | 457 if (lookup->holder()->IsGlobalObject()) { |
458 // global object. | 458 GlobalObject* global = GlobalObject::cast(lookup->holder()); |
459 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); | |
460 if (lookup->holder() != *global) return; | |
461 JSGlobalPropertyCell* cell = | 459 JSGlobalPropertyCell* cell = |
462 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); | 460 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); |
463 if (!cell->value()->IsJSFunction()) return; | 461 if (!cell->value()->IsJSFunction()) return; |
464 JSFunction* function = JSFunction::cast(cell->value()); | 462 JSFunction* function = JSFunction::cast(cell->value()); |
465 code = StubCache::ComputeCallGlobal(argc, in_loop, *name, *global, | 463 code = StubCache::ComputeCallGlobal(argc, |
466 cell, function); | 464 in_loop, |
| 465 *name, |
| 466 *receiver, |
| 467 global, |
| 468 cell, |
| 469 function); |
467 } else { | 470 } else { |
468 // There is only one shared stub for calling normalized | 471 // There is only one shared stub for calling normalized |
469 // properties. It does not traverse the prototype chain, so the | 472 // properties. It does not traverse the prototype chain, so the |
470 // property must be found in the receiver for the stub to be | 473 // property must be found in the receiver for the stub to be |
471 // applicable. | 474 // applicable. |
472 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | |
473 if (lookup->holder() != *receiver) return; | 475 if (lookup->holder() != *receiver) return; |
474 code = StubCache::ComputeCallNormal(argc, in_loop, *name, *receiver); | 476 code = StubCache::ComputeCallNormal(argc, in_loop, *name, *receiver); |
475 } | 477 } |
476 break; | 478 break; |
477 } | 479 } |
478 case INTERCEPTOR: { | 480 case INTERCEPTOR: { |
479 ASSERT(HasInterceptorGetter(lookup->holder())); | 481 ASSERT(HasInterceptorGetter(lookup->holder())); |
480 code = StubCache::ComputeCallInterceptor(argc, *name, *object, | 482 code = StubCache::ComputeCallInterceptor(argc, *name, *object, |
481 lookup->holder()); | 483 lookup->holder()); |
482 break; | 484 break; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 lookup->GetFieldIndex()); | 652 lookup->GetFieldIndex()); |
651 break; | 653 break; |
652 } | 654 } |
653 case CONSTANT_FUNCTION: { | 655 case CONSTANT_FUNCTION: { |
654 Object* constant = lookup->GetConstantFunction(); | 656 Object* constant = lookup->GetConstantFunction(); |
655 code = StubCache::ComputeLoadConstant(*name, *receiver, | 657 code = StubCache::ComputeLoadConstant(*name, *receiver, |
656 lookup->holder(), constant); | 658 lookup->holder(), constant); |
657 break; | 659 break; |
658 } | 660 } |
659 case NORMAL: { | 661 case NORMAL: { |
660 if (object->IsGlobalObject()) { | 662 if (lookup->holder()->IsGlobalObject()) { |
661 // The stub generated for the global object picks the value directly | 663 GlobalObject* global = GlobalObject::cast(lookup->holder()); |
662 // from the property cell. So the property must be directly on the | |
663 // global object. | |
664 Handle<GlobalObject> global = Handle<GlobalObject>::cast(object); | |
665 if (lookup->holder() != *global) return; | |
666 JSGlobalPropertyCell* cell = | 664 JSGlobalPropertyCell* cell = |
667 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); | 665 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); |
668 code = StubCache::ComputeLoadGlobal(*name, *global, | 666 code = StubCache::ComputeLoadGlobal(*name, |
669 cell, lookup->IsDontDelete()); | 667 *receiver, |
| 668 global, |
| 669 cell, |
| 670 lookup->IsDontDelete()); |
670 } else { | 671 } else { |
671 // There is only one shared stub for loading normalized | 672 // There is only one shared stub for loading normalized |
672 // properties. It does not traverse the prototype chain, so the | 673 // properties. It does not traverse the prototype chain, so the |
673 // property must be found in the receiver for the stub to be | 674 // property must be found in the receiver for the stub to be |
674 // applicable. | 675 // applicable. |
675 if (lookup->holder() != *receiver) return; | 676 if (lookup->holder() != *receiver) return; |
676 code = StubCache::ComputeLoadNormal(*name, *receiver); | 677 code = StubCache::ComputeLoadNormal(*name, *receiver); |
677 } | 678 } |
678 break; | 679 break; |
679 } | 680 } |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1355 #undef ADDR | 1356 #undef ADDR |
1356 }; | 1357 }; |
1357 | 1358 |
1358 | 1359 |
1359 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1360 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1360 return IC_utilities[id]; | 1361 return IC_utilities[id]; |
1361 } | 1362 } |
1362 | 1363 |
1363 | 1364 |
1364 } } // namespace v8::internal | 1365 } } // namespace v8::internal |
OLD | NEW |