| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 4787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4798 enter()->Bind(&receiver, &key); | 4798 enter()->Bind(&receiver, &key); |
| 4799 cgen->frame()->Push(&receiver); // First IC argument. | 4799 cgen->frame()->Push(&receiver); // First IC argument. |
| 4800 cgen->frame()->Push(&key); // Second IC argument. | 4800 cgen->frame()->Push(&key); // Second IC argument. |
| 4801 | 4801 |
| 4802 // Calculate the delta from the IC call instruction to the map check | 4802 // Calculate the delta from the IC call instruction to the map check |
| 4803 // cmp instruction in the inlined version. This delta is stored in | 4803 // cmp instruction in the inlined version. This delta is stored in |
| 4804 // a test(eax, delta) instruction after the call so that we can find | 4804 // a test(eax, delta) instruction after the call so that we can find |
| 4805 // it in the IC initialization code and patch the cmp instruction. | 4805 // it in the IC initialization code and patch the cmp instruction. |
| 4806 // This means that we cannot allow test instructions after calls to | 4806 // This means that we cannot allow test instructions after calls to |
| 4807 // KeyedLoadIC stubs in other places. | 4807 // KeyedLoadIC stubs in other places. |
| 4808 // | |
| 4809 // The virtual frame should be spilled fully before the call so that | |
| 4810 // the call itself does not generate extra code to spill values, | |
| 4811 // which would invalidate the delta calculation. | |
| 4812 cgen->frame()->SpillAll(); | |
| 4813 int delta_to_patch_site = __ SizeOfCodeGeneratedSince(patch_site()); | |
| 4814 Result value(cgen); | 4808 Result value(cgen); |
| 4815 if (is_global_) { | 4809 if (is_global_) { |
| 4816 value = cgen->frame()->CallCodeObject(ic, | 4810 value = cgen->frame()->CallCodeObject(ic, |
| 4817 RelocInfo::CODE_TARGET_CONTEXT, | 4811 RelocInfo::CODE_TARGET_CONTEXT, |
| 4818 0); | 4812 0); |
| 4819 } else { | 4813 } else { |
| 4820 value = cgen->frame()->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); | 4814 value = cgen->frame()->CallCodeObject(ic, RelocInfo::CODE_TARGET, 0); |
| 4821 } | 4815 } |
| 4822 // The result needs to be specifically the eax register because the | 4816 // The result needs to be specifically the eax register because the |
| 4823 // offset to the patch site will be expected in a test eax | 4817 // offset to the patch site will be expected in a test eax |
| 4824 // instruction. | 4818 // instruction. |
| 4825 ASSERT(value.is_register() && value.reg().is(eax)); | 4819 ASSERT(value.is_register() && value.reg().is(eax)); |
| 4820 // The delta from the start of the map-compare instruction to the |
| 4821 // test eax instruction. |
| 4822 int delta_to_patch_site = __ SizeOfCodeGeneratedSince(patch_site()); |
| 4826 __ test(value.reg(), Immediate(-delta_to_patch_site)); | 4823 __ test(value.reg(), Immediate(-delta_to_patch_site)); |
| 4827 __ IncrementCounter(&Counters::keyed_load_inline_miss, 1); | 4824 __ IncrementCounter(&Counters::keyed_load_inline_miss, 1); |
| 4828 exit()->Jump(&value); | 4825 exit()->Jump(&value); |
| 4829 } | 4826 } |
| 4830 | 4827 |
| 4831 | 4828 |
| 4832 #undef __ | 4829 #undef __ |
| 4833 #define __ masm-> | 4830 #define __ masm-> |
| 4834 | 4831 |
| 4835 Handle<String> Reference::GetName() { | 4832 Handle<String> Reference::GetName() { |
| (...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6566 | 6563 |
| 6567 // Slow-case: Go through the JavaScript implementation. | 6564 // Slow-case: Go through the JavaScript implementation. |
| 6568 __ bind(&slow); | 6565 __ bind(&slow); |
| 6569 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 6566 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
| 6570 } | 6567 } |
| 6571 | 6568 |
| 6572 | 6569 |
| 6573 #undef __ | 6570 #undef __ |
| 6574 | 6571 |
| 6575 } } // namespace v8::internal | 6572 } } // namespace v8::internal |
| OLD | NEW |