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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
11 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
13 #include "src/ic/handler-compiler.h" | 13 #include "src/ic/handler-compiler.h" |
14 #include "src/isolate.h" | 14 #include "src/isolate.h" |
15 #include "src/jsregexp.h" | 15 #include "src/jsregexp.h" |
16 #include "src/regexp-macro-assembler.h" | 16 #include "src/regexp-macro-assembler.h" |
17 #include "src/runtime.h" | 17 #include "src/runtime.h" |
18 | 18 |
19 namespace v8 { | 19 namespace v8 { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 | 22 |
23 static void InitializeArrayConstructorDescriptor( | 23 static void InitializeArrayConstructorDescriptor( |
24 Isolate* isolate, CodeStub::Major major, | 24 Isolate* isolate, CodeStubDescriptor* descriptor, |
25 CodeStubInterfaceDescriptor* descriptor, | |
26 int constant_stack_parameter_count) { | 25 int constant_stack_parameter_count) { |
27 Address deopt_handler = Runtime::FunctionForId( | 26 Address deopt_handler = Runtime::FunctionForId( |
28 Runtime::kArrayConstructor)->entry; | 27 Runtime::kArrayConstructor)->entry; |
29 | 28 |
30 if (constant_stack_parameter_count == 0) { | 29 if (constant_stack_parameter_count == 0) { |
31 ArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 30 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
32 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
33 constant_stack_parameter_count, | |
34 JS_FUNCTION_STUB_MODE); | 31 JS_FUNCTION_STUB_MODE); |
35 } else { | 32 } else { |
36 ArrayConstructorDescriptor call_descriptor(isolate); | 33 descriptor->Initialize(r0, deopt_handler, constant_stack_parameter_count, |
37 descriptor->Initialize(major, call_descriptor, r0, deopt_handler, | |
38 constant_stack_parameter_count, | |
39 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 34 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
40 } | 35 } |
41 } | 36 } |
42 | 37 |
43 | 38 |
44 static void InitializeInternalArrayConstructorDescriptor( | 39 static void InitializeInternalArrayConstructorDescriptor( |
45 Isolate* isolate, CodeStub::Major major, | 40 Isolate* isolate, CodeStubDescriptor* descriptor, |
46 CodeStubInterfaceDescriptor* descriptor, | |
47 int constant_stack_parameter_count) { | 41 int constant_stack_parameter_count) { |
48 Address deopt_handler = Runtime::FunctionForId( | 42 Address deopt_handler = Runtime::FunctionForId( |
49 Runtime::kInternalArrayConstructor)->entry; | 43 Runtime::kInternalArrayConstructor)->entry; |
50 | 44 |
51 if (constant_stack_parameter_count == 0) { | 45 if (constant_stack_parameter_count == 0) { |
52 InternalArrayConstructorConstantArgCountDescriptor call_descriptor(isolate); | 46 descriptor->Initialize(deopt_handler, constant_stack_parameter_count, |
53 descriptor->Initialize(major, call_descriptor, deopt_handler, | |
54 constant_stack_parameter_count, | |
55 JS_FUNCTION_STUB_MODE); | 47 JS_FUNCTION_STUB_MODE); |
56 } else { | 48 } else { |
57 InternalArrayConstructorDescriptor call_descriptor(isolate); | 49 descriptor->Initialize(r0, deopt_handler, constant_stack_parameter_count, |
58 descriptor->Initialize(major, call_descriptor, r0, deopt_handler, | |
59 constant_stack_parameter_count, | |
60 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 50 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
61 } | 51 } |
62 } | 52 } |
63 | 53 |
64 | 54 |
65 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 55 void ArrayNoArgumentConstructorStub::InitializeDescriptor( |
66 CodeStubInterfaceDescriptor* descriptor) { | 56 CodeStubDescriptor* descriptor) { |
67 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); | 57 InitializeArrayConstructorDescriptor(isolate(), descriptor, 0); |
68 } | 58 } |
69 | 59 |
70 | 60 |
71 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 61 void ArraySingleArgumentConstructorStub::InitializeDescriptor( |
72 CodeStubInterfaceDescriptor* descriptor) { | 62 CodeStubDescriptor* descriptor) { |
73 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); | 63 InitializeArrayConstructorDescriptor(isolate(), descriptor, 1); |
74 } | 64 } |
75 | 65 |
76 | 66 |
77 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 67 void ArrayNArgumentsConstructorStub::InitializeDescriptor( |
78 CodeStubInterfaceDescriptor* descriptor) { | 68 CodeStubDescriptor* descriptor) { |
79 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); | 69 InitializeArrayConstructorDescriptor(isolate(), descriptor, -1); |
80 } | 70 } |
81 | 71 |
82 | 72 |
83 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 73 void InternalArrayNoArgumentConstructorStub::InitializeDescriptor( |
84 CodeStubInterfaceDescriptor* descriptor) { | 74 CodeStubDescriptor* descriptor) { |
85 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 75 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 0); |
86 descriptor, 0); | |
87 } | 76 } |
88 | 77 |
89 | 78 |
90 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 79 void InternalArraySingleArgumentConstructorStub::InitializeDescriptor( |
91 CodeStubInterfaceDescriptor* descriptor) { | 80 CodeStubDescriptor* descriptor) { |
92 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 81 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, 1); |
93 descriptor, 1); | |
94 } | 82 } |
95 | 83 |
96 | 84 |
97 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 85 void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( |
98 CodeStubInterfaceDescriptor* descriptor) { | 86 CodeStubDescriptor* descriptor) { |
99 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), | 87 InitializeInternalArrayConstructorDescriptor(isolate(), descriptor, -1); |
100 descriptor, -1); | |
101 } | 88 } |
102 | 89 |
103 | 90 |
104 #define __ ACCESS_MASM(masm) | 91 #define __ ACCESS_MASM(masm) |
105 | 92 |
106 | 93 |
107 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 94 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
108 Label* slow, | 95 Label* slow, |
109 Condition cond); | 96 Condition cond); |
110 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 97 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
111 Register lhs, | 98 Register lhs, |
112 Register rhs, | 99 Register rhs, |
113 Label* lhs_not_nan, | 100 Label* lhs_not_nan, |
114 Label* slow, | 101 Label* slow, |
115 bool strict); | 102 bool strict); |
116 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, | 103 static void EmitStrictTwoHeapObjectCompare(MacroAssembler* masm, |
117 Register lhs, | 104 Register lhs, |
118 Register rhs); | 105 Register rhs); |
119 | 106 |
120 | 107 |
121 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { | 108 void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, |
| 109 ExternalReference miss) { |
122 // Update the static counter each time a new code stub is generated. | 110 // Update the static counter each time a new code stub is generated. |
123 isolate()->counters()->code_stubs()->Increment(); | 111 isolate()->counters()->code_stubs()->Increment(); |
124 | 112 |
125 CodeStubInterfaceDescriptor descriptor(this); | 113 CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); |
126 int param_count = descriptor.GetEnvironmentParameterCount(); | 114 int param_count = descriptor.GetEnvironmentParameterCount(); |
127 { | 115 { |
128 // Call the runtime system in a fresh internal frame. | 116 // Call the runtime system in a fresh internal frame. |
129 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 117 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
130 DCHECK(param_count == 0 || | 118 DCHECK(param_count == 0 || |
131 r0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); | 119 r0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); |
132 // Push arguments | 120 // Push arguments |
133 for (int i = 0; i < param_count; ++i) { | 121 for (int i = 0; i < param_count; ++i) { |
134 __ push(descriptor.GetEnvironmentParameterRegister(i)); | 122 __ push(descriptor.GetEnvironmentParameterRegister(i)); |
135 } | 123 } |
136 ExternalReference miss = descriptor.miss_handler(); | |
137 __ CallExternalReference(miss, param_count); | 124 __ CallExternalReference(miss, param_count); |
138 } | 125 } |
139 | 126 |
140 __ Ret(); | 127 __ Ret(); |
141 } | 128 } |
142 | 129 |
143 | 130 |
144 void DoubleToIStub::Generate(MacroAssembler* masm) { | 131 void DoubleToIStub::Generate(MacroAssembler* masm) { |
145 Label out_of_range, only_low, negate, done; | 132 Label out_of_range, only_low, negate, done; |
146 Register input_reg = source(); | 133 Register input_reg = source(); |
(...skipping 4531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4678 MemOperand(fp, 6 * kPointerSize), | 4665 MemOperand(fp, 6 * kPointerSize), |
4679 NULL); | 4666 NULL); |
4680 } | 4667 } |
4681 | 4668 |
4682 | 4669 |
4683 #undef __ | 4670 #undef __ |
4684 | 4671 |
4685 } } // namespace v8::internal | 4672 } } // namespace v8::internal |
4686 | 4673 |
4687 #endif // V8_TARGET_ARCH_ARM | 4674 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |