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

Side by Side Diff: src/ic/ic.cc

Issue 542613003: Introduce code stub constructors for stub keys. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: define MajorKey inline Created 6 years, 3 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/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 SetTargetAtAddress( 542 SetTargetAtAddress(
543 address, *pre_monomorphic_stub( 543 address, *pre_monomorphic_stub(
544 isolate, StoreIC::GetStrictMode(target->extra_ic_state())), 544 isolate, StoreIC::GetStrictMode(target->extra_ic_state())),
545 constant_pool); 545 constant_pool);
546 } 546 }
547 547
548 548
549 void CompareIC::Clear(Isolate* isolate, Address address, Code* target, 549 void CompareIC::Clear(Isolate* isolate, Address address, Code* target,
550 ConstantPoolArray* constant_pool) { 550 ConstantPoolArray* constant_pool) {
551 DCHECK(CodeStub::GetMajorKey(target) == CodeStub::CompareIC); 551 DCHECK(CodeStub::GetMajorKey(target) == CodeStub::CompareIC);
552 CompareICStub stub(target->stub_key()); 552 CompareICStub stub(target->stub_key(), isolate);
553 // Only clear CompareICs that can retain objects. 553 // Only clear CompareICs that can retain objects.
554 if (stub.state() != KNOWN_OBJECT) return; 554 if (stub.state() != KNOWN_OBJECT) return;
555 SetTargetAtAddress(address, GetRawUninitialized(isolate, stub.op()), 555 SetTargetAtAddress(address, GetRawUninitialized(isolate, stub.op()),
556 constant_pool); 556 constant_pool);
557 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); 557 PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK);
558 } 558 }
559 559
560 560
561 // static 561 // static
562 Handle<Code> KeyedLoadIC::generic_stub(Isolate* isolate) { 562 Handle<Code> KeyedLoadIC::generic_stub(Isolate* isolate) {
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2739 return Type::Any(zone); 2739 return Type::Any(zone);
2740 } 2740 }
2741 UNREACHABLE(); 2741 UNREACHABLE();
2742 return NULL; 2742 return NULL;
2743 } 2743 }
2744 2744
2745 2745
2746 void CompareIC::StubInfoToType(uint32_t stub_key, Type** left_type, 2746 void CompareIC::StubInfoToType(uint32_t stub_key, Type** left_type,
2747 Type** right_type, Type** overall_type, 2747 Type** right_type, Type** overall_type,
2748 Handle<Map> map, Zone* zone) { 2748 Handle<Map> map, Zone* zone) {
2749 CompareICStub stub(stub_key); 2749 CompareICStub stub(stub_key, map->GetIsolate());
2750 *left_type = StateToType(zone, stub.left()); 2750 *left_type = StateToType(zone, stub.left());
2751 *right_type = StateToType(zone, stub.right()); 2751 *right_type = StateToType(zone, stub.right());
2752 *overall_type = StateToType(zone, stub.state(), map); 2752 *overall_type = StateToType(zone, stub.state(), map);
2753 } 2753 }
2754 2754
2755 2755
2756 CompareIC::State CompareIC::NewInputState(State old_state, 2756 CompareIC::State CompareIC::NewInputState(State old_state,
2757 Handle<Object> value) { 2757 Handle<Object> value) {
2758 switch (old_state) { 2758 switch (old_state) {
2759 case UNINITIALIZED: 2759 case UNINITIALIZED:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 case GENERIC: 2852 case GENERIC:
2853 return GENERIC; 2853 return GENERIC;
2854 } 2854 }
2855 UNREACHABLE(); 2855 UNREACHABLE();
2856 return GENERIC; // Make the compiler happy. 2856 return GENERIC; // Make the compiler happy.
2857 } 2857 }
2858 2858
2859 2859
2860 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) { 2860 Code* CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
2861 HandleScope scope(isolate()); 2861 HandleScope scope(isolate());
2862 CompareICStub old_stub(target()->stub_key()); 2862 CompareICStub old_stub(target()->stub_key(), isolate());
2863 State new_left = NewInputState(old_stub.left(), x); 2863 State new_left = NewInputState(old_stub.left(), x);
2864 State new_right = NewInputState(old_stub.right(), y); 2864 State new_right = NewInputState(old_stub.right(), y);
2865 State state = TargetState(old_stub.state(), old_stub.left(), old_stub.right(), 2865 State state = TargetState(old_stub.state(), old_stub.left(), old_stub.right(),
2866 HasInlinedSmiCode(address()), x, y); 2866 HasInlinedSmiCode(address()), x, y);
2867 CompareICStub stub(isolate(), op_, new_left, new_right, state); 2867 CompareICStub stub(isolate(), op_, new_left, new_right, state);
2868 if (state == KNOWN_OBJECT) { 2868 if (state == KNOWN_OBJECT) {
2869 stub.set_known_map( 2869 stub.set_known_map(
2870 Handle<Map>(Handle<JSObject>::cast(x)->map(), isolate())); 2870 Handle<Map>(Handle<JSObject>::cast(x)->map(), isolate()));
2871 } 2871 }
2872 Handle<Code> new_target = stub.GetCode(); 2872 Handle<Code> new_target = stub.GetCode();
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3199 static const Address IC_utilities[] = { 3199 static const Address IC_utilities[] = {
3200 #define ADDR(name) FUNCTION_ADDR(name), 3200 #define ADDR(name) FUNCTION_ADDR(name),
3201 IC_UTIL_LIST(ADDR) NULL 3201 IC_UTIL_LIST(ADDR) NULL
3202 #undef ADDR 3202 #undef ADDR
3203 }; 3203 };
3204 3204
3205 3205
3206 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; } 3206 Address IC::AddressFromUtilityId(IC::UtilityId id) { return IC_utilities[id]; }
3207 } 3207 }
3208 } // namespace v8::internal 3208 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/objects.cc » ('j') | test/cctest/test-code-stubs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698