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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // JumpToExternalReference expects r0 to contain the number of arguments | 68 // JumpToExternalReference expects r0 to contain the number of arguments |
69 // including the receiver and the extra arguments. | 69 // including the receiver and the extra arguments. |
70 __ add(r0, r0, Operand(num_extra_args + 1)); | 70 __ add(r0, r0, Operand(num_extra_args + 1)); |
71 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); | 71 __ JumpToExternalReference(ExternalReference(id, masm->isolate())); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 // Load the built-in InternalArray function from the current context. | 75 // Load the built-in InternalArray function from the current context. |
76 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, | 76 static void GenerateLoadInternalArrayFunction(MacroAssembler* masm, |
77 Register result) { | 77 Register result) { |
78 // Load the native context. | 78 // Load the global context. |
79 | 79 |
| 80 __ ldr(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
80 __ ldr(result, | 81 __ ldr(result, |
81 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 82 FieldMemOperand(result, GlobalObject::kGlobalContextOffset)); |
82 __ ldr(result, | 83 // Load the InternalArray function from the global context. |
83 FieldMemOperand(result, GlobalObject::kNativeContextOffset)); | |
84 // Load the InternalArray function from the native context. | |
85 __ ldr(result, | 84 __ ldr(result, |
86 MemOperand(result, | 85 MemOperand(result, |
87 Context::SlotOffset( | 86 Context::SlotOffset( |
88 Context::INTERNAL_ARRAY_FUNCTION_INDEX))); | 87 Context::INTERNAL_ARRAY_FUNCTION_INDEX))); |
89 } | 88 } |
90 | 89 |
91 | 90 |
92 // Load the built-in Array function from the current context. | 91 // Load the built-in Array function from the current context. |
93 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { | 92 static void GenerateLoadArrayFunction(MacroAssembler* masm, Register result) { |
94 // Load the native context. | 93 // Load the global context. |
95 | 94 |
| 95 __ ldr(result, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
96 __ ldr(result, | 96 __ ldr(result, |
97 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 97 FieldMemOperand(result, GlobalObject::kGlobalContextOffset)); |
98 __ ldr(result, | 98 // Load the Array function from the global context. |
99 FieldMemOperand(result, GlobalObject::kNativeContextOffset)); | |
100 // Load the Array function from the native context. | |
101 __ ldr(result, | 99 __ ldr(result, |
102 MemOperand(result, | 100 MemOperand(result, |
103 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | 101 Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); |
104 } | 102 } |
105 | 103 |
106 | 104 |
107 // Allocate an empty JSArray. The allocated array is put into the result | 105 // Allocate an empty JSArray. The allocated array is put into the result |
108 // register. An elements backing store is allocated with size initial_capacity | 106 // register. An elements backing store is allocated with size initial_capacity |
109 // and filled with the hole values. | 107 // and filled with the hole values. |
110 static void AllocateEmptyJSArray(MacroAssembler* masm, | 108 static void AllocateEmptyJSArray(MacroAssembler* masm, |
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 | 1396 |
1399 // Restore the function to r1, and the flag to r4. | 1397 // Restore the function to r1, and the flag to r4. |
1400 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1398 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
1401 __ mov(r4, Operand(0, RelocInfo::NONE)); | 1399 __ mov(r4, Operand(0, RelocInfo::NONE)); |
1402 __ jmp(&patch_receiver); | 1400 __ jmp(&patch_receiver); |
1403 | 1401 |
1404 // Use the global receiver object from the called function as the | 1402 // Use the global receiver object from the called function as the |
1405 // receiver. | 1403 // receiver. |
1406 __ bind(&use_global_receiver); | 1404 __ bind(&use_global_receiver); |
1407 const int kGlobalIndex = | 1405 const int kGlobalIndex = |
1408 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1406 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
1409 __ ldr(r2, FieldMemOperand(cp, kGlobalIndex)); | 1407 __ ldr(r2, FieldMemOperand(cp, kGlobalIndex)); |
1410 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset)); | 1408 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalContextOffset)); |
1411 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex)); | 1409 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex)); |
1412 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 1410 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
1413 | 1411 |
1414 __ bind(&patch_receiver); | 1412 __ bind(&patch_receiver); |
1415 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1413 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); |
1416 __ str(r2, MemOperand(r3, -kPointerSize)); | 1414 __ str(r2, MemOperand(r3, -kPointerSize)); |
1417 | 1415 |
1418 __ jmp(&shift_arguments); | 1416 __ jmp(&shift_arguments); |
1419 } | 1417 } |
1420 | 1418 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 // Convert the receiver to a regular object. | 1591 // Convert the receiver to a regular object. |
1594 // r0: receiver | 1592 // r0: receiver |
1595 __ bind(&call_to_object); | 1593 __ bind(&call_to_object); |
1596 __ push(r0); | 1594 __ push(r0); |
1597 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1595 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1598 __ b(&push_receiver); | 1596 __ b(&push_receiver); |
1599 | 1597 |
1600 // Use the current global receiver object as the receiver. | 1598 // Use the current global receiver object as the receiver. |
1601 __ bind(&use_global_receiver); | 1599 __ bind(&use_global_receiver); |
1602 const int kGlobalOffset = | 1600 const int kGlobalOffset = |
1603 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1601 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
1604 __ ldr(r0, FieldMemOperand(cp, kGlobalOffset)); | 1602 __ ldr(r0, FieldMemOperand(cp, kGlobalOffset)); |
1605 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset)); | 1603 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); |
1606 __ ldr(r0, FieldMemOperand(r0, kGlobalOffset)); | 1604 __ ldr(r0, FieldMemOperand(r0, kGlobalOffset)); |
1607 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 1605 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
1608 | 1606 |
1609 // Push the receiver. | 1607 // Push the receiver. |
1610 // r0: receiver | 1608 // r0: receiver |
1611 __ bind(&push_receiver); | 1609 __ bind(&push_receiver); |
1612 __ push(r0); | 1610 __ push(r0); |
1613 | 1611 |
1614 // Copy all arguments from the array to the stack. | 1612 // Copy all arguments from the array to the stack. |
1615 Label entry, loop; | 1613 Label entry, loop; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 __ bind(&dont_adapt_arguments); | 1797 __ bind(&dont_adapt_arguments); |
1800 __ Jump(r3); | 1798 __ Jump(r3); |
1801 } | 1799 } |
1802 | 1800 |
1803 | 1801 |
1804 #undef __ | 1802 #undef __ |
1805 | 1803 |
1806 } } // namespace v8::internal | 1804 } } // namespace v8::internal |
1807 | 1805 |
1808 #endif // V8_TARGET_ARCH_ARM | 1806 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |