OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 __ Assert(eq, kUnexpectedStringFunction); | 178 __ Assert(eq, kUnexpectedStringFunction); |
179 } | 179 } |
180 | 180 |
181 // Load the first arguments in x0 and get rid of the rest. | 181 // Load the first arguments in x0 and get rid of the rest. |
182 Label no_arguments; | 182 Label no_arguments; |
183 __ Cbz(argc, &no_arguments); | 183 __ Cbz(argc, &no_arguments); |
184 // First args = sp[(argc - 1) * 8]. | 184 // First args = sp[(argc - 1) * 8]. |
185 __ Sub(argc, argc, 1); | 185 __ Sub(argc, argc, 1); |
186 __ Claim(argc, kXRegSizeInBytes); | 186 __ Claim(argc, kXRegSizeInBytes); |
187 // jssp now point to args[0], load and drop args[0] + receiver. | 187 // jssp now point to args[0], load and drop args[0] + receiver. |
188 // TODO(jbramley): Consider adding ClaimAndPoke. | 188 Register arg = argc; |
189 __ Ldr(argc, MemOperand(jssp, 2 * kPointerSize, PostIndex)); | 189 __ Ldr(arg, MemOperand(jssp, 2 * kPointerSize, PostIndex)); |
| 190 argc = NoReg; |
190 | 191 |
191 Register argument = x2; | 192 Register argument = x2; |
192 Label not_cached, argument_is_string; | 193 Label not_cached, argument_is_string; |
193 __ LookupNumberStringCache(argc, // Input. | 194 __ LookupNumberStringCache(arg, // Input. |
194 argument, // Result. | 195 argument, // Result. |
195 x10, // Scratch. | 196 x10, // Scratch. |
196 x11, // Scratch. | 197 x11, // Scratch. |
197 x12, // Scratch. | 198 x12, // Scratch. |
198 ¬_cached); | 199 ¬_cached); |
199 __ IncrementCounter(counters->string_ctor_cached_number(), 1, x10, x11); | 200 __ IncrementCounter(counters->string_ctor_cached_number(), 1, x10, x11); |
200 __ Bind(&argument_is_string); | 201 __ Bind(&argument_is_string); |
201 | 202 |
202 // ----------- S t a t e ------------- | 203 // ----------- S t a t e ------------- |
203 // -- x2 : argument converted to string | 204 // -- x2 : argument converted to string |
(...skipping 27 matching lines...) Expand all Loading... |
231 | 232 |
232 // Ensure the object is fully initialized. | 233 // Ensure the object is fully initialized. |
233 STATIC_ASSERT(JSValue::kSize == (4 * kPointerSize)); | 234 STATIC_ASSERT(JSValue::kSize == (4 * kPointerSize)); |
234 | 235 |
235 __ Ret(); | 236 __ Ret(); |
236 | 237 |
237 // The argument was not found in the number to string cache. Check | 238 // The argument was not found in the number to string cache. Check |
238 // if it's a string already before calling the conversion builtin. | 239 // if it's a string already before calling the conversion builtin. |
239 Label convert_argument; | 240 Label convert_argument; |
240 __ Bind(¬_cached); | 241 __ Bind(¬_cached); |
241 __ JumpIfSmi(argc, &convert_argument); | 242 __ JumpIfSmi(arg, &convert_argument); |
242 | 243 |
243 // Is it a String? | 244 // Is it a String? |
244 __ Ldr(x10, FieldMemOperand(x0, HeapObject::kMapOffset)); | 245 __ Ldr(x10, FieldMemOperand(x0, HeapObject::kMapOffset)); |
245 __ Ldrb(x11, FieldMemOperand(x10, Map::kInstanceTypeOffset)); | 246 __ Ldrb(x11, FieldMemOperand(x10, Map::kInstanceTypeOffset)); |
246 __ Tbnz(x11, MaskToBit(kIsNotStringMask), &convert_argument); | 247 __ Tbnz(x11, MaskToBit(kIsNotStringMask), &convert_argument); |
247 __ Mov(argument, argc); | 248 __ Mov(argument, arg); |
248 __ IncrementCounter(counters->string_ctor_string_value(), 1, x10, x11); | 249 __ IncrementCounter(counters->string_ctor_string_value(), 1, x10, x11); |
249 __ B(&argument_is_string); | 250 __ B(&argument_is_string); |
250 | 251 |
251 // Invoke the conversion builtin and put the result into x2. | 252 // Invoke the conversion builtin and put the result into x2. |
252 __ Bind(&convert_argument); | 253 __ Bind(&convert_argument); |
253 __ Push(function); // Preserve the function. | 254 __ Push(function); // Preserve the function. |
254 __ IncrementCounter(counters->string_ctor_conversions(), 1, x10, x11); | 255 __ IncrementCounter(counters->string_ctor_conversions(), 1, x10, x11); |
255 { | 256 { |
256 FrameScope scope(masm, StackFrame::INTERNAL); | 257 FrameScope scope(masm, StackFrame::INTERNAL); |
257 __ Push(argc); | 258 __ Push(arg); |
258 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); | 259 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); |
259 } | 260 } |
260 __ Pop(function); | 261 __ Pop(function); |
261 __ Mov(argument, x0); | 262 __ Mov(argument, x0); |
262 __ B(&argument_is_string); | 263 __ B(&argument_is_string); |
263 | 264 |
264 // Load the empty string into x2, remove the receiver from the | 265 // Load the empty string into x2, remove the receiver from the |
265 // stack, and jump back to the case where the argument is a string. | 266 // stack, and jump back to the case where the argument is a string. |
266 __ Bind(&no_arguments); | 267 __ Bind(&no_arguments); |
267 __ LoadRoot(argument, Heap::kempty_stringRootIndex); | 268 __ LoadRoot(argument, Heap::kempty_stringRootIndex); |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 __ Mov(x22, x19); | 703 __ Mov(x22, x19); |
703 __ Mov(x23, x19); | 704 __ Mov(x23, x19); |
704 __ Mov(x24, x19); | 705 __ Mov(x24, x19); |
705 __ Mov(x25, x19); | 706 __ Mov(x25, x19); |
706 // Don't initialize the reserved registers. | 707 // Don't initialize the reserved registers. |
707 // x26 : root register (root). | 708 // x26 : root register (root). |
708 // x27 : context pointer (cp). | 709 // x27 : context pointer (cp). |
709 // x28 : JS stack pointer (jssp). | 710 // x28 : JS stack pointer (jssp). |
710 // x29 : frame pointer (fp). | 711 // x29 : frame pointer (fp). |
711 | 712 |
712 // TODO(alexandre): Revisit the MAsm function invocation mechanisms. | |
713 // Currently there is a mix of statically and dynamically allocated | |
714 // registers. | |
715 __ Mov(x0, argc); | 713 __ Mov(x0, argc); |
716 if (is_construct) { | 714 if (is_construct) { |
717 // No type feedback cell is available. | 715 // No type feedback cell is available. |
718 Handle<Object> undefined_sentinel( | 716 Handle<Object> undefined_sentinel( |
719 masm->isolate()->heap()->undefined_value(), masm->isolate()); | 717 masm->isolate()->heap()->undefined_value(), masm->isolate()); |
720 __ Mov(x2, Operand(undefined_sentinel)); | 718 __ Mov(x2, Operand(undefined_sentinel)); |
721 | 719 |
722 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 720 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
723 __ CallStub(&stub); | 721 __ CallStub(&stub); |
724 } else { | 722 } else { |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 __ Bind(&dont_adapt_arguments); | 1468 __ Bind(&dont_adapt_arguments); |
1471 __ Jump(x3); | 1469 __ Jump(x3); |
1472 } | 1470 } |
1473 | 1471 |
1474 | 1472 |
1475 #undef __ | 1473 #undef __ |
1476 | 1474 |
1477 } } // namespace v8::internal | 1475 } } // namespace v8::internal |
1478 | 1476 |
1479 #endif // V8_TARGET_ARCH_ARM | 1477 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |