OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); | 141 DCHECK(!IsGeneratorFunction(info->literal()->kind()) || locals_count == 0); |
142 if (locals_count == 1) { | 142 if (locals_count == 1) { |
143 __ PushRoot(Heap::kUndefinedValueRootIndex); | 143 __ PushRoot(Heap::kUndefinedValueRootIndex); |
144 } else if (locals_count > 1) { | 144 } else if (locals_count > 1) { |
145 if (locals_count >= 128) { | 145 if (locals_count >= 128) { |
146 Label ok; | 146 Label ok; |
147 __ movp(rcx, rsp); | 147 __ movp(rcx, rsp); |
148 __ subp(rcx, Immediate(locals_count * kPointerSize)); | 148 __ subp(rcx, Immediate(locals_count * kPointerSize)); |
149 __ CompareRoot(rcx, Heap::kRealStackLimitRootIndex); | 149 __ CompareRoot(rcx, Heap::kRealStackLimitRootIndex); |
150 __ j(above_equal, &ok, Label::kNear); | 150 __ j(above_equal, &ok, Label::kNear); |
151 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 151 __ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION); |
152 __ bind(&ok); | 152 __ bind(&ok); |
153 } | 153 } |
154 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); | 154 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); |
155 const int kMaxPushes = 32; | 155 const int kMaxPushes = 32; |
156 if (locals_count >= kMaxPushes) { | 156 if (locals_count >= kMaxPushes) { |
157 int loop_iterations = locals_count / kMaxPushes; | 157 int loop_iterations = locals_count / kMaxPushes; |
158 __ movp(rcx, Immediate(loop_iterations)); | 158 __ movp(rcx, Immediate(loop_iterations)); |
159 Label loop_header; | 159 Label loop_header; |
160 __ bind(&loop_header); | 160 __ bind(&loop_header); |
161 // Do pushes. | 161 // Do pushes. |
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 __ Drop(1); // literal index | 1859 __ Drop(1); // literal index |
1860 __ Pop(rax); | 1860 __ Pop(rax); |
1861 result_saved = false; | 1861 result_saved = false; |
1862 } | 1862 } |
1863 for (; array_index < length; array_index++) { | 1863 for (; array_index < length; array_index++) { |
1864 Expression* subexpr = subexprs->at(array_index); | 1864 Expression* subexpr = subexprs->at(array_index); |
1865 | 1865 |
1866 __ Push(rax); | 1866 __ Push(rax); |
1867 if (subexpr->IsSpread()) { | 1867 if (subexpr->IsSpread()) { |
1868 VisitForStackValue(subexpr->AsSpread()->expression()); | 1868 VisitForStackValue(subexpr->AsSpread()->expression()); |
1869 __ InvokeBuiltin(Builtins::CONCAT_ITERABLE_TO_ARRAY, CALL_FUNCTION); | 1869 __ InvokeBuiltin(Context::CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, |
| 1870 CALL_FUNCTION); |
1870 } else { | 1871 } else { |
1871 VisitForStackValue(subexpr); | 1872 VisitForStackValue(subexpr); |
1872 __ CallRuntime(Runtime::kAppendElement, 2); | 1873 __ CallRuntime(Runtime::kAppendElement, 2); |
1873 } | 1874 } |
1874 | 1875 |
1875 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); | 1876 PrepareForBailoutForId(expr->GetIdForElement(array_index), NO_REGISTERS); |
1876 } | 1877 } |
1877 | 1878 |
1878 if (result_saved) { | 1879 if (result_saved) { |
1879 __ Drop(1); // literal index | 1880 __ Drop(1); // literal index |
(...skipping 3111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4991 Label* if_false = NULL; | 4992 Label* if_false = NULL; |
4992 Label* fall_through = NULL; | 4993 Label* fall_through = NULL; |
4993 context()->PrepareTest(&materialize_true, &materialize_false, | 4994 context()->PrepareTest(&materialize_true, &materialize_false, |
4994 &if_true, &if_false, &fall_through); | 4995 &if_true, &if_false, &fall_through); |
4995 | 4996 |
4996 Token::Value op = expr->op(); | 4997 Token::Value op = expr->op(); |
4997 VisitForStackValue(expr->left()); | 4998 VisitForStackValue(expr->left()); |
4998 switch (op) { | 4999 switch (op) { |
4999 case Token::IN: | 5000 case Token::IN: |
5000 VisitForStackValue(expr->right()); | 5001 VisitForStackValue(expr->right()); |
5001 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); | 5002 __ InvokeBuiltin(Context::IN_BUILTIN_INDEX, CALL_FUNCTION); |
5002 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); | 5003 PrepareForBailoutBeforeSplit(expr, false, NULL, NULL); |
5003 __ CompareRoot(rax, Heap::kTrueValueRootIndex); | 5004 __ CompareRoot(rax, Heap::kTrueValueRootIndex); |
5004 Split(equal, if_true, if_false, fall_through); | 5005 Split(equal, if_true, if_false, fall_through); |
5005 break; | 5006 break; |
5006 | 5007 |
5007 case Token::INSTANCEOF: { | 5008 case Token::INSTANCEOF: { |
5008 VisitForAccumulatorValue(expr->right()); | 5009 VisitForAccumulatorValue(expr->right()); |
5009 __ Pop(rdx); | 5010 __ Pop(rdx); |
5010 InstanceOfStub stub(isolate()); | 5011 InstanceOfStub stub(isolate()); |
5011 __ CallStub(&stub); | 5012 __ CallStub(&stub); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5265 Assembler::target_address_at(call_target_address, | 5266 Assembler::target_address_at(call_target_address, |
5266 unoptimized_code)); | 5267 unoptimized_code)); |
5267 return OSR_AFTER_STACK_CHECK; | 5268 return OSR_AFTER_STACK_CHECK; |
5268 } | 5269 } |
5269 | 5270 |
5270 | 5271 |
5271 } // namespace internal | 5272 } // namespace internal |
5272 } // namespace v8 | 5273 } // namespace v8 |
5273 | 5274 |
5274 #endif // V8_TARGET_ARCH_X64 | 5275 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |