| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 constant_pool); | 594 constant_pool); |
| 595 } | 595 } |
| 596 | 596 |
| 597 | 597 |
| 598 void CompareIC::Clear(Isolate* isolate, Address address, Code* target, | 598 void CompareIC::Clear(Isolate* isolate, Address address, Code* target, |
| 599 ConstantPoolArray* constant_pool) { | 599 ConstantPoolArray* constant_pool) { |
| 600 DCHECK(CodeStub::GetMajorKey(target) == CodeStub::CompareIC); | 600 DCHECK(CodeStub::GetMajorKey(target) == CodeStub::CompareIC); |
| 601 CompareICStub stub(target->stub_key(), isolate); | 601 CompareICStub stub(target->stub_key(), isolate); |
| 602 // Only clear CompareICs that can retain objects. | 602 // Only clear CompareICs that can retain objects. |
| 603 if (stub.state() != CompareICState::KNOWN_OBJECT) return; | 603 if (stub.state() != CompareICState::KNOWN_OBJECT) return; |
| 604 SetTargetAtAddress(address, GetRawUninitialized(isolate, stub.op()), | 604 SetTargetAtAddress(address, |
| 605 GetRawUninitialized(isolate, stub.op(), stub.strong()), |
| 605 constant_pool); | 606 constant_pool); |
| 606 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); | 607 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); |
| 607 } | 608 } |
| 608 | 609 |
| 609 | 610 |
| 610 // static | 611 // static |
| 611 Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate) { | 612 Handle<Code> KeyedLoadIC::ChooseMegamorphicStub(Isolate* isolate) { |
| 612 if (FLAG_compiled_keyed_generic_loads) { | 613 if (FLAG_compiled_keyed_generic_loads) { |
| 613 return KeyedLoadGenericStub(isolate).GetCode(); | 614 return KeyedLoadGenericStub(isolate).GetCode(); |
| 614 } else { | 615 } else { |
| (...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2673 Handle<Object> right = | 2674 Handle<Object> right = |
| 2674 args.at<Object>(BinaryOpWithAllocationSiteStub::kRight); | 2675 args.at<Object>(BinaryOpWithAllocationSiteStub::kRight); |
| 2675 BinaryOpIC ic(isolate); | 2676 BinaryOpIC ic(isolate); |
| 2676 Handle<Object> result; | 2677 Handle<Object> result; |
| 2677 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2678 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 2678 isolate, result, ic.Transition(allocation_site, left, right)); | 2679 isolate, result, ic.Transition(allocation_site, left, right)); |
| 2679 return *result; | 2680 return *result; |
| 2680 } | 2681 } |
| 2681 | 2682 |
| 2682 | 2683 |
| 2683 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op) { | 2684 Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op, |
| 2684 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED, | 2685 bool strong) { |
| 2686 CompareICStub stub(isolate, op, strong, CompareICState::UNINITIALIZED, |
| 2685 CompareICState::UNINITIALIZED, | 2687 CompareICState::UNINITIALIZED, |
| 2686 CompareICState::UNINITIALIZED); | 2688 CompareICState::UNINITIALIZED); |
| 2687 Code* code = NULL; | 2689 Code* code = NULL; |
| 2688 CHECK(stub.FindCodeInCache(&code)); | 2690 CHECK(stub.FindCodeInCache(&code)); |
| 2689 return code; | 2691 return code; |
| 2690 } | 2692 } |
| 2691 | 2693 |
| 2692 | 2694 |
| 2693 Handle<Code> CompareIC::GetUninitialized(Isolate* isolate, Token::Value op) { | 2695 Handle<Code> CompareIC::GetUninitialized(Isolate* isolate, Token::Value op, |
| 2694 CompareICStub stub(isolate, op, CompareICState::UNINITIALIZED, | 2696 bool strong) { |
| 2697 CompareICStub stub(isolate, op, strong, CompareICState::UNINITIALIZED, |
| 2695 CompareICState::UNINITIALIZED, | 2698 CompareICState::UNINITIALIZED, |
| 2696 CompareICState::UNINITIALIZED); | 2699 CompareICState::UNINITIALIZED); |
| 2697 return stub.GetCode(); | 2700 return stub.GetCode(); |
| 2698 } | 2701 } |
| 2699 | 2702 |
| 2700 | 2703 |
| 2701 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { | 2704 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { |
| 2702 HandleScope scope(isolate()); | 2705 HandleScope scope(isolate()); |
| 2703 CompareICStub old_stub(target()->stub_key(), isolate()); | 2706 CompareICStub old_stub(target()->stub_key(), isolate()); |
| 2704 CompareICState::State new_left = | 2707 CompareICState::State new_left = |
| 2705 CompareICState::NewInputState(old_stub.left(), x); | 2708 CompareICState::NewInputState(old_stub.left(), x); |
| 2706 CompareICState::State new_right = | 2709 CompareICState::State new_right = |
| 2707 CompareICState::NewInputState(old_stub.right(), y); | 2710 CompareICState::NewInputState(old_stub.right(), y); |
| 2708 CompareICState::State state = CompareICState::TargetState( | 2711 CompareICState::State state = CompareICState::TargetState( |
| 2709 old_stub.state(), old_stub.left(), old_stub.right(), op_, | 2712 old_stub.state(), old_stub.left(), old_stub.right(), op_, |
| 2710 HasInlinedSmiCode(address()), x, y); | 2713 HasInlinedSmiCode(address()), x, y); |
| 2711 CompareICStub stub(isolate(), op_, new_left, new_right, state); | 2714 CompareICStub stub(isolate(), op_, old_stub.strong(), new_left, new_right, |
| 2715 state); |
| 2712 if (state == CompareICState::KNOWN_OBJECT) { | 2716 if (state == CompareICState::KNOWN_OBJECT) { |
| 2713 stub.set_known_map( | 2717 stub.set_known_map( |
| 2714 Handle<Map>(Handle<JSObject>::cast(x)->map(), isolate())); | 2718 Handle<Map>(Handle<JSObject>::cast(x)->map(), isolate())); |
| 2715 } | 2719 } |
| 2716 Handle<Code> new_target = stub.GetCode(); | 2720 Handle<Code> new_target = stub.GetCode(); |
| 2717 set_target(*new_target); | 2721 set_target(*new_target); |
| 2718 | 2722 |
| 2719 if (FLAG_trace_ic) { | 2723 if (FLAG_trace_ic) { |
| 2720 PrintF("[CompareIC in "); | 2724 PrintF("[CompareIC in "); |
| 2721 JavaScriptFrame::PrintTop(isolate(), stdout, false, true); | 2725 JavaScriptFrame::PrintTop(isolate(), stdout, false, true); |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3052 static const Address IC_utilities[] = { | 3056 static const Address IC_utilities[] = { |
| 3053 #define ADDR(name) FUNCTION_ADDR(name), | 3057 #define ADDR(name) FUNCTION_ADDR(name), |
| 3054 IC_UTIL_LIST(ADDR) NULL | 3058 IC_UTIL_LIST(ADDR) NULL |
| 3055 #undef ADDR | 3059 #undef ADDR |
| 3056 }; | 3060 }; |
| 3057 | 3061 |
| 3058 | 3062 |
| 3059 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } | 3063 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } |
| 3060 } | 3064 } |
| 3061 } // namespace v8::internal | 3065 } // namespace v8::internal |
| OLD | NEW |