OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 886 |
887 // Clear the dirty bits for the range of elements in | 887 // Clear the dirty bits for the range of elements in |
888 // [min(stack_pointer_ + 1,begin), end]. | 888 // [min(stack_pointer_ + 1,begin), end]. |
889 void VirtualFrame::SyncRange(int begin, int end) { | 889 void VirtualFrame::SyncRange(int begin, int end) { |
890 ASSERT(begin >= 0); | 890 ASSERT(begin >= 0); |
891 ASSERT(end < element_count()); | 891 ASSERT(end < element_count()); |
892 // Sync elements below the range if they have not been materialized | 892 // Sync elements below the range if they have not been materialized |
893 // on the stack. | 893 // on the stack. |
894 int start = Min(begin, stack_pointer_ + 1); | 894 int start = Min(begin, stack_pointer_ + 1); |
895 | 895 |
896 // Emit normal 'push' instructions for elements above stack pointer | 896 // If positive we have to adjust the stack pointer. |
897 // and use mov instructions if we are below stack pointer. | 897 int delta = end - stack_pointer_; |
| 898 if (delta > 0) { |
| 899 stack_pointer_ = end; |
| 900 __ subq(rsp, Immediate(delta * kPointerSize)); |
| 901 } |
| 902 |
898 for (int i = start; i <= end; i++) { | 903 for (int i = start; i <= end; i++) { |
899 if (!elements_[i].is_synced()) { | 904 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i); |
900 if (i <= stack_pointer_) { | |
901 SyncElementBelowStackPointer(i); | |
902 } else { | |
903 SyncElementByPushing(i); | |
904 } | |
905 } | |
906 } | 905 } |
907 } | 906 } |
908 | 907 |
909 | 908 |
910 Result VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, | 909 Result VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, |
911 InvokeFlag flag, | 910 InvokeFlag flag, |
912 int arg_count) { | 911 int arg_count) { |
913 PrepareForCall(arg_count, arg_count); | 912 PrepareForCall(arg_count, arg_count); |
914 ASSERT(cgen()->HasValidEntryRegisters()); | 913 ASSERT(cgen()->HasValidEntryRegisters()); |
915 __ InvokeBuiltin(id, flag); | 914 __ InvokeBuiltin(id, flag); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 // Grow the expression stack by handler size less one (the return | 1062 // Grow the expression stack by handler size less one (the return |
1064 // address is already pushed by a call instruction). | 1063 // address is already pushed by a call instruction). |
1065 Adjust(kHandlerSize - 1); | 1064 Adjust(kHandlerSize - 1); |
1066 __ PushTryHandler(IN_JAVASCRIPT, type); | 1065 __ PushTryHandler(IN_JAVASCRIPT, type); |
1067 } | 1066 } |
1068 | 1067 |
1069 | 1068 |
1070 #undef __ | 1069 #undef __ |
1071 | 1070 |
1072 } } // namespace v8::internal | 1071 } } // namespace v8::internal |
OLD | NEW |