OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 __ Drop(4); | 591 __ Drop(4); |
592 } | 592 } |
593 | 593 |
594 | 594 |
595 // Generates call to FastHandleApiCall builtin. | 595 // Generates call to FastHandleApiCall builtin. |
596 static void GenerateFastApiCall(MacroAssembler* masm, | 596 static void GenerateFastApiCall(MacroAssembler* masm, |
597 const CallOptimization& optimization, | 597 const CallOptimization& optimization, |
598 int argc) { | 598 int argc) { |
599 // Get the function and setup the context. | 599 // Get the function and setup the context. |
600 JSFunction* function = optimization.constant_function(); | 600 JSFunction* function = optimization.constant_function(); |
601 __ mov(r7, Operand(Handle<JSFunction>(function))); | 601 __ mov(r5, Operand(Handle<JSFunction>(function))); |
602 __ ldr(cp, FieldMemOperand(r7, JSFunction::kContextOffset)); | 602 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); |
603 | 603 |
604 // Pass the additional arguments FastHandleApiCall expects. | 604 // Pass the additional arguments FastHandleApiCall expects. |
605 bool info_loaded = false; | 605 bool info_loaded = false; |
606 Object* callback = optimization.api_call_info()->callback(); | 606 Object* callback = optimization.api_call_info()->callback(); |
607 if (Heap::InNewSpace(callback)) { | 607 if (Heap::InNewSpace(callback)) { |
608 info_loaded = true; | 608 info_loaded = true; |
609 __ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info())); | 609 __ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info())); |
610 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kCallbackOffset)); | 610 __ ldr(r7, FieldMemOperand(r0, CallHandlerInfo::kCallbackOffset)); |
611 } else { | 611 } else { |
612 __ Move(r6, Handle<Object>(callback)); | 612 __ Move(r7, Handle<Object>(callback)); |
613 } | 613 } |
614 Object* call_data = optimization.api_call_info()->data(); | 614 Object* call_data = optimization.api_call_info()->data(); |
615 if (Heap::InNewSpace(call_data)) { | 615 if (Heap::InNewSpace(call_data)) { |
616 if (!info_loaded) { | 616 if (!info_loaded) { |
617 __ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info())); | 617 __ Move(r0, Handle<CallHandlerInfo>(optimization.api_call_info())); |
618 } | 618 } |
619 __ ldr(r5, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); | 619 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); |
620 } else { | 620 } else { |
621 __ Move(r5, Handle<Object>(call_data)); | 621 __ Move(r6, Handle<Object>(call_data)); |
622 } | 622 } |
623 | 623 |
624 __ add(sp, sp, Operand(1 * kPointerSize)); | 624 __ add(sp, sp, Operand(1 * kPointerSize)); |
625 __ stm(ia, sp, r5.bit() | r6.bit() | r7.bit()); | 625 __ stm(ia, sp, r5.bit() | r6.bit() | r7.bit()); |
626 __ sub(sp, sp, Operand(1 * kPointerSize)); | 626 __ sub(sp, sp, Operand(1 * kPointerSize)); |
627 | 627 |
628 // Set the number of arguments. | 628 // Set the number of arguments. |
629 __ mov(r0, Operand(argc + 4)); | 629 __ mov(r0, Operand(argc + 4)); |
630 | 630 |
631 // Jump to the fast api call builtin (tail call). | 631 // Jump to the fast api call builtin (tail call). |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 __ tst(receiver, Operand(kSmiTagMask)); | 1075 __ tst(receiver, Operand(kSmiTagMask)); |
1076 __ b(eq, miss); | 1076 __ b(eq, miss); |
1077 | 1077 |
1078 // Check that the maps haven't changed. | 1078 // Check that the maps haven't changed. |
1079 Register reg = | 1079 Register reg = |
1080 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3, | 1080 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3, |
1081 name, miss); | 1081 name, miss); |
1082 | 1082 |
1083 // Push the arguments on the JS stack of the caller. | 1083 // Push the arguments on the JS stack of the caller. |
1084 __ push(receiver); // Receiver. | 1084 __ push(receiver); // Receiver. |
1085 __ push(reg); // Holder. | 1085 __ mov(scratch3, Operand(Handle<AccessorInfo>(callback))); // callback data |
1086 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback data | 1086 __ ldr(ip, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); |
1087 __ ldr(reg, FieldMemOperand(ip, AccessorInfo::kDataOffset)); | 1087 __ Push(reg, ip, scratch3, name_reg); |
1088 __ Push(ip, reg, name_reg); | |
1089 | 1088 |
1090 // Do tail-call to the runtime system. | 1089 // Do tail-call to the runtime system. |
1091 ExternalReference load_callback_property = | 1090 ExternalReference load_callback_property = |
1092 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 1091 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
1093 __ TailCallExternalReference(load_callback_property, 5, 1); | 1092 __ TailCallExternalReference(load_callback_property, 5, 1); |
1094 | 1093 |
1095 return true; | 1094 return true; |
1096 } | 1095 } |
1097 | 1096 |
1098 | 1097 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 ASSERT(callback != NULL); | 1200 ASSERT(callback != NULL); |
1202 ASSERT(callback->getter() != NULL); | 1201 ASSERT(callback->getter() != NULL); |
1203 | 1202 |
1204 // Tail call to runtime. | 1203 // Tail call to runtime. |
1205 // Important invariant in CALLBACKS case: the code above must be | 1204 // Important invariant in CALLBACKS case: the code above must be |
1206 // structured to never clobber |receiver| register. | 1205 // structured to never clobber |receiver| register. |
1207 __ Move(scratch2, Handle<AccessorInfo>(callback)); | 1206 __ Move(scratch2, Handle<AccessorInfo>(callback)); |
1208 // holder_reg is either receiver or scratch1. | 1207 // holder_reg is either receiver or scratch1. |
1209 if (!receiver.is(holder_reg)) { | 1208 if (!receiver.is(holder_reg)) { |
1210 ASSERT(scratch1.is(holder_reg)); | 1209 ASSERT(scratch1.is(holder_reg)); |
1211 __ Push(receiver, holder_reg, scratch2); | 1210 __ Push(receiver, holder_reg); |
1212 __ ldr(scratch1, | 1211 __ ldr(scratch3, |
1213 FieldMemOperand(holder_reg, AccessorInfo::kDataOffset)); | 1212 FieldMemOperand(scratch2, AccessorInfo::kDataOffset)); |
1214 __ Push(scratch1, name_reg); | 1213 __ Push(scratch3, scratch2, name_reg); |
1215 } else { | 1214 } else { |
1216 __ push(receiver); | 1215 __ push(receiver); |
1217 __ ldr(scratch1, | 1216 __ ldr(scratch3, |
1218 FieldMemOperand(holder_reg, AccessorInfo::kDataOffset)); | 1217 FieldMemOperand(scratch2, AccessorInfo::kDataOffset)); |
1219 __ Push(holder_reg, scratch2, scratch1, name_reg); | 1218 __ Push(holder_reg, scratch3, scratch2, name_reg); |
1220 } | 1219 } |
1221 | 1220 |
1222 ExternalReference ref = | 1221 ExternalReference ref = |
1223 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 1222 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
1224 __ TailCallExternalReference(ref, 5, 1); | 1223 __ TailCallExternalReference(ref, 5, 1); |
1225 } | 1224 } |
1226 } else { // !compile_followup_inline | 1225 } else { // !compile_followup_inline |
1227 // Call the runtime system to load the interceptor. | 1226 // Call the runtime system to load the interceptor. |
1228 // Check that the maps haven't changed. | 1227 // Check that the maps haven't changed. |
1229 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, | 1228 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, |
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2880 // Return the generated code. | 2879 // Return the generated code. |
2881 return GetCode(); | 2880 return GetCode(); |
2882 } | 2881 } |
2883 | 2882 |
2884 | 2883 |
2885 #undef __ | 2884 #undef __ |
2886 | 2885 |
2887 } } // namespace v8::internal | 2886 } } // namespace v8::internal |
2888 | 2887 |
2889 #endif // V8_TARGET_ARCH_ARM | 2888 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |