Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: src/ic.cc

Issue 409613002: Store both major and minor key on code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/codegen.h" 10 #include "src/codegen.h"
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 *pre_monomorphic_stub( 507 *pre_monomorphic_stub(
508 isolate, StoreIC::GetStrictMode(target->extra_ic_state())), 508 isolate, StoreIC::GetStrictMode(target->extra_ic_state())),
509 constant_pool); 509 constant_pool);
510 } 510 }
511 511
512 512
513 void CompareIC::Clear(Isolate* isolate, 513 void CompareIC::Clear(Isolate* isolate,
514 Address address, 514 Address address,
515 Code* target, 515 Code* target,
516 ConstantPoolArray* constant_pool) { 516 ConstantPoolArray* constant_pool) {
517 ASSERT(target->major_key() == CodeStub::CompareIC); 517 ASSERT(CodeStub::GetMajorKey(target) == CodeStub::CompareIC);
518 CompareIC::State handler_state; 518 CompareIC::State handler_state;
519 Token::Value op; 519 Token::Value op;
520 ICCompareStub::DecodeMinorKey(target->stub_info(), NULL, NULL, 520 ICCompareStub::DecodeKey(target->stub_key(), NULL, NULL, &handler_state, &op);
521 &handler_state, &op);
522 // Only clear CompareICs that can retain objects. 521 // Only clear CompareICs that can retain objects.
523 if (handler_state != KNOWN_OBJECT) return; 522 if (handler_state != KNOWN_OBJECT) return;
524 SetTargetAtAddress(address, GetRawUninitialized(isolate, op), constant_pool); 523 SetTargetAtAddress(address, GetRawUninitialized(isolate, op), constant_pool);
525 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); 524 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
526 } 525 }
527 526
528 527
529 Handle<Code> KeyedLoadIC::megamorphic_stub() { 528 Handle<Code> KeyedLoadIC::megamorphic_stub() {
530 if (FLAG_compiled_keyed_generic_loads) { 529 if (FLAG_compiled_keyed_generic_loads) {
531 return KeyedLoadGenericElementStub(isolate()).GetCode(); 530 return KeyedLoadGenericElementStub(isolate()).GetCode();
(...skipping 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2749 case CompareIC::OBJECT: return Type::Receiver(zone); 2748 case CompareIC::OBJECT: return Type::Receiver(zone);
2750 case CompareIC::KNOWN_OBJECT: 2749 case CompareIC::KNOWN_OBJECT:
2751 return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone); 2750 return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone);
2752 case CompareIC::GENERIC: return Type::Any(zone); 2751 case CompareIC::GENERIC: return Type::Any(zone);
2753 } 2752 }
2754 UNREACHABLE(); 2753 UNREACHABLE();
2755 return NULL; 2754 return NULL;
2756 } 2755 }
2757 2756
2758 2757
2759 void CompareIC::StubInfoToType(int stub_minor_key, 2758 void CompareIC::StubInfoToType(uint32_t stub_key, Type** left_type,
2760 Type** left_type, 2759 Type** right_type, Type** overall_type,
2761 Type** right_type, 2760 Handle<Map> map, Zone* zone) {
2762 Type** overall_type,
2763 Handle<Map> map,
2764 Zone* zone) {
2765 State left_state, right_state, handler_state; 2761 State left_state, right_state, handler_state;
2766 ICCompareStub::DecodeMinorKey(stub_minor_key, &left_state, &right_state, 2762 ICCompareStub::DecodeKey(stub_key, &left_state, &right_state, &handler_state,
2767 &handler_state, NULL); 2763 NULL);
2768 *left_type = StateToType(zone, left_state); 2764 *left_type = StateToType(zone, left_state);
2769 *right_type = StateToType(zone, right_state); 2765 *right_type = StateToType(zone, right_state);
2770 *overall_type = StateToType(zone, handler_state, map); 2766 *overall_type = StateToType(zone, handler_state, map);
2771 } 2767 }
2772 2768
2773 2769
2774 CompareIC::State CompareIC::NewInputState(State old_state, 2770 CompareIC::State CompareIC::NewInputState(State old_state,
2775 Handle<Object> value) { 2771 Handle<Object> value) {
2776 switch (old_state) { 2772 switch (old_state) {
2777 case UNINITIALIZED: 2773 case UNINITIALIZED:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 return GENERIC; 2869 return GENERIC;
2874 } 2870 }
2875 UNREACHABLE(); 2871 UNREACHABLE();
2876 return GENERIC; // Make the compiler happy. 2872 return GENERIC; // Make the compiler happy.
2877 } 2873 }
2878 2874
2879 2875
2880 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 2876 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2881 HandleScope scope(isolate()); 2877 HandleScope scope(isolate());
2882 State previous_left, previous_right, previous_state; 2878 State previous_left, previous_right, previous_state;
2883 ICCompareStub::DecodeMinorKey(target()->stub_info(), &previous_left, 2879 ICCompareStub::DecodeKey(target()->stub_key(), &previous_left,
2884 &previous_right, &previous_state, NULL); 2880 &previous_right, &previous_state, NULL);
2885 State new_left = NewInputState(previous_left, x); 2881 State new_left = NewInputState(previous_left, x);
2886 State new_right = NewInputState(previous_right, y); 2882 State new_right = NewInputState(previous_right, y);
2887 State state = TargetState(previous_state, previous_left, previous_right, 2883 State state = TargetState(previous_state, previous_left, previous_right,
2888 HasInlinedSmiCode(address()), x, y); 2884 HasInlinedSmiCode(address()), x, y);
2889 ICCompareStub stub(isolate(), op_, new_left, new_right, state); 2885 ICCompareStub stub(isolate(), op_, new_left, new_right, state);
2890 if (state == KNOWN_OBJECT) { 2886 if (state == KNOWN_OBJECT) {
2891 stub.set_known_map( 2887 stub.set_known_map(
2892 Handle<Map>(Handle<JSObject>::cast(x)->map(), isolate())); 2888 Handle<Map>(Handle<JSObject>::cast(x)->map(), isolate()));
2893 } 2889 }
2894 Handle<Code> new_target = stub.GetCode(); 2890 Handle<Code> new_target = stub.GetCode();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 #undef ADDR 3062 #undef ADDR
3067 }; 3063 };
3068 3064
3069 3065
3070 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3066 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3071 return IC_utilities[id]; 3067 return IC_utilities[id];
3072 } 3068 }
3073 3069
3074 3070
3075 } } // namespace v8::internal 3071 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698