Chromium Code Reviews| 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 2954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2965 } | 2965 } |
| 2966 | 2966 |
| 2967 | 2967 |
| 2968 RUNTIME_FUNCTION(MaybeObject*, Unreachable) { | 2968 RUNTIME_FUNCTION(MaybeObject*, Unreachable) { |
| 2969 UNREACHABLE(); | 2969 UNREACHABLE(); |
| 2970 CHECK(false); | 2970 CHECK(false); |
| 2971 return isolate->heap()->undefined_value(); | 2971 return isolate->heap()->undefined_value(); |
| 2972 } | 2972 } |
| 2973 | 2973 |
| 2974 | 2974 |
| 2975 RUNTIME_FUNCTION(MaybeObject*, ToBoolean_Patch) { | 2975 MaybeObject* ToBooleanIC::ToBoolean(Handle<Object> object, |
| 2976 ASSERT(args.length() == 3); | 2976 Code::ExtraICState extra_ic_state) { |
| 2977 | 2977 ToBooleanStub stub(extra_ic_state); |
| 2978 HandleScope scope(isolate); | 2978 bool to_boolean_value = stub.Record(object); |
| 2979 Handle<Object> object = args.at<Object>(0); | 2979 Handle<Code> code = stub.GetCode(isolate()); |
| 2980 Register tos = Register::from_code(args.smi_at(1)); | 2980 patch(*code); |
|
Toon Verwaest
2013/05/28 09:33:32
Just directly use set_target and remove patch.
| |
| 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); | 2981 return Smi::FromInt(to_boolean_value ? 1 : 0); |
| 2992 } | 2982 } |
| 2993 | 2983 |
| 2994 | 2984 |
| 2985 RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss) { | |
| 2986 ASSERT(args.length() == 1); | |
| 2987 HandleScope scope(isolate); | |
| 2988 Handle<Object> object = args.at<Object>(0); | |
| 2989 ToBooleanIC ic(isolate); | |
| 2990 Code::ExtraICState ic_state = ic.target()->extended_extra_ic_state(); | |
| 2991 return ic.ToBoolean(object, ic_state); | |
| 2992 } | |
| 2993 | |
| 2994 | |
| 2995 void ToBooleanIC::patch(Code* code) { | 2995 void ToBooleanIC::patch(Code* code) { |
| 2996 set_target(code); | 2996 set_target(code); |
| 2997 } | 2997 } |
| 2998 | 2998 |
| 2999 | 2999 |
| 3000 static const Address IC_utilities[] = { | 3000 static const Address IC_utilities[] = { |
| 3001 #define ADDR(name) FUNCTION_ADDR(name), | 3001 #define ADDR(name) FUNCTION_ADDR(name), |
| 3002 IC_UTIL_LIST(ADDR) | 3002 IC_UTIL_LIST(ADDR) |
| 3003 NULL | 3003 NULL |
| 3004 #undef ADDR | 3004 #undef ADDR |
| 3005 }; | 3005 }; |
| 3006 | 3006 |
| 3007 | 3007 |
| 3008 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3008 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3009 return IC_utilities[id]; | 3009 return IC_utilities[id]; |
| 3010 } | 3010 } |
| 3011 | 3011 |
| 3012 | 3012 |
| 3013 } } // namespace v8::internal | 3013 } } // namespace v8::internal |
| OLD | NEW |