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 2520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2531 | 2531 |
2532 | 2532 |
2533 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { | 2533 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { |
2534 // ----------- S t a t e ------------- | 2534 // ----------- S t a t e ------------- |
2535 // -- rax : value | 2535 // -- rax : value |
2536 // -- rcx : key | 2536 // -- rcx : key |
2537 // -- rdx : receiver | 2537 // -- rdx : receiver |
2538 // -- rsp[0] : return address | 2538 // -- rsp[0] : return address |
2539 // ----------------------------------- | 2539 // ----------------------------------- |
2540 Code* stub; | 2540 Code* stub; |
2541 MaybeObject* maybe_stub = ComputeSharedKeyedStoreElementStub(receiver_map); | 2541 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 2542 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 2543 MaybeObject* maybe_stub = |
| 2544 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); |
2542 if (!maybe_stub->To(&stub)) return maybe_stub; | 2545 if (!maybe_stub->To(&stub)) return maybe_stub; |
2543 __ DispatchMap(rdx, | 2546 __ DispatchMap(rdx, |
2544 Handle<Map>(receiver_map), | 2547 Handle<Map>(receiver_map), |
2545 Handle<Code>(stub), | 2548 Handle<Code>(stub), |
2546 DO_SMI_CHECK); | 2549 DO_SMI_CHECK); |
2547 | 2550 |
2548 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 2551 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
2549 __ jmp(ic, RelocInfo::CODE_TARGET); | 2552 __ jmp(ic, RelocInfo::CODE_TARGET); |
2550 | 2553 |
2551 // Return the generated code. | 2554 // Return the generated code. |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2987 } | 2990 } |
2988 | 2991 |
2989 | 2992 |
2990 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { | 2993 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { |
2991 // ----------- S t a t e ------------- | 2994 // ----------- S t a t e ------------- |
2992 // -- rax : key | 2995 // -- rax : key |
2993 // -- rdx : receiver | 2996 // -- rdx : receiver |
2994 // -- rsp[0] : return address | 2997 // -- rsp[0] : return address |
2995 // ----------------------------------- | 2998 // ----------------------------------- |
2996 Code* stub; | 2999 Code* stub; |
2997 MaybeObject* maybe_stub = ComputeSharedKeyedLoadElementStub(receiver_map); | 3000 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 3001 MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode(); |
2998 if (!maybe_stub->To(&stub)) return maybe_stub; | 3002 if (!maybe_stub->To(&stub)) return maybe_stub; |
2999 __ DispatchMap(rdx, | 3003 __ DispatchMap(rdx, |
3000 Handle<Map>(receiver_map), | 3004 Handle<Map>(receiver_map), |
3001 Handle<Code>(stub), | 3005 Handle<Code>(stub), |
3002 DO_SMI_CHECK); | 3006 DO_SMI_CHECK); |
3003 | 3007 |
3004 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3008 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3005 __ jmp(ic, RelocInfo::CODE_TARGET); | 3009 __ jmp(ic, RelocInfo::CODE_TARGET); |
3006 | 3010 |
3007 // Return the generated code. | 3011 // Return the generated code. |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3170 | 3174 |
3171 // Return the generated code. | 3175 // Return the generated code. |
3172 return GetCode(); | 3176 return GetCode(); |
3173 } | 3177 } |
3174 | 3178 |
3175 | 3179 |
3176 #undef __ | 3180 #undef __ |
3177 #define __ ACCESS_MASM(masm) | 3181 #define __ ACCESS_MASM(masm) |
3178 | 3182 |
3179 | 3183 |
| 3184 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( |
| 3185 MacroAssembler* masm) { |
| 3186 // ----------- S t a t e ------------- |
| 3187 // -- rax : key |
| 3188 // -- rdx : receiver |
| 3189 // -- rsp[0] : return address |
| 3190 // ----------------------------------- |
| 3191 Label slow, miss_force_generic; |
| 3192 |
| 3193 // This stub is meant to be tail-jumped to, the receiver must already |
| 3194 // have been verified by the caller to not be a smi. |
| 3195 |
| 3196 __ JumpIfNotSmi(rax, &miss_force_generic); |
| 3197 __ SmiToInteger32(rbx, rax); |
| 3198 __ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); |
| 3199 |
| 3200 // Check whether the elements is a number dictionary. |
| 3201 // rdx: receiver |
| 3202 // rax: key |
| 3203 // rbx: key as untagged int32 |
| 3204 // rcx: elements |
| 3205 __ LoadFromNumberDictionary(&slow, rcx, rax, rbx, r9, rdi, rax); |
| 3206 __ ret(0); |
| 3207 |
| 3208 __ bind(&slow); |
| 3209 // ----------- S t a t e ------------- |
| 3210 // -- rax : key |
| 3211 // -- rdx : receiver |
| 3212 // -- rsp[0] : return address |
| 3213 // ----------------------------------- |
| 3214 Handle<Code> slow_ic = |
| 3215 masm->isolate()->builtins()->KeyedLoadIC_Slow(); |
| 3216 __ jmp(slow_ic, RelocInfo::CODE_TARGET); |
| 3217 |
| 3218 __ bind(&miss_force_generic); |
| 3219 // ----------- S t a t e ------------- |
| 3220 // -- rax : key |
| 3221 // -- rdx : receiver |
| 3222 // -- rsp[0] : return address |
| 3223 // ----------------------------------- |
| 3224 Handle<Code> miss_ic = |
| 3225 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); |
| 3226 __ jmp(miss_ic, RelocInfo::CODE_TARGET); |
| 3227 } |
| 3228 |
3180 void KeyedLoadStubCompiler::GenerateLoadExternalArray( | 3229 void KeyedLoadStubCompiler::GenerateLoadExternalArray( |
3181 MacroAssembler* masm, | 3230 MacroAssembler* masm, |
3182 JSObject::ElementsKind elements_kind) { | 3231 JSObject::ElementsKind elements_kind) { |
3183 // ----------- S t a t e ------------- | 3232 // ----------- S t a t e ------------- |
3184 // -- rax : key | 3233 // -- rax : key |
3185 // -- rdx : receiver | 3234 // -- rdx : receiver |
3186 // -- rsp[0] : return address | 3235 // -- rsp[0] : return address |
3187 // ----------------------------------- | 3236 // ----------------------------------- |
3188 Label slow, miss_force_generic; | 3237 Label slow, miss_force_generic; |
3189 | 3238 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3583 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 3632 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
3584 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); | 3633 __ jmp(ic_force_generic, RelocInfo::CODE_TARGET); |
3585 } | 3634 } |
3586 | 3635 |
3587 | 3636 |
3588 #undef __ | 3637 #undef __ |
3589 | 3638 |
3590 } } // namespace v8::internal | 3639 } } // namespace v8::internal |
3591 | 3640 |
3592 #endif // V8_TARGET_ARCH_X64 | 3641 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |