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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // -- sp[...]: constructor arguments | 115 // -- sp[...]: constructor arguments |
116 // ----------------------------------- | 116 // ----------------------------------- |
117 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; | 117 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; |
118 | 118 |
119 // Get the InternalArray function. | 119 // Get the InternalArray function. |
120 GenerateLoadInternalArrayFunction(masm, a1); | 120 GenerateLoadInternalArrayFunction(masm, a1); |
121 | 121 |
122 if (FLAG_debug_code) { | 122 if (FLAG_debug_code) { |
123 // Initial map for the builtin InternalArray functions should be maps. | 123 // Initial map for the builtin InternalArray functions should be maps. |
124 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 124 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
125 __ And(t0, a2, Operand(kSmiTagMask)); | 125 __ SmiTst(a2, t0); |
126 __ Assert(ne, kUnexpectedInitialMapForInternalArrayFunction, | 126 __ Assert(ne, kUnexpectedInitialMapForInternalArrayFunction, |
127 t0, Operand(zero_reg)); | 127 t0, Operand(zero_reg)); |
128 __ GetObjectType(a2, a3, t0); | 128 __ GetObjectType(a2, a3, t0); |
129 __ Assert(eq, kUnexpectedInitialMapForInternalArrayFunction, | 129 __ Assert(eq, kUnexpectedInitialMapForInternalArrayFunction, |
130 t0, Operand(MAP_TYPE)); | 130 t0, Operand(MAP_TYPE)); |
131 } | 131 } |
132 | 132 |
133 // Run the native code for the InternalArray function called as a normal | 133 // Run the native code for the InternalArray function called as a normal |
134 // function. | 134 // function. |
135 // Tail call a stub. | 135 // Tail call a stub. |
136 InternalArrayConstructorStub stub(masm->isolate()); | 136 InternalArrayConstructorStub stub(masm->isolate()); |
137 __ TailCallStub(&stub); | 137 __ TailCallStub(&stub); |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { | 141 void Builtins::Generate_ArrayCode(MacroAssembler* masm) { |
142 // ----------- S t a t e ------------- | 142 // ----------- S t a t e ------------- |
143 // -- a0 : number of arguments | 143 // -- a0 : number of arguments |
144 // -- ra : return address | 144 // -- ra : return address |
145 // -- sp[...]: constructor arguments | 145 // -- sp[...]: constructor arguments |
146 // ----------------------------------- | 146 // ----------------------------------- |
147 Label generic_array_code; | 147 Label generic_array_code; |
148 | 148 |
149 // Get the Array function. | 149 // Get the Array function. |
150 GenerateLoadArrayFunction(masm, a1); | 150 GenerateLoadArrayFunction(masm, a1); |
151 | 151 |
152 if (FLAG_debug_code) { | 152 if (FLAG_debug_code) { |
153 // Initial map for the builtin Array functions should be maps. | 153 // Initial map for the builtin Array functions should be maps. |
154 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 154 __ lw(a2, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
155 __ And(t0, a2, Operand(kSmiTagMask)); | 155 __ SmiTst(a2, t0); |
156 __ Assert(ne, kUnexpectedInitialMapForArrayFunction1, | 156 __ Assert(ne, kUnexpectedInitialMapForArrayFunction1, |
157 t0, Operand(zero_reg)); | 157 t0, Operand(zero_reg)); |
158 __ GetObjectType(a2, a3, t0); | 158 __ GetObjectType(a2, a3, t0); |
159 __ Assert(eq, kUnexpectedInitialMapForArrayFunction2, | 159 __ Assert(eq, kUnexpectedInitialMapForArrayFunction2, |
160 t0, Operand(MAP_TYPE)); | 160 t0, Operand(MAP_TYPE)); |
161 } | 161 } |
162 | 162 |
163 // Run the native code for the Array function called as a normal function. | 163 // Run the native code for the Array function called as a normal function. |
164 // Tail call a stub. | 164 // Tail call a stub. |
165 Handle<Object> undefined_sentinel( | 165 Handle<Object> undefined_sentinel( |
(...skipping 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 __ bind(&dont_adapt_arguments); | 1507 __ bind(&dont_adapt_arguments); |
1508 __ Jump(a3); | 1508 __ Jump(a3); |
1509 } | 1509 } |
1510 | 1510 |
1511 | 1511 |
1512 #undef __ | 1512 #undef __ |
1513 | 1513 |
1514 } } // namespace v8::internal | 1514 } } // namespace v8::internal |
1515 | 1515 |
1516 #endif // V8_TARGET_ARCH_MIPS | 1516 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |