| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
| 8 | 8 |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
| 12 #include "src/ic/handler-compiler.h" | 12 #include "src/ic/handler-compiler.h" |
| 13 #include "src/isolate.h" | 13 #include "src/isolate.h" |
| 14 #include "src/jsregexp.h" | 14 #include "src/jsregexp.h" |
| 15 #include "src/regexp-macro-assembler.h" | 15 #include "src/regexp-macro-assembler.h" |
| 16 #include "src/runtime.h" | 16 #include "src/runtime.h" |
| 17 | 17 |
| 18 namespace v8 { | 18 namespace v8 { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 |
| 21 | 21 |
| 22 static void InitializeArrayConstructorDescriptor( | 22 static void InitializeArrayConstructorDescriptor( |
| 23 Isolate* isolate, CodeStub::Major major, | 23 Isolate* isolate, CodeStubDescriptor* descriptor, |
| 24 CodeStubInterfaceDescriptor* descriptor, | |
| 25 int constant_stack_parameter_count) { | 24 int constant_stack_parameter_count) { |
| 26 // cp: context | 25 // cp: context |
| 27 // x1: function | 26 // x1: function |
| 28 // x2: allocation site with elements kind | 27 // x2: allocation site with elements kind |
| 29 // x0: number of arguments to the constructor function | 28 // x0: number of arguments to the constructor function |
| 30 Address deopt_handler = Runtime::FunctionForId( | 29 Address deopt_handler = Runtime::FunctionForId( |
| 31 Runtime::kArrayConstructor)->entry; | 30 Runtime::kArrayConstructor)->entry; |
| 32 | 31 |
| 33 if (constant_stack_parameter_count == 0) { | 32 if (constant_stack_parameter_count == 0) { |
| 34 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 33 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
| 35 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
| 36 constant_stack_parameter_count, | |
| 37 JS_FUNCTION_STUB_MODE); | 34 JS_FUNCTION_STUB_MODE); |
| 38 } else { | 35 } else { |
| 39 ArrayConstructorDescriptor call_descriptor(isolate); | 36 descriptor->Initialize(x0, deopt_handler, constant_stack_parameter_count, |
| 40 descriptor->Initialize(major, call_descriptor, x0, deopt_handler, | |
| 41 constant_stack_parameter_count, | |
| 42 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 37 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
| 43 } | 38 } |
| 44 } | 39 } |
| 45 | 40 |
| 46 | 41 |
| 47 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 42 void ArrayNoArgumentConstructorStub::InitializeDescriptor( |
| 48 CodeStubInterfaceDescriptor* descriptor) { | 43 CodeStubDescriptor* descriptor) { |
| 49 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); | 44 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0); |
| 50 } | 45 } |
| 51 | 46 |
| 52 | 47 |
| 53 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 48 void ArraySingleArgumentConstructorStub::InitializeDescriptor( |
| 54 CodeStubInterfaceDescriptor* descriptor) { | 49 CodeStubDescriptor* descriptor) { |
| 55 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); | 50 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1); |
| 56 } | 51 } |
| 57 | 52 |
| 58 | 53 |
| 59 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 54 void ArrayNArgumentsConstructorStub::InitializeDescriptor( |
| 60 CodeStubInterfaceDescriptor* descriptor) { | 55 CodeStubDescriptor* descriptor) { |
| 61 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); | 56 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); |
| 62 } | 57 } |
| 63 | 58 |
| 64 | 59 |
| 65 static void InitializeInternalArrayConstructorDescriptor( | 60 static void InitializeInternalArrayConstructorDescriptor( |
| 66 Isolate* isolate, CodeStub::Major major, | 61 Isolate* isolate, CodeStubDescriptor* descriptor, |
| 67 CodeStubInterfaceDescriptor* descriptor, | |
| 68 int constant_stack_parameter_count) { | 62 int constant_stack_parameter_count) { |
| 69 Address deopt_handler = Runtime::FunctionForId( | 63 Address deopt_handler = Runtime::FunctionForId( |
| 70 Runtime::kInternalArrayConstructor)->entry; | 64 Runtime::kInternalArrayConstructor)->entry; |
| 71 | 65 |
| 72 if (constant_stack_parameter_count == 0) { | 66 if (constant_stack_parameter_count == 0) { |
| 73 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 67 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
| 74 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
| 75 constant_stack_parameter_count, | |
| 76 JS_FUNCTION_STUB_MODE); | 68 JS_FUNCTION_STUB_MODE); |
| 77 } else { | 69 } else { |
| 78 InternalArrayConstructorDescriptor call_descriptor(isolate); | 70 descriptor->Initialize(x0, deopt_handler, constant_stack_parameter_count, |
| 79 descriptor->Initialize(major, call_descriptor, x0, deopt_handler, | |
| 80 constant_stack_parameter_count, | |
| 81 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 71 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
| 82 } | 72 } |
| 83 } | 73 } |
| 84 | 74 |
| 85 | 75 |
| 86 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 76 void InternalArrayNoArgumentConstructorStub::InitializeDescriptor( |
| 87 CodeStubInterfaceDescriptor* descriptor) { | 77 CodeStubDescriptor* descriptor) { |
| 88 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 78 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0); |
| 89 descriptor, 0); | |
| 90 } | 79 } |
| 91 | 80 |
| 92 | 81 |
| 93 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 82 void InternalArraySingleArgumentConstructorStub::InitializeDescriptor( |
| 94 CodeStubInterfaceDescriptor* descriptor) { | 83 CodeStubDescriptor* descriptor) { |
| 95 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 84 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1); |
| 96 descriptor, 1); | |
| 97 } | 85 } |
| 98 | 86 |
| 99 | 87 |
| 100 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 88 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( |
| 101 CodeStubInterfaceDescriptor* descriptor) { | 89 CodeStubDescriptor* descriptor) { |
| 102 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 90 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); |
| 103 descriptor, -1); | |
| 104 } | 91 } |
| 105 | 92 |
| 106 | 93 |
| 107 #define __ ACCESS_MASM(masm) | 94 #define __ ACCESS_MASM(masm) |
| 108 | 95 |
| 109 | 96 |
| 110 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 97 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
| 98 ExternalReference miss) { |
| 111 // Update the static counter each time a new code stub is generated. | 99 // Update the static counter each time a new code stub is generated. |
| 112 isolate()->counters()->code_stubs()->Increment(); | 100 isolate()->counters()->code_stubs()->Increment(); |
| 113 | 101 |
| 114 CodeStubInterfaceDescriptor descriptor(this); | 102 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); |
| 115 int param_count = descriptor.GetEnvironmentParameterCount(); | 103 int param_count = descriptor.GetEnvironmentParameterCount(); |
| 116 { | 104 { |
| 117 // Call the runtime system in a fresh internal frame. | 105 // Call the runtime system in a fresh internal frame. |
| 118 FrameScope scope(masm, StackFrame::INTERNAL); | 106 FrameScope scope(masm, StackFrame::INTERNAL); |
| 119 DCHECK((param_count == 0) || | 107 DCHECK((param_count == 0) || |
| 120 x0.Is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 108 x0.Is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); |
| 121 | 109 |
| 122 // Push arguments | 110 // Push arguments |
| 123 MacroAssembler::PushPopQueue queue(masm); | 111 MacroAssembler::PushPopQueue queue(masm); |
| 124 for (int i = 0; i < param_count; ++i) { | 112 for (int i = 0; i < param_count; ++i) { |
| 125 queue.Queue(descriptor.GetEnvironmentParameterRegister(i)); | 113 queue.Queue(descriptor.GetEnvironmentParameterRegister(i)); |
| 126 } | 114 } |
| 127 queue.PushQueued(); | 115 queue.PushQueued(); |
| 128 | 116 |
| 129 ExternalReference miss = descriptor.miss_handler(); | |
| 130 __ CallExternalReference(miss, param_count); | 117 __ CallExternalReference(miss, param_count); |
| 131 } | 118 } |
| 132 | 119 |
| 133 __ Ret(); | 120 __ Ret(); |
| 134 } | 121 } |
| 135 | 122 |
| 136 | 123 |
| 137 void DoubleToIStub::Generate(MacroAssembler* masm) { | 124 void DoubleToIStub::Generate(MacroAssembler* masm) { |
| 138 Label done; | 125 Label done; |
| 139 Register input = source(); | 126 Register input = source(); |
| (...skipping 4914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5054 MemOperand(fp, 6 * kPointerSize), | 5041 MemOperand(fp, 6 * kPointerSize), |
| 5055 NULL); | 5042 NULL); |
| 5056 } | 5043 } |
| 5057 | 5044 |
| 5058 | 5045 |
| 5059 #undef __ | 5046 #undef __ |
| 5060 | 5047 |
| 5061 } } // namespace v8::internal | 5048 } } // namespace v8::internal |
| 5062 | 5049 |
| 5063 #endif // V8_TARGET_ARCH_ARM64 | 5050 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |