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 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2895 __ DecrementCounter(&Counters::keyed_store_field, 1, r3, r4); | 2895 __ DecrementCounter(&Counters::keyed_store_field, 1, r3, r4); |
2896 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 2896 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
2897 | 2897 |
2898 __ Jump(ic, RelocInfo::CODE_TARGET); | 2898 __ Jump(ic, RelocInfo::CODE_TARGET); |
2899 | 2899 |
2900 // Return the generated code. | 2900 // Return the generated code. |
2901 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 2901 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
2902 } | 2902 } |
2903 | 2903 |
2904 | 2904 |
2905 MaybeObject* ConstructStubCompiler::CompileConstructStub( | 2905 MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) { |
2906 SharedFunctionInfo* shared) { | |
2907 // ----------- S t a t e ------------- | 2906 // ----------- S t a t e ------------- |
2908 // -- r0 : argc | 2907 // -- r0 : argc |
2909 // -- r1 : constructor | 2908 // -- r1 : constructor |
2910 // -- lr : return address | 2909 // -- lr : return address |
2911 // -- [sp] : last argument | 2910 // -- [sp] : last argument |
2912 // ----------------------------------- | 2911 // ----------------------------------- |
2913 Label generic_stub_call; | 2912 Label generic_stub_call; |
2914 | 2913 |
2915 // Use r7 for holding undefined which is used in several places below. | 2914 // Use r7 for holding undefined which is used in several places below. |
2916 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); | 2915 __ LoadRoot(r7, Heap::kUndefinedValueRootIndex); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2980 | 2979 |
2981 // Fill all the in-object properties with undefined. | 2980 // Fill all the in-object properties with undefined. |
2982 // r0: argc | 2981 // r0: argc |
2983 // r1: first argument | 2982 // r1: first argument |
2984 // r3: object size (in words) | 2983 // r3: object size (in words) |
2985 // r4: JSObject (not tagged) | 2984 // r4: JSObject (not tagged) |
2986 // r5: First in-object property of JSObject (not tagged) | 2985 // r5: First in-object property of JSObject (not tagged) |
2987 // r7: undefined | 2986 // r7: undefined |
2988 // Fill the initialized properties with a constant value or a passed argument | 2987 // Fill the initialized properties with a constant value or a passed argument |
2989 // depending on the this.x = ...; assignment in the function. | 2988 // depending on the this.x = ...; assignment in the function. |
| 2989 SharedFunctionInfo* shared = function->shared(); |
2990 for (int i = 0; i < shared->this_property_assignments_count(); i++) { | 2990 for (int i = 0; i < shared->this_property_assignments_count(); i++) { |
2991 if (shared->IsThisPropertyAssignmentArgument(i)) { | 2991 if (shared->IsThisPropertyAssignmentArgument(i)) { |
2992 Label not_passed, next; | 2992 Label not_passed, next; |
2993 // Check if the argument assigned to the property is actually passed. | 2993 // Check if the argument assigned to the property is actually passed. |
2994 int arg_number = shared->GetThisPropertyAssignmentArgument(i); | 2994 int arg_number = shared->GetThisPropertyAssignmentArgument(i); |
2995 __ cmp(r0, Operand(arg_number)); | 2995 __ cmp(r0, Operand(arg_number)); |
2996 __ b(le, ¬_passed); | 2996 __ b(le, ¬_passed); |
2997 // Argument passed - find it on the stack. | 2997 // Argument passed - find it on the stack. |
2998 __ ldr(r2, MemOperand(r1, (arg_number + 1) * -kPointerSize)); | 2998 __ ldr(r2, MemOperand(r1, (arg_number + 1) * -kPointerSize)); |
2999 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); | 2999 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); |
3000 __ b(&next); | 3000 __ b(&next); |
3001 __ bind(¬_passed); | 3001 __ bind(¬_passed); |
3002 // Set the property to undefined. | 3002 // Set the property to undefined. |
3003 __ str(r7, MemOperand(r5, kPointerSize, PostIndex)); | 3003 __ str(r7, MemOperand(r5, kPointerSize, PostIndex)); |
3004 __ bind(&next); | 3004 __ bind(&next); |
3005 } else { | 3005 } else { |
3006 // Set the property to the constant value. | 3006 // Set the property to the constant value. |
3007 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); | 3007 Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i)); |
3008 __ mov(r2, Operand(constant)); | 3008 __ mov(r2, Operand(constant)); |
3009 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); | 3009 __ str(r2, MemOperand(r5, kPointerSize, PostIndex)); |
3010 } | 3010 } |
3011 } | 3011 } |
3012 | 3012 |
3013 // Fill the unused in-object property fields with undefined. | 3013 // Fill the unused in-object property fields with undefined. |
| 3014 ASSERT(function->has_initial_map()); |
3014 for (int i = shared->this_property_assignments_count(); | 3015 for (int i = shared->this_property_assignments_count(); |
3015 i < shared->CalculateInObjectProperties(); | 3016 i < function->initial_map()->inobject_properties(); |
3016 i++) { | 3017 i++) { |
3017 __ str(r7, MemOperand(r5, kPointerSize, PostIndex)); | 3018 __ str(r7, MemOperand(r5, kPointerSize, PostIndex)); |
3018 } | 3019 } |
3019 | 3020 |
3020 // r0: argc | 3021 // r0: argc |
3021 // r4: JSObject (not tagged) | 3022 // r4: JSObject (not tagged) |
3022 // Move argc to r1 and the JSObject to return to r0 and tag it. | 3023 // Move argc to r1 and the JSObject to return to r0 and tag it. |
3023 __ mov(r1, r0); | 3024 __ mov(r1, r0); |
3024 __ mov(r0, r4); | 3025 __ mov(r0, r4); |
3025 __ orr(r0, r0, Operand(kHeapObjectTag)); | 3026 __ orr(r0, r0, Operand(kHeapObjectTag)); |
(...skipping 17 matching lines...) Expand all Loading... |
3043 // Return the generated code. | 3044 // Return the generated code. |
3044 return GetCode(); | 3045 return GetCode(); |
3045 } | 3046 } |
3046 | 3047 |
3047 | 3048 |
3048 #undef __ | 3049 #undef __ |
3049 | 3050 |
3050 } } // namespace v8::internal | 3051 } } // namespace v8::internal |
3051 | 3052 |
3052 #endif // V8_TARGET_ARCH_ARM | 3053 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |