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

Side by Side Diff: src/ic.cc

Issue 15302004: Convert ToBooleanStub to a HydrogenStub. Currently just using HBranch, which is still fully impleme… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix 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/isolate.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 2927 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 // Find or create the specialized stub to support the new set of types. 2938 // Find or create the specialized stub to support the new set of types.
2939 Handle<Code> code; 2939 Handle<Code> code;
2940 if (stub.IsMonomorphic()) { 2940 if (stub.IsMonomorphic()) {
2941 Handle<Map> monomorphic_map(already_monomorphic 2941 Handle<Map> monomorphic_map(already_monomorphic
2942 ? target()->FindFirstMap() 2942 ? target()->FindFirstMap()
2943 : HeapObject::cast(*object)->map()); 2943 : HeapObject::cast(*object)->map());
2944 code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub); 2944 code = isolate()->stub_cache()->ComputeCompareNil(monomorphic_map, stub);
2945 } else { 2945 } else {
2946 code = stub.GetCode(isolate()); 2946 code = stub.GetCode(isolate());
2947 } 2947 }
2948 2948 set_target(*code);
2949 patch(*code);
2950
2951 return DoCompareNilSlow(kind, nil, object); 2949 return DoCompareNilSlow(kind, nil, object);
2952 } 2950 }
2953 2951
2954 2952
2955 void CompareNilIC::patch(Code* code) {
2956 set_target(code);
2957 }
2958
2959
2960 RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) { 2953 RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss) {
2961 HandleScope scope(isolate); 2954 HandleScope scope(isolate);
2962 Handle<Object> object = args.at<Object>(0); 2955 Handle<Object> object = args.at<Object>(0);
2963 CompareNilIC ic(isolate); 2956 CompareNilIC ic(isolate);
2964 return ic.CompareNil(object); 2957 return ic.CompareNil(object);
2965 } 2958 }
2966 2959
2967 2960
2968 RUNTIME_FUNCTION(MaybeObject*, Unreachable) { 2961 RUNTIME_FUNCTION(MaybeObject*, Unreachable) {
2969 UNREACHABLE(); 2962 UNREACHABLE();
2970 CHECK(false); 2963 CHECK(false);
2971 return isolate->heap()->undefined_value(); 2964 return isolate->heap()->undefined_value();
2972 } 2965 }
2973 2966
2974 2967
2975 RUNTIME_FUNCTION(MaybeObject*, ToBoolean_Patch) { 2968 MaybeObject* ToBooleanIC::ToBoolean(Handle<Object> object,
2976 ASSERT(args.length() == 3); 2969 Code::ExtraICState extra_ic_state) {
2977 2970 ToBooleanStub stub(extra_ic_state);
2978 HandleScope scope(isolate); 2971 bool to_boolean_value = stub.Record(object);
2979 Handle<Object> object = args.at<Object>(0); 2972 Handle<Code> code = stub.GetCode(isolate());
2980 Register tos = Register::from_code(args.smi_at(1)); 2973 set_target(*code);
2981 ToBooleanStub::Types old_types(args.smi_at(2));
2982
2983 ToBooleanStub::Types new_types(old_types);
2984 bool to_boolean_value = new_types.Record(object);
2985 old_types.TraceTransition(new_types);
2986
2987 ToBooleanStub stub(tos, new_types);
2988 Handle<Code> code = stub.GetCode(isolate);
2989 ToBooleanIC ic(isolate);
2990 ic.patch(*code);
2991 return Smi::FromInt(to_boolean_value ? 1 : 0); 2974 return Smi::FromInt(to_boolean_value ? 1 : 0);
2992 } 2975 }
2993 2976
2994 2977
2995 void ToBooleanIC::patch(Code* code) { 2978 RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss) {
2996 set_target(code); 2979 ASSERT(args.length() == 1);
2980 HandleScope scope(isolate);
2981 Handle<Object> object = args.at<Object>(0);
2982 ToBooleanIC ic(isolate);
2983 Code::ExtraICState ic_state = ic.target()->extended_extra_ic_state();
2984 return ic.ToBoolean(object, ic_state);
2997 } 2985 }
2998 2986
2999 2987
3000 static const Address IC_utilities[] = { 2988 static const Address IC_utilities[] = {
3001 #define ADDR(name) FUNCTION_ADDR(name), 2989 #define ADDR(name) FUNCTION_ADDR(name),
3002 IC_UTIL_LIST(ADDR) 2990 IC_UTIL_LIST(ADDR)
3003 NULL 2991 NULL
3004 #undef ADDR 2992 #undef ADDR
3005 }; 2993 };
3006 2994
3007 2995
3008 Address IC::AddressFromUtilityId(IC::UtilityId id) { 2996 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3009 return IC_utilities[id]; 2997 return IC_utilities[id];
3010 } 2998 }
3011 2999
3012 3000
3013 } } // namespace v8::internal 3001 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698