| 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 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2932 CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED); | 2932 CompareNilICStub stub(state, HydrogenCodeStub::UNINITIALIZED); |
| 2933 stub.ClearTypes(); | 2933 stub.ClearTypes(); |
| 2934 | 2934 |
| 2935 Code* code = NULL; | 2935 Code* code = NULL; |
| 2936 CHECK(stub.FindCodeInCache(&code, target->GetIsolate())); | 2936 CHECK(stub.FindCodeInCache(&code, target->GetIsolate())); |
| 2937 | 2937 |
| 2938 SetTargetAtAddress(address, code); | 2938 SetTargetAtAddress(address, code); |
| 2939 } | 2939 } |
| 2940 | 2940 |
| 2941 | 2941 |
| 2942 MaybeObject* CompareNilIC::DoCompareNilSlow(EqualityKind kind, | 2942 MaybeObject* CompareNilIC::DoCompareNilSlow(NilValue nil, |
| 2943 NilValue nil, | |
| 2944 Handle<Object> object) { | 2943 Handle<Object> object) { |
| 2945 if (kind == kStrictEquality) { | |
| 2946 if (nil == kNullValue) { | |
| 2947 return Smi::FromInt(object->IsNull()); | |
| 2948 } else { | |
| 2949 return Smi::FromInt(object->IsUndefined()); | |
| 2950 } | |
| 2951 } | |
| 2952 if (object->IsNull() || object->IsUndefined()) { | 2944 if (object->IsNull() || object->IsUndefined()) { |
| 2953 return Smi::FromInt(true); | 2945 return Smi::FromInt(true); |
| 2954 } | 2946 } |
| 2955 return Smi::FromInt(object->IsUndetectableObject()); | 2947 return Smi::FromInt(object->IsUndetectableObject()); |
| 2956 } | 2948 } |
| 2957 | 2949 |
| 2958 | 2950 |
| 2959 MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { | 2951 MaybeObject* CompareNilIC::CompareNil(Handle<Object> object) { |
| 2960 Code::ExtraICState extra_ic_state = target()->extended_extra_ic_state(); | 2952 Code::ExtraICState extra_ic_state = target()->extended_extra_ic_state(); |
| 2961 | 2953 |
| 2962 CompareNilICStub stub(extra_ic_state); | 2954 CompareNilICStub stub(extra_ic_state); |
| 2963 | 2955 |
| 2964 // Extract the current supported types from the patched IC and calculate what | 2956 // Extract the current supported types from the patched IC and calculate what |
| 2965 // types must be supported as a result of the miss. | 2957 // types must be supported as a result of the miss. |
| 2966 bool already_monomorphic = stub.IsMonomorphic(); | 2958 bool already_monomorphic = stub.IsMonomorphic(); |
| 2967 | 2959 |
| 2968 CompareNilICStub::Types old_types = stub.GetTypes(); | 2960 CompareNilICStub::Types old_types = stub.GetTypes(); |
| 2969 stub.Record(object); | 2961 stub.Record(object); |
| 2970 old_types.TraceTransition(stub.GetTypes()); | 2962 old_types.TraceTransition(stub.GetTypes()); |
| 2971 | 2963 |
| 2972 EqualityKind kind = stub.GetKind(); | |
| 2973 NilValue nil = stub.GetNilValue(); | 2964 NilValue nil = stub.GetNilValue(); |
| 2974 | 2965 |
| 2975 // Find or create the specialized stub to support the new set of types. | 2966 // Find or create the specialized stub to support the new set of types. |
| 2976 Handle<Code> code; | 2967 Handle<Code> code; |
| 2977 if (stub.IsMonomorphic()) { | 2968 if (stub.IsMonomorphic()) { |
| 2978 Handle<Map> monomorphic_map(already_monomorphic | 2969 Handle<Map> monomorphic_map(already_monomorphic |
| 2979 ? target()->FindFirstMap() | 2970 ? target()->FindFirstMap() |
| 2980 : HeapObject::cast(*object)->map()); | 2971 : HeapObject::cast(*object)->map()); |
| 2981 code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub); | 2972 code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub); |
| 2982 } else { | 2973 } else { |
| 2983 code = stub.GetCode(isolate()); | 2974 code = stub.GetCode(isolate()); |
| 2984 } | 2975 } |
| 2985 set_target(*code); | 2976 set_target(*code); |
| 2986 return DoCompareNilSlow(kind, nil, object); | 2977 return DoCompareNilSlow(nil, object); |
| 2987 } | 2978 } |
| 2988 | 2979 |
| 2989 | 2980 |
| 2990 RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) { | 2981 RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) { |
| 2991 HandleScope scope(isolate); | 2982 HandleScope scope(isolate); |
| 2992 Handle<Object> object = args.at<Object>(0); | 2983 Handle<Object> object = args.at<Object>(0); |
| 2993 CompareNilIC ic(isolate); | 2984 CompareNilIC ic(isolate); |
| 2994 return ic.CompareNil(object); | 2985 return ic.CompareNil(object); |
| 2995 } | 2986 } |
| 2996 | 2987 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3029 #undef ADDR | 3020 #undef ADDR |
| 3030 }; | 3021 }; |
| 3031 | 3022 |
| 3032 | 3023 |
| 3033 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3024 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3034 return IC_utilities[id]; | 3025 return IC_utilities[id]; |
| 3035 } | 3026 } |
| 3036 | 3027 |
| 3037 | 3028 |
| 3038 } } // namespace v8::internal | 3029 } } // namespace v8::internal |
| OLD | NEW |