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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 __ cmp(r1, Operand(Smi::FromInt(0))); | 2330 __ cmp(r1, Operand(Smi::FromInt(0))); |
2331 __ mov(r9, Operand::Zero(), LeaveCC, eq); | 2331 __ mov(r9, Operand::Zero(), LeaveCC, eq); |
2332 __ mov(r9, Operand(r1, LSL, 1), LeaveCC, ne); | 2332 __ mov(r9, Operand(r1, LSL, 1), LeaveCC, ne); |
2333 __ add(r9, r9, Operand(kParameterMapHeaderSize), LeaveCC, ne); | 2333 __ add(r9, r9, Operand(kParameterMapHeaderSize), LeaveCC, ne); |
2334 | 2334 |
2335 // 2. Backing store. | 2335 // 2. Backing store. |
2336 __ add(r9, r9, Operand(r2, LSL, 1)); | 2336 __ add(r9, r9, Operand(r2, LSL, 1)); |
2337 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); | 2337 __ add(r9, r9, Operand(FixedArray::kHeaderSize)); |
2338 | 2338 |
2339 // 3. Arguments object. | 2339 // 3. Arguments object. |
2340 __ add(r9, r9, Operand(Heap::kArgumentsObjectSize)); | 2340 __ add(r9, r9, Operand(Heap::kSloppyArgumentsObjectSize)); |
2341 | 2341 |
2342 // Do the allocation of all three objects in one go. | 2342 // Do the allocation of all three objects in one go. |
2343 __ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT); | 2343 __ Allocate(r9, r0, r3, r4, &runtime, TAG_OBJECT); |
2344 | 2344 |
2345 // r0 = address of new object(s) (tagged) | 2345 // r0 = address of new object(s) (tagged) |
2346 // r2 = argument count (tagged) | 2346 // r2 = argument count (tagged) |
2347 // Get the arguments boilerplate from the current native context into r4. | 2347 // Get the arguments boilerplate from the current native context into r4. |
2348 const int kNormalOffset = | 2348 const int kNormalOffset = |
2349 Context::SlotOffset(Context::ARGUMENTS_BOILERPLATE_INDEX); | 2349 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX); |
2350 const int kAliasedOffset = | 2350 const int kAliasedOffset = |
2351 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); | 2351 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); |
2352 | 2352 |
2353 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2353 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2354 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2354 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
2355 __ cmp(r1, Operand::Zero()); | 2355 __ cmp(r1, Operand::Zero()); |
2356 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); | 2356 __ ldr(r4, MemOperand(r4, kNormalOffset), eq); |
2357 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); | 2357 __ ldr(r4, MemOperand(r4, kAliasedOffset), ne); |
2358 | 2358 |
2359 // r0 = address of new object (tagged) | 2359 // r0 = address of new object (tagged) |
(...skipping 15 matching lines...) Expand all Loading... |
2375 | 2375 |
2376 // Use the length (smi tagged) and set that as an in-object property too. | 2376 // Use the length (smi tagged) and set that as an in-object property too. |
2377 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2377 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2378 const int kLengthOffset = JSObject::kHeaderSize + | 2378 const int kLengthOffset = JSObject::kHeaderSize + |
2379 Heap::kArgumentsLengthIndex * kPointerSize; | 2379 Heap::kArgumentsLengthIndex * kPointerSize; |
2380 __ str(r2, FieldMemOperand(r0, kLengthOffset)); | 2380 __ str(r2, FieldMemOperand(r0, kLengthOffset)); |
2381 | 2381 |
2382 // Set up the elements pointer in the allocated arguments object. | 2382 // Set up the elements pointer in the allocated arguments object. |
2383 // If we allocated a parameter map, r4 will point there, otherwise | 2383 // If we allocated a parameter map, r4 will point there, otherwise |
2384 // it will point to the backing store. | 2384 // it will point to the backing store. |
2385 __ add(r4, r0, Operand(Heap::kArgumentsObjectSize)); | 2385 __ add(r4, r0, Operand(Heap::kSloppyArgumentsObjectSize)); |
2386 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2386 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
2387 | 2387 |
2388 // r0 = address of new object (tagged) | 2388 // r0 = address of new object (tagged) |
2389 // r1 = mapped parameter count (tagged) | 2389 // r1 = mapped parameter count (tagged) |
2390 // r2 = argument count (tagged) | 2390 // r2 = argument count (tagged) |
2391 // r4 = address of parameter map or backing store (tagged) | 2391 // r4 = address of parameter map or backing store (tagged) |
2392 // Initialize parameter map. If there are no mapped arguments, we're done. | 2392 // Initialize parameter map. If there are no mapped arguments, we're done. |
2393 Label skip_parameter_map; | 2393 Label skip_parameter_map; |
2394 __ cmp(r1, Operand(Smi::FromInt(0))); | 2394 __ cmp(r1, Operand(Smi::FromInt(0))); |
2395 // Move backing store address to r3, because it is | 2395 // Move backing store address to r3, because it is |
(...skipping 24 matching lines...) Expand all Loading... |
2420 __ add(r9, r9, Operand(Smi::FromInt(Context::MIN_CONTEXT_SLOTS))); | 2420 __ add(r9, r9, Operand(Smi::FromInt(Context::MIN_CONTEXT_SLOTS))); |
2421 __ sub(r9, r9, Operand(r1)); | 2421 __ sub(r9, r9, Operand(r1)); |
2422 __ LoadRoot(r5, Heap::kTheHoleValueRootIndex); | 2422 __ LoadRoot(r5, Heap::kTheHoleValueRootIndex); |
2423 __ add(r3, r4, Operand(r6, LSL, 1)); | 2423 __ add(r3, r4, Operand(r6, LSL, 1)); |
2424 __ add(r3, r3, Operand(kParameterMapHeaderSize)); | 2424 __ add(r3, r3, Operand(kParameterMapHeaderSize)); |
2425 | 2425 |
2426 // r6 = loop variable (tagged) | 2426 // r6 = loop variable (tagged) |
2427 // r1 = mapping index (tagged) | 2427 // r1 = mapping index (tagged) |
2428 // r3 = address of backing store (tagged) | 2428 // r3 = address of backing store (tagged) |
2429 // r4 = address of parameter map (tagged), which is also the address of new | 2429 // r4 = address of parameter map (tagged), which is also the address of new |
2430 // object + Heap::kArgumentsObjectSize (tagged) | 2430 // object + Heap::kSloppyArgumentsObjectSize (tagged) |
2431 // r0 = temporary scratch (a.o., for address calculation) | 2431 // r0 = temporary scratch (a.o., for address calculation) |
2432 // r5 = the hole value | 2432 // r5 = the hole value |
2433 __ jmp(¶meters_test); | 2433 __ jmp(¶meters_test); |
2434 | 2434 |
2435 __ bind(¶meters_loop); | 2435 __ bind(¶meters_loop); |
2436 __ sub(r6, r6, Operand(Smi::FromInt(1))); | 2436 __ sub(r6, r6, Operand(Smi::FromInt(1))); |
2437 __ mov(r0, Operand(r6, LSL, 1)); | 2437 __ mov(r0, Operand(r6, LSL, 1)); |
2438 __ add(r0, r0, Operand(kParameterMapHeaderSize - kHeapObjectTag)); | 2438 __ add(r0, r0, Operand(kParameterMapHeaderSize - kHeapObjectTag)); |
2439 __ str(r9, MemOperand(r4, r0)); | 2439 __ str(r9, MemOperand(r4, r0)); |
2440 __ sub(r0, r0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize)); | 2440 __ sub(r0, r0, Operand(kParameterMapHeaderSize - FixedArray::kHeaderSize)); |
2441 __ str(r5, MemOperand(r3, r0)); | 2441 __ str(r5, MemOperand(r3, r0)); |
2442 __ add(r9, r9, Operand(Smi::FromInt(1))); | 2442 __ add(r9, r9, Operand(Smi::FromInt(1))); |
2443 __ bind(¶meters_test); | 2443 __ bind(¶meters_test); |
2444 __ cmp(r6, Operand(Smi::FromInt(0))); | 2444 __ cmp(r6, Operand(Smi::FromInt(0))); |
2445 __ b(ne, ¶meters_loop); | 2445 __ b(ne, ¶meters_loop); |
2446 | 2446 |
2447 // Restore r0 = new object (tagged) | 2447 // Restore r0 = new object (tagged) |
2448 __ sub(r0, r4, Operand(Heap::kArgumentsObjectSize)); | 2448 __ sub(r0, r4, Operand(Heap::kSloppyArgumentsObjectSize)); |
2449 | 2449 |
2450 __ bind(&skip_parameter_map); | 2450 __ bind(&skip_parameter_map); |
2451 // r0 = address of new object (tagged) | 2451 // r0 = address of new object (tagged) |
2452 // r2 = argument count (tagged) | 2452 // r2 = argument count (tagged) |
2453 // r3 = address of backing store (tagged) | 2453 // r3 = address of backing store (tagged) |
2454 // r5 = scratch | 2454 // r5 = scratch |
2455 // Copy arguments header and remaining slots (if there are any). | 2455 // Copy arguments header and remaining slots (if there are any). |
2456 __ LoadRoot(r5, Heap::kFixedArrayMapRootIndex); | 2456 __ LoadRoot(r5, Heap::kFixedArrayMapRootIndex); |
2457 __ str(r5, FieldMemOperand(r3, FixedArray::kMapOffset)); | 2457 __ str(r5, FieldMemOperand(r3, FixedArray::kMapOffset)); |
2458 __ str(r2, FieldMemOperand(r3, FixedArray::kLengthOffset)); | 2458 __ str(r2, FieldMemOperand(r3, FixedArray::kLengthOffset)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 __ str(r3, MemOperand(sp, 1 * kPointerSize)); | 2511 __ str(r3, MemOperand(sp, 1 * kPointerSize)); |
2512 | 2512 |
2513 // Try the new space allocation. Start out with computing the size | 2513 // Try the new space allocation. Start out with computing the size |
2514 // of the arguments object and the elements array in words. | 2514 // of the arguments object and the elements array in words. |
2515 Label add_arguments_object; | 2515 Label add_arguments_object; |
2516 __ bind(&try_allocate); | 2516 __ bind(&try_allocate); |
2517 __ SmiUntag(r1, SetCC); | 2517 __ SmiUntag(r1, SetCC); |
2518 __ b(eq, &add_arguments_object); | 2518 __ b(eq, &add_arguments_object); |
2519 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); | 2519 __ add(r1, r1, Operand(FixedArray::kHeaderSize / kPointerSize)); |
2520 __ bind(&add_arguments_object); | 2520 __ bind(&add_arguments_object); |
2521 __ add(r1, r1, Operand(Heap::kArgumentsObjectSizeStrict / kPointerSize)); | 2521 __ add(r1, r1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
2522 | 2522 |
2523 // Do the allocation of both objects in one go. | 2523 // Do the allocation of both objects in one go. |
2524 __ Allocate(r1, r0, r2, r3, &runtime, | 2524 __ Allocate(r1, r0, r2, r3, &runtime, |
2525 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2525 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
2526 | 2526 |
2527 // Get the arguments boilerplate from the current native context. | 2527 // Get the arguments boilerplate from the current native context. |
2528 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2528 __ ldr(r4, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2529 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); | 2529 __ ldr(r4, FieldMemOperand(r4, GlobalObject::kNativeContextOffset)); |
2530 __ ldr(r4, MemOperand(r4, Context::SlotOffset( | 2530 __ ldr(r4, MemOperand(r4, Context::SlotOffset( |
2531 Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX))); | 2531 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX))); |
2532 | 2532 |
2533 // Copy the JS object part. | 2533 // Copy the JS object part. |
2534 __ CopyFields(r0, r4, d0, JSObject::kHeaderSize / kPointerSize); | 2534 __ CopyFields(r0, r4, d0, JSObject::kHeaderSize / kPointerSize); |
2535 | 2535 |
2536 // Get the length (smi tagged) and set that as an in-object property too. | 2536 // Get the length (smi tagged) and set that as an in-object property too. |
2537 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2537 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2538 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); | 2538 __ ldr(r1, MemOperand(sp, 0 * kPointerSize)); |
2539 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + | 2539 __ str(r1, FieldMemOperand(r0, JSObject::kHeaderSize + |
2540 Heap::kArgumentsLengthIndex * kPointerSize)); | 2540 Heap::kArgumentsLengthIndex * kPointerSize)); |
2541 | 2541 |
2542 // If there are no actual arguments, we're done. | 2542 // If there are no actual arguments, we're done. |
2543 Label done; | 2543 Label done; |
2544 __ cmp(r1, Operand::Zero()); | 2544 __ cmp(r1, Operand::Zero()); |
2545 __ b(eq, &done); | 2545 __ b(eq, &done); |
2546 | 2546 |
2547 // Get the parameters pointer from the stack. | 2547 // Get the parameters pointer from the stack. |
2548 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); | 2548 __ ldr(r2, MemOperand(sp, 1 * kPointerSize)); |
2549 | 2549 |
2550 // Set up the elements pointer in the allocated arguments object and | 2550 // Set up the elements pointer in the allocated arguments object and |
2551 // initialize the header in the elements fixed array. | 2551 // initialize the header in the elements fixed array. |
2552 __ add(r4, r0, Operand(Heap::kArgumentsObjectSizeStrict)); | 2552 __ add(r4, r0, Operand(Heap::kStrictArgumentsObjectSize)); |
2553 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); | 2553 __ str(r4, FieldMemOperand(r0, JSObject::kElementsOffset)); |
2554 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); | 2554 __ LoadRoot(r3, Heap::kFixedArrayMapRootIndex); |
2555 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); | 2555 __ str(r3, FieldMemOperand(r4, FixedArray::kMapOffset)); |
2556 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 2556 __ str(r1, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
2557 __ SmiUntag(r1); | 2557 __ SmiUntag(r1); |
2558 | 2558 |
2559 // Copy the fixed array slots. | 2559 // Copy the fixed array slots. |
2560 Label loop; | 2560 Label loop; |
2561 // Set up r4 to point to the first array slot. | 2561 // Set up r4 to point to the first array slot. |
2562 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 2562 __ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
(...skipping 3017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5580 MemOperand(fp, 6 * kPointerSize), | 5580 MemOperand(fp, 6 * kPointerSize), |
5581 NULL); | 5581 NULL); |
5582 } | 5582 } |
5583 | 5583 |
5584 | 5584 |
5585 #undef __ | 5585 #undef __ |
5586 | 5586 |
5587 } } // namespace v8::internal | 5587 } } // namespace v8::internal |
5588 | 5588 |
5589 #endif // V8_TARGET_ARCH_ARM | 5589 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |