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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 876 |
877 // Clear the dirty bits for the range of elements in | 877 // Clear the dirty bits for the range of elements in |
878 // [min(stack_pointer_ + 1,begin), end]. | 878 // [min(stack_pointer_ + 1,begin), end]. |
879 void VirtualFrame::SyncRange(int begin, int end) { | 879 void VirtualFrame::SyncRange(int begin, int end) { |
880 ASSERT(begin >= 0); | 880 ASSERT(begin >= 0); |
881 ASSERT(end < element_count()); | 881 ASSERT(end < element_count()); |
882 // Sync elements below the range if they have not been materialized | 882 // Sync elements below the range if they have not been materialized |
883 // on the stack. | 883 // on the stack. |
884 int start = Min(begin, stack_pointer_ + 1); | 884 int start = Min(begin, stack_pointer_ + 1); |
885 | 885 |
886 // If positive we have to adjust the stack pointer. | 886 // Emit normal 'push' instructions for elements above stack pointer |
887 int delta = end - stack_pointer_; | 887 // and use mov instructions if we are below stack pointer. |
888 if (delta > 0) { | |
889 stack_pointer_ = end; | |
890 __ subq(rsp, Immediate(delta * kPointerSize)); | |
891 } | |
892 | |
893 for (int i = start; i <= end; i++) { | 888 for (int i = start; i <= end; i++) { |
894 if (!elements_[i].is_synced()) SyncElementBelowStackPointer(i); | 889 if (!elements_[i].is_synced()) { |
| 890 if (i <= stack_pointer_) { |
| 891 SyncElementBelowStackPointer(i); |
| 892 } else { |
| 893 SyncElementByPushing(i); |
| 894 } |
| 895 } |
895 } | 896 } |
896 } | 897 } |
897 | 898 |
898 | 899 |
899 Result VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, | 900 Result VirtualFrame::InvokeBuiltin(Builtins::JavaScript id, |
900 InvokeFlag flag, | 901 InvokeFlag flag, |
901 int arg_count) { | 902 int arg_count) { |
902 PrepareForCall(arg_count, arg_count); | 903 PrepareForCall(arg_count, arg_count); |
903 ASSERT(cgen()->HasValidEntryRegisters()); | 904 ASSERT(cgen()->HasValidEntryRegisters()); |
904 __ InvokeBuiltin(id, flag); | 905 __ InvokeBuiltin(id, flag); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 // Grow the expression stack by handler size less one (the return | 1053 // Grow the expression stack by handler size less one (the return |
1053 // address is already pushed by a call instruction). | 1054 // address is already pushed by a call instruction). |
1054 Adjust(kHandlerSize - 1); | 1055 Adjust(kHandlerSize - 1); |
1055 __ PushTryHandler(IN_JAVASCRIPT, type); | 1056 __ PushTryHandler(IN_JAVASCRIPT, type); |
1056 } | 1057 } |
1057 | 1058 |
1058 | 1059 |
1059 #undef __ | 1060 #undef __ |
1060 | 1061 |
1061 } } // namespace v8::internal | 1062 } } // namespace v8::internal |
OLD | NEW |