| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 Builtins::kFunctionApply); | 84 Builtins::kFunctionApply); |
| 85 if (raw_frame->unchecked_code() == apply_builtin) { | 85 if (raw_frame->unchecked_code() == apply_builtin) { |
| 86 PrintF("apply from "); | 86 PrintF("apply from "); |
| 87 it.Advance(); | 87 it.Advance(); |
| 88 raw_frame = it.frame(); | 88 raw_frame = it.frame(); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 JavaScriptFrame::PrintTop(isolate(), stdout, false, true); | 91 JavaScriptFrame::PrintTop(isolate(), stdout, false, true); |
| 92 Code::ExtraICState extra_state = new_target->extra_ic_state(); | 92 Code::ExtraICState extra_state = new_target->extra_ic_state(); |
| 93 const char* modifier = | 93 const char* modifier = |
| 94 GetTransitionMarkModifier(Code::GetKeyedAccessStoreMode(extra_state)); | 94 GetTransitionMarkModifier( |
| 95 KeyedStoreIC::GetKeyedAccessStoreMode(extra_state)); |
| 95 PrintF(" (%c->%c%s)", | 96 PrintF(" (%c->%c%s)", |
| 96 TransitionMarkFromState(state()), | 97 TransitionMarkFromState(state()), |
| 97 TransitionMarkFromState(new_state), | 98 TransitionMarkFromState(new_state), |
| 98 modifier); | 99 modifier); |
| 99 name->Print(); | 100 name->Print(); |
| 100 PrintF("]\n"); | 101 PrintF("]\n"); |
| 101 } | 102 } |
| 102 } | 103 } |
| 103 | 104 |
| 104 #define TRACE_GENERIC_IC(isolate, type, reason) \ | 105 #define TRACE_GENERIC_IC(isolate, type, reason) \ |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 void LoadIC::Clear(Isolate* isolate, Address address, Code* target) { | 526 void LoadIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 526 if (IsCleared(target)) return; | 527 if (IsCleared(target)) return; |
| 527 SetTargetAtAddress(address, *pre_monomorphic_stub(isolate)); | 528 SetTargetAtAddress(address, *pre_monomorphic_stub(isolate)); |
| 528 } | 529 } |
| 529 | 530 |
| 530 | 531 |
| 531 void StoreIC::Clear(Isolate* isolate, Address address, Code* target) { | 532 void StoreIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 532 if (IsCleared(target)) return; | 533 if (IsCleared(target)) return; |
| 533 SetTargetAtAddress(address, | 534 SetTargetAtAddress(address, |
| 534 *pre_monomorphic_stub( | 535 *pre_monomorphic_stub( |
| 535 isolate, Code::GetStrictMode(target->extra_ic_state()))); | 536 isolate, StoreIC::GetStrictMode(target->extra_ic_state()))); |
| 536 } | 537 } |
| 537 | 538 |
| 538 | 539 |
| 539 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) { | 540 void KeyedStoreIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 540 if (IsCleared(target)) return; | 541 if (IsCleared(target)) return; |
| 541 SetTargetAtAddress(address, | 542 SetTargetAtAddress(address, |
| 542 *pre_monomorphic_stub( | 543 *pre_monomorphic_stub( |
| 543 isolate, Code::GetStrictMode(target->extra_ic_state()))); | 544 isolate, StoreIC::GetStrictMode(target->extra_ic_state()))); |
| 544 } | 545 } |
| 545 | 546 |
| 546 | 547 |
| 547 void CompareIC::Clear(Isolate* isolate, Address address, Code* target) { | 548 void CompareIC::Clear(Isolate* isolate, Address address, Code* target) { |
| 548 ASSERT(target->major_key() == CodeStub::CompareIC); | 549 ASSERT(target->major_key() == CodeStub::CompareIC); |
| 549 CompareIC::State handler_state; | 550 CompareIC::State handler_state; |
| 550 Token::Value op; | 551 Token::Value op; |
| 551 ICCompareStub::DecodeMinorKey(target->stub_info(), NULL, NULL, | 552 ICCompareStub::DecodeMinorKey(target->stub_info(), NULL, NULL, |
| 552 &handler_state, &op); | 553 &handler_state, &op); |
| 553 // Only clear CompareICs that can retain objects. | 554 // Only clear CompareICs that can retain objects. |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 ElementsKind kind = array->map()->elements_kind(); | 816 ElementsKind kind = array->map()->elements_kind(); |
| 816 if (IsFastObjectElementsKind(kind) && | 817 if (IsFastObjectElementsKind(kind) && |
| 817 array->map() == isolate()->get_initial_js_array_map(kind)) { | 818 array->map() == isolate()->get_initial_js_array_map(kind)) { |
| 818 KeyedArrayCallStub stub_gen(IsHoleyElementsKind(kind), argc); | 819 KeyedArrayCallStub stub_gen(IsHoleyElementsKind(kind), argc); |
| 819 stub = stub_gen.GetCode(isolate()); | 820 stub = stub_gen.GetCode(isolate()); |
| 820 } | 821 } |
| 821 } | 822 } |
| 822 | 823 |
| 823 if (stub.is_null()) { | 824 if (stub.is_null()) { |
| 824 stub = isolate()->stub_cache()->ComputeCallMegamorphic( | 825 stub = isolate()->stub_cache()->ComputeCallMegamorphic( |
| 825 argc, Code::KEYED_CALL_IC, Code::kNoExtraICState); | 826 argc, Code::KEYED_CALL_IC, IC::kNoExtraICState); |
| 826 if (object->IsJSObject()) { | 827 if (object->IsJSObject()) { |
| 827 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 828 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 828 if (receiver->elements()->map() == | 829 if (receiver->elements()->map() == |
| 829 isolate()->heap()->non_strict_arguments_elements_map()) { | 830 isolate()->heap()->non_strict_arguments_elements_map()) { |
| 830 stub = isolate()->stub_cache()->ComputeCallArguments(argc); | 831 stub = isolate()->stub_cache()->ComputeCallArguments(argc); |
| 831 } | 832 } |
| 832 } | 833 } |
| 833 ASSERT(!stub.is_null()); | 834 ASSERT(!stub.is_null()); |
| 834 } | 835 } |
| 835 set_target(*stub); | 836 set_target(*stub); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 if (map->instance_type() == ODDBALL_TYPE) return Type::Boolean(); | 1037 if (map->instance_type() == ODDBALL_TYPE) return Type::Boolean(); |
| 1037 return Type::Class(map); | 1038 return Type::Class(map); |
| 1038 } | 1039 } |
| 1039 | 1040 |
| 1040 | 1041 |
| 1041 void IC::UpdateMonomorphicIC(Handle<Type> type, | 1042 void IC::UpdateMonomorphicIC(Handle<Type> type, |
| 1042 Handle<Code> handler, | 1043 Handle<Code> handler, |
| 1043 Handle<String> name) { | 1044 Handle<String> name) { |
| 1044 if (!handler->is_handler()) return set_target(*handler); | 1045 if (!handler->is_handler()) return set_target(*handler); |
| 1045 Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicIC( | 1046 Handle<Code> ic = isolate()->stub_cache()->ComputeMonomorphicIC( |
| 1046 name, type, handler, strict_mode()); | 1047 name, type, handler, extra_ic_state()); |
| 1047 set_target(*ic); | 1048 set_target(*ic); |
| 1048 } | 1049 } |
| 1049 | 1050 |
| 1050 | 1051 |
| 1051 void IC::CopyICToMegamorphicCache(Handle<String> name) { | 1052 void IC::CopyICToMegamorphicCache(Handle<String> name) { |
| 1052 TypeHandleList types; | 1053 TypeHandleList types; |
| 1053 CodeHandleList handlers; | 1054 CodeHandleList handlers; |
| 1054 target()->FindAllTypes(&types); | 1055 target()->FindAllTypes(&types); |
| 1055 if (!target()->FindHandlers(&handlers, types.length())) return; | 1056 if (!target()->FindHandlers(&handlers, types.length())) return; |
| 1056 for (int i = 0; i < types.length(); i++) { | 1057 for (int i = 0; i < types.length(); i++) { |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1746 // stores into properties in dictionary mode), then there will be not | 1747 // stores into properties in dictionary mode), then there will be not |
| 1747 // receiver maps in the target. | 1748 // receiver maps in the target. |
| 1748 return generic_stub(); | 1749 return generic_stub(); |
| 1749 } | 1750 } |
| 1750 | 1751 |
| 1751 // There are several special cases where an IC that is MONOMORPHIC can still | 1752 // There are several special cases where an IC that is MONOMORPHIC can still |
| 1752 // transition to a different GetNonTransitioningStoreMode IC that handles a | 1753 // transition to a different GetNonTransitioningStoreMode IC that handles a |
| 1753 // superset of the original IC. Handle those here if the receiver map hasn't | 1754 // superset of the original IC. Handle those here if the receiver map hasn't |
| 1754 // changed or it has transitioned to a more general kind. | 1755 // changed or it has transitioned to a more general kind. |
| 1755 KeyedAccessStoreMode old_store_mode = | 1756 KeyedAccessStoreMode old_store_mode = |
| 1756 Code::GetKeyedAccessStoreMode(target()->extra_ic_state()); | 1757 KeyedStoreIC::GetKeyedAccessStoreMode(target()->extra_ic_state()); |
| 1757 Handle<Map> previous_receiver_map = target_receiver_maps.at(0); | 1758 Handle<Map> previous_receiver_map = target_receiver_maps.at(0); |
| 1758 if (state() == MONOMORPHIC) { | 1759 if (state() == MONOMORPHIC) { |
| 1759 // If the "old" and "new" maps are in the same elements map family, stay | 1760 // If the "old" and "new" maps are in the same elements map family, stay |
| 1760 // MONOMORPHIC and use the map for the most generic ElementsKind. | 1761 // MONOMORPHIC and use the map for the most generic ElementsKind. |
| 1761 Handle<Map> transitioned_receiver_map = receiver_map; | 1762 Handle<Map> transitioned_receiver_map = receiver_map; |
| 1762 if (IsTransitionStoreMode(store_mode)) { | 1763 if (IsTransitionStoreMode(store_mode)) { |
| 1763 transitioned_receiver_map = | 1764 transitioned_receiver_map = |
| 1764 ComputeTransitionedMap(receiver, store_mode); | 1765 ComputeTransitionedMap(receiver, store_mode); |
| 1765 } | 1766 } |
| 1766 if (IsTransitionOfMonomorphicTarget(MapToType(transitioned_receiver_map))) { | 1767 if (IsTransitionOfMonomorphicTarget(MapToType(transitioned_receiver_map))) { |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2767 #undef ADDR | 2768 #undef ADDR |
| 2768 }; | 2769 }; |
| 2769 | 2770 |
| 2770 | 2771 |
| 2771 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2772 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2772 return IC_utilities[id]; | 2773 return IC_utilities[id]; |
| 2773 } | 2774 } |
| 2774 | 2775 |
| 2775 | 2776 |
| 2776 } } // namespace v8::internal | 2777 } } // namespace v8::internal |
| OLD | NEW |