| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 descriptor->register_param_count_ = 2; | 56 descriptor->register_param_count_ = 2; |
| 57 descriptor->register_params_ = registers; | 57 descriptor->register_params_ = registers; |
| 58 Address entry = | 58 Address entry = |
| 59 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | 59 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
| 60 descriptor->deoptimization_handler_ = FUNCTION_ADDR(entry); | 60 descriptor->deoptimization_handler_ = FUNCTION_ADDR(entry); |
| 61 } | 61 } |
| 62 | 62 |
| 63 | 63 |
| 64 static void InitializeArrayConstructorDescriptor(Isolate* isolate, | 64 static void InitializeArrayConstructorDescriptor(Isolate* isolate, |
| 65 CodeStubInterfaceDescriptor* descriptor) { | 65 CodeStubInterfaceDescriptor* descriptor) { |
| 66 // register state |
| 67 // r1 -- constructor function |
| 68 // r2 -- type info cell with elements kind |
| 69 // r0 -- number of arguments to the constructor function |
| 66 static Register registers[] = { r1, r2 }; | 70 static Register registers[] = { r1, r2 }; |
| 67 descriptor->register_param_count_ = 2; | 71 descriptor->register_param_count_ = 2; |
| 68 // stack param count needs (constructor pointer, and single argument) | 72 // stack param count needs (constructor pointer, and single argument) |
| 69 descriptor->stack_parameter_count_ = &r0; | 73 descriptor->stack_parameter_count_ = &r0; |
| 70 descriptor->register_params_ = registers; | 74 descriptor->register_params_ = registers; |
| 71 descriptor->extra_expression_stack_count_ = 1; | 75 descriptor->extra_expression_stack_count_ = 1; |
| 72 descriptor->deoptimization_handler_ = | 76 descriptor->deoptimization_handler_ = |
| 73 FUNCTION_ADDR(ArrayConstructor_StubFailure); | 77 FUNCTION_ADDR(ArrayConstructor_StubFailure); |
| 74 } | 78 } |
| 75 | 79 |
| (...skipping 5556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5632 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); | 5636 __ CompareRoot(r3, Heap::kUndefinedValueRootIndex); |
| 5633 __ b(eq, &done); | 5637 __ b(eq, &done); |
| 5634 | 5638 |
| 5635 // Special handling of the Array() function, which caches not only the | 5639 // Special handling of the Array() function, which caches not only the |
| 5636 // monomorphic Array function but the initial ElementsKind with special | 5640 // monomorphic Array function but the initial ElementsKind with special |
| 5637 // sentinels | 5641 // sentinels |
| 5638 Handle<Object> terminal_kind_sentinel = | 5642 Handle<Object> terminal_kind_sentinel = |
| 5639 TypeFeedbackCells::MonomorphicArraySentinel(LAST_FAST_ELEMENTS_KIND); | 5643 TypeFeedbackCells::MonomorphicArraySentinel(LAST_FAST_ELEMENTS_KIND); |
| 5640 __ cmp(r3, Operand(terminal_kind_sentinel)); | 5644 __ cmp(r3, Operand(terminal_kind_sentinel)); |
| 5641 __ b(ne, &miss); | 5645 __ b(ne, &miss); |
| 5642 // Load the global or builtins object from the current context | |
| 5643 __ ldr(r3, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 5644 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalContextOffset)); | |
| 5645 // Make sure the function is the Array() function | 5646 // Make sure the function is the Array() function |
| 5646 __ ldr(r3, | 5647 __ LoadArrayFunction(r3); |
| 5647 MemOperand(r3, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | |
| 5648 __ cmp(r1, r3); | 5648 __ cmp(r1, r3); |
| 5649 Label megamorphic_pre; | 5649 __ b(ne, &megamorphic); |
| 5650 __ b(ne, &megamorphic_pre); | |
| 5651 __ jmp(&done); | 5650 __ jmp(&done); |
| 5652 | 5651 |
| 5653 __ bind(&megamorphic_pre); | |
| 5654 __ jmp(&megamorphic); | |
| 5655 | |
| 5656 __ bind(&miss); | 5652 __ bind(&miss); |
| 5657 | 5653 |
| 5658 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 5654 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 5659 // megamorphic. | 5655 // megamorphic. |
| 5660 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); | 5656 __ CompareRoot(r3, Heap::kTheHoleValueRootIndex); |
| 5661 __ b(eq, &initialize); | 5657 __ b(eq, &initialize); |
| 5662 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 5658 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 5663 // write-barrier is needed. | 5659 // write-barrier is needed. |
| 5664 __ bind(&megamorphic); | 5660 __ bind(&megamorphic); |
| 5665 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 5661 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
| 5666 __ str(ip, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); | 5662 __ str(ip, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); |
| 5667 | 5663 |
| 5668 // An uninitialized cache is patched with the function or sentinel to | 5664 // An uninitialized cache is patched with the function or sentinel to |
| 5669 // indicate the ElementsKind if function is the Array constructor. | 5665 // indicate the ElementsKind if function is the Array constructor. |
| 5670 __ bind(&initialize); | 5666 __ bind(&initialize); |
| 5671 __ ldr(r3, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | |
| 5672 __ ldr(r3, FieldMemOperand(r3, GlobalObject::kGlobalContextOffset)); | |
| 5673 __ ldr(r3, | |
| 5674 MemOperand(r3, Context::SlotOffset(Context::ARRAY_FUNCTION_INDEX))); | |
| 5675 // Make sure the function is the Array() function | 5667 // Make sure the function is the Array() function |
| 5668 __ LoadArrayFunction(r3); |
| 5676 __ cmp(r1, r3); | 5669 __ cmp(r1, r3); |
| 5677 __ b(ne, ¬_array_function); | 5670 __ b(ne, ¬_array_function); |
| 5678 | 5671 |
| 5679 // The target function is the Array constructor, install a sentinel value in | 5672 // The target function is the Array constructor, install a sentinel value in |
| 5680 // the constructor's type info cell that will track the initial ElementsKind | 5673 // the constructor's type info cell that will track the initial ElementsKind |
| 5681 // that should be used for the array when its constructed. | 5674 // that should be used for the array when its constructed. |
| 5682 Handle<Object> initial_kind_sentinel = | 5675 Handle<Object> initial_kind_sentinel = |
| 5683 TypeFeedbackCells::MonomorphicArraySentinel( | 5676 TypeFeedbackCells::MonomorphicArraySentinel( |
| 5684 GetInitialFastElementsKind()); | 5677 GetInitialFastElementsKind()); |
| 5685 __ mov(r3, Operand(initial_kind_sentinel)); | 5678 __ mov(r3, Operand(initial_kind_sentinel)); |
| (...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8026 | 8019 |
| 8027 __ Pop(lr, r5, r1); | 8020 __ Pop(lr, r5, r1); |
| 8028 __ Ret(); | 8021 __ Ret(); |
| 8029 } | 8022 } |
| 8030 | 8023 |
| 8031 #undef __ | 8024 #undef __ |
| 8032 | 8025 |
| 8033 } } // namespace v8::internal | 8026 } } // namespace v8::internal |
| 8034 | 8027 |
| 8035 #endif // V8_TARGET_ARCH_ARM | 8028 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |