OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2672 | 2672 |
2673 | 2673 |
2674 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { | 2674 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { |
2675 // ----------- S t a t e ------------- | 2675 // ----------- S t a t e ------------- |
2676 // -- eax : value | 2676 // -- eax : value |
2677 // -- ecx : key | 2677 // -- ecx : key |
2678 // -- edx : receiver | 2678 // -- edx : receiver |
2679 // -- esp[0] : return address | 2679 // -- esp[0] : return address |
2680 // ----------------------------------- | 2680 // ----------------------------------- |
2681 Code* stub; | 2681 Code* stub; |
2682 MaybeObject* maybe_stub = ComputeSharedKeyedStoreElementStub(receiver_map); | 2682 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 2683 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 2684 MaybeObject* maybe_stub = |
| 2685 KeyedStoreElementStub(is_jsarray, elements_kind).TryGetCode(); |
2683 if (!maybe_stub->To(&stub)) return maybe_stub; | 2686 if (!maybe_stub->To(&stub)) return maybe_stub; |
2684 __ DispatchMap(edx, | 2687 __ DispatchMap(edx, |
2685 Handle<Map>(receiver_map), | 2688 Handle<Map>(receiver_map), |
2686 Handle<Code>(stub), | 2689 Handle<Code>(stub), |
2687 DO_SMI_CHECK); | 2690 DO_SMI_CHECK); |
2688 | 2691 |
2689 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2692 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2690 __ jmp(ic, RelocInfo::CODE_TARGET); | 2693 __ jmp(ic, RelocInfo::CODE_TARGET); |
2691 | 2694 |
2692 // Return the generated code. | 2695 // Return the generated code. |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3130 } | 3133 } |
3131 | 3134 |
3132 | 3135 |
3133 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { | 3136 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { |
3134 // ----------- S t a t e ------------- | 3137 // ----------- S t a t e ------------- |
3135 // -- eax : key | 3138 // -- eax : key |
3136 // -- edx : receiver | 3139 // -- edx : receiver |
3137 // -- esp[0] : return address | 3140 // -- esp[0] : return address |
3138 // ----------------------------------- | 3141 // ----------------------------------- |
3139 Code* stub; | 3142 Code* stub; |
3140 MaybeObject* maybe_stub = ComputeSharedKeyedLoadElementStub(receiver_map); | 3143 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 3144 MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode(); |
3141 if (!maybe_stub->To(&stub)) return maybe_stub; | 3145 if (!maybe_stub->To(&stub)) return maybe_stub; |
3142 __ DispatchMap(edx, | 3146 __ DispatchMap(edx, |
3143 Handle<Map>(receiver_map), | 3147 Handle<Map>(receiver_map), |
3144 Handle<Code>(stub), | 3148 Handle<Code>(stub), |
3145 DO_SMI_CHECK); | 3149 DO_SMI_CHECK); |
3146 | 3150 |
3147 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3151 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3148 | 3152 |
3149 // Return the generated code. | 3153 // Return the generated code. |
3150 return GetCode(NORMAL, NULL); | 3154 return GetCode(NORMAL, NULL); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 | 3318 |
3315 // Return the generated code. | 3319 // Return the generated code. |
3316 return GetCode(); | 3320 return GetCode(); |
3317 } | 3321 } |
3318 | 3322 |
3319 | 3323 |
3320 #undef __ | 3324 #undef __ |
3321 #define __ ACCESS_MASM(masm) | 3325 #define __ ACCESS_MASM(masm) |
3322 | 3326 |
3323 | 3327 |
| 3328 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( |
| 3329 MacroAssembler* masm) { |
| 3330 // ----------- S t a t e ------------- |
| 3331 // -- eax : key |
| 3332 // -- edx : receiver |
| 3333 // -- esp[0] : return address |
| 3334 // ----------------------------------- |
| 3335 Label slow, miss_force_generic; |
| 3336 |
| 3337 // This stub is meant to be tail-jumped to, the receiver must already |
| 3338 // have been verified by the caller to not be a smi. |
| 3339 __ JumpIfNotSmi(eax, &miss_force_generic); |
| 3340 __ mov(ebx, eax); |
| 3341 __ SmiUntag(ebx); |
| 3342 __ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 3343 |
| 3344 // Push receiver on the stack to free up a register for the dictionary |
| 3345 // probing. |
| 3346 __ push(edx); |
| 3347 __ LoadFromNumberDictionary(&slow, |
| 3348 ecx, |
| 3349 eax, |
| 3350 ebx, |
| 3351 edx, |
| 3352 edi, |
| 3353 eax); |
| 3354 // Pop receiver before returning. |
| 3355 __ pop(edx); |
| 3356 __ ret(0); |
| 3357 |
| 3358 __ bind(&slow); |
| 3359 __ pop(edx); |
| 3360 |
| 3361 // ----------- S t a t e ------------- |
| 3362 // -- eax : value |
| 3363 // -- ecx : key |
| 3364 // -- edx : receiver |
| 3365 // -- esp[0] : return address |
| 3366 // ----------------------------------- |
| 3367 |
| 3368 Handle<Code> slow_ic = |
| 3369 masm->isolate()->builtins()->KeyedLoadIC_Slow(); |
| 3370 __ jmp(slow_ic, RelocInfo::CODE_TARGET); |
| 3371 |
| 3372 __ bind(&miss_force_generic); |
| 3373 // ----------- S t a t e ------------- |
| 3374 // -- eax : value |
| 3375 // -- ecx : key |
| 3376 // -- edx : receiver |
| 3377 // -- esp[0] : return address |
| 3378 // ----------------------------------- |
| 3379 |
| 3380 Handle<Code> miss_force_generic_ic = |
| 3381 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); |
| 3382 __ jmp(miss_force_generic_ic, RelocInfo::CODE_TARGET); |
| 3383 } |
| 3384 |
| 3385 |
3324 void KeyedLoadStubCompiler::GenerateLoadExternalArray( | 3386 void KeyedLoadStubCompiler::GenerateLoadExternalArray( |
3325 MacroAssembler* masm, | 3387 MacroAssembler* masm, |
3326 JSObject::ElementsKind elements_kind) { | 3388 JSObject::ElementsKind elements_kind) { |
3327 // ----------- S t a t e ------------- | 3389 // ----------- S t a t e ------------- |
3328 // -- eax : key | 3390 // -- eax : key |
3329 // -- edx : receiver | 3391 // -- edx : receiver |
3330 // -- esp[0] : return address | 3392 // -- esp[0] : return address |
3331 // ----------------------------------- | 3393 // ----------------------------------- |
3332 Label miss_force_generic, failed_allocation, slow; | 3394 Label miss_force_generic, failed_allocation, slow; |
3333 | 3395 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3724 __ bind(&miss_force_generic); | 3786 __ bind(&miss_force_generic); |
3725 Handle<Code> miss_ic = | 3787 Handle<Code> miss_ic = |
3726 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); | 3788 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); |
3727 __ jmp(miss_ic, RelocInfo::CODE_TARGET); | 3789 __ jmp(miss_ic, RelocInfo::CODE_TARGET); |
3728 } | 3790 } |
3729 | 3791 |
3730 | 3792 |
3731 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, | 3793 void KeyedStoreStubCompiler::GenerateStoreFastElement(MacroAssembler* masm, |
3732 bool is_js_array) { | 3794 bool is_js_array) { |
3733 // ----------- S t a t e ------------- | 3795 // ----------- S t a t e ------------- |
3734 // -- eax : key | 3796 // -- eax : value |
| 3797 // -- ecx : key |
3735 // -- edx : receiver | 3798 // -- edx : receiver |
3736 // -- esp[0] : return address | 3799 // -- esp[0] : return address |
3737 // ----------------------------------- | 3800 // ----------------------------------- |
3738 Label miss_force_generic; | 3801 Label miss_force_generic; |
3739 | 3802 |
3740 // This stub is meant to be tail-jumped to, the receiver must already | 3803 // This stub is meant to be tail-jumped to, the receiver must already |
3741 // have been verified by the caller to not be a smi. | 3804 // have been verified by the caller to not be a smi. |
3742 | 3805 |
3743 // Check that the key is a smi. | 3806 // Check that the key is a smi. |
3744 __ JumpIfNotSmi(ecx, &miss_force_generic); | 3807 __ JumpIfNotSmi(ecx, &miss_force_generic); |
(...skipping 29 matching lines...) Expand all Loading... |
3774 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3837 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3775 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3838 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3776 } | 3839 } |
3777 | 3840 |
3778 | 3841 |
3779 #undef __ | 3842 #undef __ |
3780 | 3843 |
3781 } } // namespace v8::internal | 3844 } } // namespace v8::internal |
3782 | 3845 |
3783 #endif // V8_TARGET_ARCH_IA32 | 3846 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |