| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "accessors.h" | 30 #include "accessors.h" |
| 31 #include "api.h" | 31 #include "api.h" |
| 32 #include "arguments.h" | 32 #include "arguments.h" |
| 33 #include "codegen.h" | 33 #include "codegen.h" |
| 34 #include "execution.h" | 34 #include "execution.h" |
| 35 #include "ic-inl.h" | 35 #include "ic-inl.h" |
| 36 #include "runtime.h" | 36 #include "runtime.h" |
| 37 #include "stub-cache.h" | 37 #include "stub-cache.h" |
| 38 #include "third_party/vtune/vtune-jit.h" |
| 38 | 39 |
| 39 namespace v8 { | 40 namespace v8 { |
| 40 namespace internal { | 41 namespace internal { |
| 41 | 42 |
| 42 #ifdef DEBUG | 43 #ifdef DEBUG |
| 43 char IC::TransitionMarkFromState(IC::State state) { | 44 char IC::TransitionMarkFromState(IC::State state) { |
| 44 switch (state) { | 45 switch (state) { |
| 45 case UNINITIALIZED: return '0'; | 46 case UNINITIALIZED: return '0'; |
| 46 case PREMONOMORPHIC: return 'P'; | 47 case PREMONOMORPHIC: return 'P'; |
| 47 case MONOMORPHIC: return '1'; | 48 case MONOMORPHIC: return '1'; |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 Handle<Code> cached_stub = ComputeMonomorphicStubWithoutMapCheck( | 1063 Handle<Code> cached_stub = ComputeMonomorphicStubWithoutMapCheck( |
| 1063 receiver_map, strict_mode, growth_mode); | 1064 receiver_map, strict_mode, growth_mode); |
| 1064 handler_ics.Add(cached_stub); | 1065 handler_ics.Add(cached_stub); |
| 1065 } | 1066 } |
| 1066 KeyedLoadStubCompiler compiler(isolate()); | 1067 KeyedLoadStubCompiler compiler(isolate()); |
| 1067 Handle<Code> code = compiler.CompileLoadPolymorphic( | 1068 Handle<Code> code = compiler.CompileLoadPolymorphic( |
| 1068 receiver_maps, &handler_ics); | 1069 receiver_maps, &handler_ics); |
| 1069 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); | 1070 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); |
| 1070 PROFILE(isolate(), | 1071 PROFILE(isolate(), |
| 1071 CodeCreateEvent(Logger::KEYED_LOAD_MEGAMORPHIC_IC_TAG, *code, 0)); | 1072 CodeCreateEvent(Logger::KEYED_LOAD_MEGAMORPHIC_IC_TAG, *code, 0)); |
| 1073 VTUNEJIT(AddCode("KEYED_LD_MEGAMORPHIC_IC", code)); |
| 1072 return code; | 1074 return code; |
| 1073 } | 1075 } |
| 1074 | 1076 |
| 1075 | 1077 |
| 1076 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { | 1078 static Handle<Object> TryConvertKey(Handle<Object> key, Isolate* isolate) { |
| 1077 // This helper implements a few common fast cases for converting | 1079 // This helper implements a few common fast cases for converting |
| 1078 // non-smi keys of keyed loads/stores to a smi or a string. | 1080 // non-smi keys of keyed loads/stores to a smi or a string. |
| 1079 if (key->IsHeapNumber()) { | 1081 if (key->IsHeapNumber()) { |
| 1080 double value = Handle<HeapNumber>::cast(key)->value(); | 1082 double value = Handle<HeapNumber>::cast(key)->value(); |
| 1081 if (isnan(value)) { | 1083 if (isnan(value)) { |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 ASSERT(!cached_stub.is_null()); | 1790 ASSERT(!cached_stub.is_null()); |
| 1789 handler_ics.Add(cached_stub); | 1791 handler_ics.Add(cached_stub); |
| 1790 transitioned_maps.Add(transitioned_map); | 1792 transitioned_maps.Add(transitioned_map); |
| 1791 } | 1793 } |
| 1792 KeyedStoreStubCompiler compiler(isolate(), strict_mode, grow_mode); | 1794 KeyedStoreStubCompiler compiler(isolate(), strict_mode, grow_mode); |
| 1793 Handle<Code> code = compiler.CompileStorePolymorphic( | 1795 Handle<Code> code = compiler.CompileStorePolymorphic( |
| 1794 receiver_maps, &handler_ics, &transitioned_maps); | 1796 receiver_maps, &handler_ics, &transitioned_maps); |
| 1795 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); | 1797 isolate()->counters()->keyed_store_polymorphic_stubs()->Increment(); |
| 1796 PROFILE(isolate(), | 1798 PROFILE(isolate(), |
| 1797 CodeCreateEvent(Logger::KEYED_STORE_MEGAMORPHIC_IC_TAG, *code, 0)); | 1799 CodeCreateEvent(Logger::KEYED_STORE_MEGAMORPHIC_IC_TAG, *code, 0)); |
| 1800 VTUNEJIT(AddCode("KEYED_STORE_MEGAMORPHIC_IC", code)); |
| 1798 return code; | 1801 return code; |
| 1799 } | 1802 } |
| 1800 | 1803 |
| 1801 | 1804 |
| 1802 KeyedIC::StubKind KeyedStoreIC::GetStubKind(Handle<JSObject> receiver, | 1805 KeyedIC::StubKind KeyedStoreIC::GetStubKind(Handle<JSObject> receiver, |
| 1803 Handle<Object> key, | 1806 Handle<Object> key, |
| 1804 Handle<Object> value) { | 1807 Handle<Object> value) { |
| 1805 ASSERT(key->IsSmi()); | 1808 ASSERT(key->IsSmi()); |
| 1806 int index = Smi::cast(*key)->value(); | 1809 int index = Smi::cast(*key)->value(); |
| 1807 bool allow_growth = receiver->IsJSArray() && | 1810 bool allow_growth = receiver->IsJSArray() && |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 #undef ADDR | 2699 #undef ADDR |
| 2697 }; | 2700 }; |
| 2698 | 2701 |
| 2699 | 2702 |
| 2700 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2703 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2701 return IC_utilities[id]; | 2704 return IC_utilities[id]; |
| 2702 } | 2705 } |
| 2703 | 2706 |
| 2704 | 2707 |
| 2705 } } // namespace v8::internal | 2708 } } // namespace v8::internal |
| OLD | NEW |