| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 case Code::KEYED_LOAD_IC: | 303 case Code::KEYED_LOAD_IC: |
| 304 return KeyedLoadIC::Clear(address, target); | 304 return KeyedLoadIC::Clear(address, target); |
| 305 case Code::STORE_IC: return StoreIC::Clear(address, target); | 305 case Code::STORE_IC: return StoreIC::Clear(address, target); |
| 306 case Code::KEYED_STORE_IC: | 306 case Code::KEYED_STORE_IC: |
| 307 return KeyedStoreIC::Clear(address, target); | 307 return KeyedStoreIC::Clear(address, target); |
| 308 case Code::CALL_IC: return CallIC::Clear(address, target); | 308 case Code::CALL_IC: return CallIC::Clear(address, target); |
| 309 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); | 309 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); |
| 310 case Code::UNARY_OP_IC: | 310 case Code::UNARY_OP_IC: |
| 311 case Code::BINARY_OP_IC: | 311 case Code::BINARY_OP_IC: |
| 312 case Code::COMPARE_IC: | 312 case Code::COMPARE_IC: |
| 313 case Code::TO_BOOLEAN_IC: |
| 313 // Clearing these is tricky and does not | 314 // Clearing these is tricky and does not |
| 314 // make any performance difference. | 315 // make any performance difference. |
| 315 return; | 316 return; |
| 316 default: UNREACHABLE(); | 317 default: UNREACHABLE(); |
| 317 } | 318 } |
| 318 } | 319 } |
| 319 | 320 |
| 320 | 321 |
| 321 void CallICBase::Clear(Address address, Code* target) { | 322 void CallICBase::Clear(Address address, Code* target) { |
| 322 bool contextual = CallICBase::Contextual::decode(target->extra_ic_state()); | 323 bool contextual = CallICBase::Contextual::decode(target->extra_ic_state()); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 ReceiverToObjectIfRequired(result, object); | 837 ReceiverToObjectIfRequired(result, object); |
| 837 | 838 |
| 838 if (result->IsJSFunction()) return *result; | 839 if (result->IsJSFunction()) return *result; |
| 839 result = Handle<Object>(TryCallAsFunction(*result)); | 840 result = Handle<Object>(TryCallAsFunction(*result)); |
| 840 if (result->IsJSFunction()) return *result; | 841 if (result->IsJSFunction()) return *result; |
| 841 | 842 |
| 842 return TypeError("property_not_function", object, key); | 843 return TypeError("property_not_function", object, key); |
| 843 } | 844 } |
| 844 | 845 |
| 845 | 846 |
| 846 #ifdef DEBUG | |
| 847 #define TRACE_IC_NAMED(msg, name) \ | |
| 848 if (FLAG_trace_ic) PrintF(msg, *(name)->ToCString()) | |
| 849 #else | |
| 850 #define TRACE_IC_NAMED(msg, name) | |
| 851 #endif | |
| 852 | |
| 853 | |
| 854 MaybeObject* LoadIC::Load(State state, | 847 MaybeObject* LoadIC::Load(State state, |
| 855 Handle<Object> object, | 848 Handle<Object> object, |
| 856 Handle<String> name) { | 849 Handle<String> name) { |
| 857 // If the object is undefined or null it's illegal to try to get any | 850 // If the object is undefined or null it's illegal to try to get any |
| 858 // of its properties; throw a TypeError in that case. | 851 // of its properties; throw a TypeError in that case. |
| 859 if (object->IsUndefined() || object->IsNull()) { | 852 if (object->IsUndefined() || object->IsNull()) { |
| 860 return TypeError("non_object_property_load", object, name); | 853 return TypeError("non_object_property_load", object, name); |
| 861 } | 854 } |
| 862 | 855 |
| 863 if (FLAG_use_ic) { | 856 if (FLAG_use_ic) { |
| (...skipping 1636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2500 // Used from ic_<arch>.cc. | 2493 // Used from ic_<arch>.cc. |
| 2501 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { | 2494 RUNTIME_FUNCTION(Code*, CompareIC_Miss) { |
| 2502 NoHandleAllocation na; | 2495 NoHandleAllocation na; |
| 2503 ASSERT(args.length() == 3); | 2496 ASSERT(args.length() == 3); |
| 2504 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); | 2497 CompareIC ic(isolate, static_cast<Token::Value>(args.smi_at(2))); |
| 2505 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); | 2498 ic.UpdateCaches(args.at<Object>(0), args.at<Object>(1)); |
| 2506 return ic.target(); | 2499 return ic.target(); |
| 2507 } | 2500 } |
| 2508 | 2501 |
| 2509 | 2502 |
| 2503 RUNTIME_FUNCTION(MaybeObject*, ToBoolean_Patch) { |
| 2504 ASSERT(args.length() == 3); |
| 2505 |
| 2506 HandleScope scope(isolate); |
| 2507 Handle<Object> object = args.at<Object>(0); |
| 2508 Register tos = Register::from_code(args.smi_at(1)); |
| 2509 ToBooleanStub::Types old_types(args.smi_at(2)); |
| 2510 |
| 2511 ToBooleanStub::Types new_types(old_types); |
| 2512 bool to_boolean_value = new_types.Record(object); |
| 2513 old_types.TraceTransition(new_types); |
| 2514 |
| 2515 ToBooleanStub stub(tos, new_types); |
| 2516 Handle<Code> code = stub.GetCode(); |
| 2517 ToBooleanIC ic(isolate); |
| 2518 ic.patch(*code); |
| 2519 return Smi::FromInt(to_boolean_value ? 1 : 0); |
| 2520 } |
| 2521 |
| 2522 |
| 2523 void ToBooleanIC::patch(Code* code) { |
| 2524 set_target(code); |
| 2525 } |
| 2526 |
| 2527 |
| 2510 static const Address IC_utilities[] = { | 2528 static const Address IC_utilities[] = { |
| 2511 #define ADDR(name) FUNCTION_ADDR(name), | 2529 #define ADDR(name) FUNCTION_ADDR(name), |
| 2512 IC_UTIL_LIST(ADDR) | 2530 IC_UTIL_LIST(ADDR) |
| 2513 NULL | 2531 NULL |
| 2514 #undef ADDR | 2532 #undef ADDR |
| 2515 }; | 2533 }; |
| 2516 | 2534 |
| 2517 | 2535 |
| 2518 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2536 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2519 return IC_utilities[id]; | 2537 return IC_utilities[id]; |
| 2520 } | 2538 } |
| 2521 | 2539 |
| 2522 | 2540 |
| 2523 } } // namespace v8::internal | 2541 } } // namespace v8::internal |
| OLD | NEW |