| 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 #ifdef DEBUG | 608 #ifdef DEBUG |
| 609 if (FLAG_trace_ic) PrintF("[LoadIC : +#length /array]\n"); | 609 if (FLAG_trace_ic) PrintF("[LoadIC : +#length /array]\n"); |
| 610 #endif | 610 #endif |
| 611 Code* target = Builtins::builtin(Builtins::LoadIC_ArrayLength); | 611 Code* target = Builtins::builtin(Builtins::LoadIC_ArrayLength); |
| 612 set_target(target); | 612 set_target(target); |
| 613 StubCache::Set(*name, HeapObject::cast(*object)->map(), target); | 613 StubCache::Set(*name, HeapObject::cast(*object)->map(), target); |
| 614 return JSArray::cast(*object)->length(); | 614 return JSArray::cast(*object)->length(); |
| 615 } | 615 } |
| 616 | 616 |
| 617 // Use specialized code for getting prototype of functions. | 617 // Use specialized code for getting prototype of functions. |
| 618 if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol())) { | 618 if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol()) && |
| 619 JSFunction::cast(*object)->should_have_prototype()) { |
| 619 #ifdef DEBUG | 620 #ifdef DEBUG |
| 620 if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n"); | 621 if (FLAG_trace_ic) PrintF("[LoadIC : +#prototype /function]\n"); |
| 621 #endif | 622 #endif |
| 622 Code* target = Builtins::builtin(Builtins::LoadIC_FunctionPrototype); | 623 Code* target = Builtins::builtin(Builtins::LoadIC_FunctionPrototype); |
| 623 set_target(target); | 624 set_target(target); |
| 624 StubCache::Set(*name, HeapObject::cast(*object)->map(), target); | 625 StubCache::Set(*name, HeapObject::cast(*object)->map(), target); |
| 625 return Accessors::FunctionGetPrototype(*object, 0); | 626 return Accessors::FunctionGetPrototype(*object, 0); |
| 626 } | 627 } |
| 627 } | 628 } |
| 628 | 629 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 Object* code = StubCache::ComputeKeyedLoadArrayLength(*name, *array); | 818 Object* code = StubCache::ComputeKeyedLoadArrayLength(*name, *array); |
| 818 if (code->IsFailure()) return code; | 819 if (code->IsFailure()) return code; |
| 819 set_target(Code::cast(code)); | 820 set_target(Code::cast(code)); |
| 820 #ifdef DEBUG | 821 #ifdef DEBUG |
| 821 TraceIC("KeyedLoadIC", name, state, target()); | 822 TraceIC("KeyedLoadIC", name, state, target()); |
| 822 #endif // DEBUG | 823 #endif // DEBUG |
| 823 return JSArray::cast(*object)->length(); | 824 return JSArray::cast(*object)->length(); |
| 824 } | 825 } |
| 825 | 826 |
| 826 // Use specialized code for getting prototype of functions. | 827 // Use specialized code for getting prototype of functions. |
| 827 if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol())) { | 828 if (object->IsJSFunction() && name->Equals(Heap::prototype_symbol()) && |
| 829 JSFunction::cast(*object)->should_have_prototype()) { |
| 828 Handle<JSFunction> function = Handle<JSFunction>::cast(object); | 830 Handle<JSFunction> function = Handle<JSFunction>::cast(object); |
| 829 Object* code = | 831 Object* code = |
| 830 StubCache::ComputeKeyedLoadFunctionPrototype(*name, *function); | 832 StubCache::ComputeKeyedLoadFunctionPrototype(*name, *function); |
| 831 if (code->IsFailure()) return code; | 833 if (code->IsFailure()) return code; |
| 832 set_target(Code::cast(code)); | 834 set_target(Code::cast(code)); |
| 833 #ifdef DEBUG | 835 #ifdef DEBUG |
| 834 TraceIC("KeyedLoadIC", name, state, target()); | 836 TraceIC("KeyedLoadIC", name, state, target()); |
| 835 #endif // DEBUG | 837 #endif // DEBUG |
| 836 return Accessors::FunctionGetPrototype(*object, 0); | 838 return Accessors::FunctionGetPrototype(*object, 0); |
| 837 } | 839 } |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 #undef ADDR | 1500 #undef ADDR |
| 1499 }; | 1501 }; |
| 1500 | 1502 |
| 1501 | 1503 |
| 1502 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1504 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 1503 return IC_utilities[id]; | 1505 return IC_utilities[id]; |
| 1504 } | 1506 } |
| 1505 | 1507 |
| 1506 | 1508 |
| 1507 } } // namespace v8::internal | 1509 } } // namespace v8::internal |
| OLD | NEW |