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

Side by Side Diff: src/ic.cc

Issue 16732002: remove equality kind from compare nil ic (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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
« no previous file with comments | « src/ic.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED); 2936 CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED);
2937 stub.ClearTypes(); 2937 stub.ClearTypes();
2938 2938
2939 Code* code = NULL; 2939 Code* code = NULL;
2940 CHECK(stub.FindCodeInCache(&code, target->GetIsolate())); 2940 CHECK(stub.FindCodeInCache(&code, target->GetIsolate()));
2941 2941
2942 SetTargetAtAddress(address, code); 2942 SetTargetAtAddress(address, code);
2943 } 2943 }
2944 2944
2945 2945
2946 MaybeObject* CompareNilIC::DoCompareNilSlow(EqualityKind kind, 2946 MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil,
2947 NilValue nil,
2948 Handle<Object> object) { 2947 Handle<Object> object) {
2949 if (kind == kStrictEquality) {
2950 if (nil == kNullValue) {
2951 return Smi::FromInt(object->IsNull());
2952 } else {
2953 return Smi::FromInt(object->IsUndefined());
2954 }
2955 }
2956 if (object->IsNull() || object->IsUndefined()) { 2948 if (object->IsNull() || object->IsUndefined()) {
2957 return Smi::FromInt(true); 2949 return Smi::FromInt(true);
2958 } 2950 }
2959 return Smi::FromInt(object->IsUndetectableObject()); 2951 return Smi::FromInt(object->IsUndetectableObject());
2960 } 2952 }
2961 2953
2962 2954
2963 MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { 2955 MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) {
2964 Code::ExtraICState extra_ic_state = target()->extended_extra_ic_state(); 2956 Code::ExtraICState extra_ic_state = target()->extended_extra_ic_state();
2965 2957
2966 CompareNilICStub stub(extra_ic_state); 2958 CompareNilICStub stub(extra_ic_state);
2967 2959
2968 // Extract the current supported types from the patched IC and calculate what 2960 // Extract the current supported types from the patched IC and calculate what
2969 // types must be supported as a result of the miss. 2961 // types must be supported as a result of the miss.
2970 bool already_monomorphic = stub.IsMonomorphic(); 2962 bool already_monomorphic = stub.IsMonomorphic();
2971 2963
2972 CompareNilICStub::Types old_types = stub.GetTypes(); 2964 CompareNilICStub::Types old_types = stub.GetTypes();
2973 stub.Record(object); 2965 stub.Record(object);
2974 old_types.TraceTransition(stub.GetTypes()); 2966 old_types.TraceTransition(stub.GetTypes());
2975 2967
2976 EqualityKind kind = stub.GetKind();
2977 NilValue nil = stub.GetNilValue(); 2968 NilValue nil = stub.GetNilValue();
2978 2969
2979 // Find or create the specialized stub to support the new set of types. 2970 // Find or create the specialized stub to support the new set of types.
2980 Handle<Code> code; 2971 Handle<Code> code;
2981 if (stub.IsMonomorphic()) { 2972 if (stub.IsMonomorphic()) {
2982 Handle<Map> monomorphic_map(already_monomorphic 2973 Handle<Map> monomorphic_map(already_monomorphic
2983 ? target()->FindFirstMap() 2974 ? target()->FindFirstMap()
2984 : HeapObject::cast(*object)->map()); 2975 : HeapObject::cast(*object)->map());
2985 code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub); 2976 code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub);
2986 } else { 2977 } else {
2987 code = stub.GetCode(isolate()); 2978 code = stub.GetCode(isolate());
2988 } 2979 }
2989 set_target(*code); 2980 set_target(*code);
2990 return DoCompareNilSlow(kind, nil, object); 2981 return DoCompareNilSlow(nil, object);
2991 } 2982 }
2992 2983
2993 2984
2994 RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) { 2985 RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) {
2995 HandleScope scope(isolate); 2986 HandleScope scope(isolate);
2996 Handle<Object> object = args.at<Object>(0); 2987 Handle<Object> object = args.at<Object>(0);
2997 CompareNilIC ic(isolate); 2988 CompareNilIC ic(isolate);
2998 return ic.CompareNil(object); 2989 return ic.CompareNil(object);
2999 } 2990 }
3000 2991
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 #undef ADDR 3024 #undef ADDR
3034 }; 3025 };
3035 3026
3036 3027
3037 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3028 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3038 return IC_utilities[id]; 3029 return IC_utilities[id];
3039 } 3030 }
3040 3031
3041 3032
3042 } } // namespace v8::internal 3033 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698