OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // computed from the original code - not the patched code. Let | 51 // computed from the original code - not the patched code. Let |
52 // these cases fall through to the unreachable code below. | 52 // these cases fall through to the unreachable code below. |
53 case DEBUG_BREAK: break; | 53 case DEBUG_BREAK: break; |
54 case DEBUG_PREPARE_STEP_IN: break; | 54 case DEBUG_PREPARE_STEP_IN: break; |
55 } | 55 } |
56 UNREACHABLE(); | 56 UNREACHABLE(); |
57 return 0; | 57 return 0; |
58 } | 58 } |
59 | 59 |
60 void IC::TraceIC(const char* type, | 60 void IC::TraceIC(const char* type, |
61 Handle<String> name, | 61 Handle<Object> name, |
62 State old_state, | 62 State old_state, |
63 Code* new_target, | 63 Code* new_target, |
64 const char* extra_info) { | 64 const char* extra_info) { |
65 if (FLAG_trace_ic) { | 65 if (FLAG_trace_ic) { |
66 State new_state = StateFrom(new_target, | 66 State new_state = StateFrom(new_target, |
67 Heap::undefined_value(), | 67 Heap::undefined_value(), |
68 Heap::undefined_value()); | 68 Heap::undefined_value()); |
69 PrintF("[%s (%c->%c)%s", type, | 69 PrintF("[%s (%c->%c)%s", type, |
70 TransitionMarkFromState(old_state), | 70 TransitionMarkFromState(old_state), |
71 TransitionMarkFromState(new_state), | 71 TransitionMarkFromState(new_state), |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 if (key->IsSymbol()) { | 603 if (key->IsSymbol()) { |
604 return CallICBase::LoadFunction(state, object, Handle<String>::cast(key)); | 604 return CallICBase::LoadFunction(state, object, Handle<String>::cast(key)); |
605 } | 605 } |
606 | 606 |
607 if (object->IsUndefined() || object->IsNull()) { | 607 if (object->IsUndefined() || object->IsNull()) { |
608 return TypeError("non_object_property_call", object, key); | 608 return TypeError("non_object_property_call", object, key); |
609 } | 609 } |
610 | 610 |
611 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { | 611 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { |
612 ReceiverToObject(object); | 612 ReceiverToObject(object); |
613 } else { | 613 } |
614 if (FLAG_use_ic && state != MEGAMORPHIC && !object->IsAccessCheckNeeded()) { | 614 |
615 int argc = target()->arguments_count(); | 615 if (FLAG_use_ic && state != MEGAMORPHIC && !object->IsAccessCheckNeeded()) { |
616 InLoopFlag in_loop = target()->ic_in_loop(); | 616 int argc = target()->arguments_count(); |
617 Object* code = StubCache::ComputeCallMegamorphic( | 617 InLoopFlag in_loop = target()->ic_in_loop(); |
618 argc, in_loop, Code::KEYED_CALL_IC); | 618 Object* code = StubCache::ComputeCallMegamorphic( |
619 if (!code->IsFailure()) { | 619 argc, in_loop, Code::KEYED_CALL_IC); |
620 set_target(Code::cast(code)); | 620 if (!code->IsFailure()) { |
621 } | 621 set_target(Code::cast(code)); |
| 622 #ifdef DEBUG |
| 623 TraceIC( |
| 624 "KeyedCallIC", key, state, target(), in_loop ? " (in-loop)" : ""); |
| 625 #endif |
622 } | 626 } |
623 } | 627 } |
624 Object* result = Runtime::GetObjectProperty(object, key); | 628 Object* result = Runtime::GetObjectProperty(object, key); |
625 if (result->IsJSFunction()) return result; | 629 if (result->IsJSFunction()) return result; |
626 result = TryCallAsFunction(result); | 630 result = TryCallAsFunction(result); |
627 return result->IsJSFunction() ? | 631 return result->IsJSFunction() ? |
628 result : TypeError("property_not_function", object, key); | 632 result : TypeError("property_not_function", object, key); |
629 } | 633 } |
630 | 634 |
631 | 635 |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 #undef ADDR | 1590 #undef ADDR |
1587 }; | 1591 }; |
1588 | 1592 |
1589 | 1593 |
1590 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1594 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1591 return IC_utilities[id]; | 1595 return IC_utilities[id]; |
1592 } | 1596 } |
1593 | 1597 |
1594 | 1598 |
1595 } } // namespace v8::internal | 1599 } } // namespace v8::internal |
OLD | NEW |