| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 | 103 |
| 104 static void EmitStackCheck(MacroAssembler* masm_, | 104 static void EmitStackCheck(MacroAssembler* masm_, |
| 105 int pointers = 0, | 105 int pointers = 0, |
| 106 Register scratch = rsp) { | 106 Register scratch = rsp) { |
| 107 Isolate* isolate = masm_->isolate(); | 107 Isolate* isolate = masm_->isolate(); |
| 108 Label ok; | 108 Label ok; |
| 109 ASSERT(scratch.is(rsp) == (pointers == 0)); | 109 ASSERT(scratch.is(rsp) == (pointers == 0)); |
| 110 if (pointers != 0) { | 110 if (pointers != 0) { |
| 111 __ movq(scratch, rsp); | 111 __ movp(scratch, rsp); |
| 112 __ subq(scratch, Immediate(pointers * kPointerSize)); | 112 __ subp(scratch, Immediate(pointers * kPointerSize)); |
| 113 } | 113 } |
| 114 __ CompareRoot(scratch, Heap::kStackLimitRootIndex); | 114 __ CompareRoot(scratch, Heap::kStackLimitRootIndex); |
| 115 __ j(above_equal, &ok, Label::kNear); | 115 __ j(above_equal, &ok, Label::kNear); |
| 116 __ call(isolate->builtins()->StackCheck(), RelocInfo::CODE_TARGET); | 116 __ call(isolate->builtins()->StackCheck(), RelocInfo::CODE_TARGET); |
| 117 __ bind(&ok); | 117 __ bind(&ok); |
| 118 } | 118 } |
| 119 | 119 |
| 120 | 120 |
| 121 // Generate code for a JS function. On entry to the function the receiver | 121 // Generate code for a JS function. On entry to the function the receiver |
| 122 // and arguments have been pushed on the stack left to right, with the | 122 // and arguments have been pushed on the stack left to right, with the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 if (locals_count == 1) { | 188 if (locals_count == 1) { |
| 189 __ PushRoot(Heap::kUndefinedValueRootIndex); | 189 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 190 } else if (locals_count > 1) { | 190 } else if (locals_count > 1) { |
| 191 if (locals_count >= 128) { | 191 if (locals_count >= 128) { |
| 192 EmitStackCheck(masm_, locals_count, rcx); | 192 EmitStackCheck(masm_, locals_count, rcx); |
| 193 } | 193 } |
| 194 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | 194 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
| 195 const int kMaxPushes = 32; | 195 const int kMaxPushes = 32; |
| 196 if (locals_count >= kMaxPushes) { | 196 if (locals_count >= kMaxPushes) { |
| 197 int loop_iterations = locals_count / kMaxPushes; | 197 int loop_iterations = locals_count / kMaxPushes; |
| 198 __ movq(rcx, Immediate(loop_iterations)); | 198 __ movp(rcx, Immediate(loop_iterations)); |
| 199 Label loop_header; | 199 Label loop_header; |
| 200 __ bind(&loop_header); | 200 __ bind(&loop_header); |
| 201 // Do pushes. | 201 // Do pushes. |
| 202 for (int i = 0; i < kMaxPushes; i++) { | 202 for (int i = 0; i < kMaxPushes; i++) { |
| 203 __ Push(rdx); | 203 __ Push(rdx); |
| 204 } | 204 } |
| 205 // Continue loop if not done. | 205 // Continue loop if not done. |
| 206 __ decq(rcx); | 206 __ decp(rcx); |
| 207 __ j(not_zero, &loop_header, Label::kNear); | 207 __ j(not_zero, &loop_header, Label::kNear); |
| 208 } | 208 } |
| 209 int remaining = locals_count % kMaxPushes; | 209 int remaining = locals_count % kMaxPushes; |
| 210 // Emit the remaining pushes. | 210 // Emit the remaining pushes. |
| 211 for (int i = 0; i < remaining; i++) { | 211 for (int i = 0; i < remaining; i++) { |
| 212 __ Push(rdx); | 212 __ Push(rdx); |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| (...skipping 4715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4932 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4932 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4933 Assembler::target_address_at(call_target_address, | 4933 Assembler::target_address_at(call_target_address, |
| 4934 unoptimized_code)); | 4934 unoptimized_code)); |
| 4935 return OSR_AFTER_STACK_CHECK; | 4935 return OSR_AFTER_STACK_CHECK; |
| 4936 } | 4936 } |
| 4937 | 4937 |
| 4938 | 4938 |
| 4939 } } // namespace v8::internal | 4939 } } // namespace v8::internal |
| 4940 | 4940 |
| 4941 #endif // V8_TARGET_ARCH_X64 | 4941 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |