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 3082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3093 } | 3093 } |
3094 | 3094 |
3095 | 3095 |
3096 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { | 3096 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { |
3097 // ----------- S t a t e ------------- | 3097 // ----------- S t a t e ------------- |
3098 // -- lr : return address | 3098 // -- lr : return address |
3099 // -- r0 : key | 3099 // -- r0 : key |
3100 // -- r1 : receiver | 3100 // -- r1 : receiver |
3101 // ----------------------------------- | 3101 // ----------------------------------- |
3102 Code* stub; | 3102 Code* stub; |
3103 MaybeObject* maybe_stub = ComputeSharedKeyedLoadElementStub(receiver_map); | 3103 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 3104 MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode(); |
3104 if (!maybe_stub->To(&stub)) return maybe_stub; | 3105 if (!maybe_stub->To(&stub)) return maybe_stub; |
3105 __ DispatchMap(r1, | 3106 __ DispatchMap(r1, |
3106 r2, | 3107 r2, |
3107 Handle<Map>(receiver_map), | 3108 Handle<Map>(receiver_map), |
3108 Handle<Code>(stub), | 3109 Handle<Code>(stub), |
3109 DO_SMI_CHECK); | 3110 DO_SMI_CHECK); |
3110 | 3111 |
3111 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3112 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3112 __ Jump(ic, RelocInfo::CODE_TARGET); | 3113 __ Jump(ic, RelocInfo::CODE_TARGET); |
3113 | 3114 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3186 | 3187 |
3187 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { | 3188 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { |
3188 // ----------- S t a t e ------------- | 3189 // ----------- S t a t e ------------- |
3189 // -- r0 : value | 3190 // -- r0 : value |
3190 // -- r1 : key | 3191 // -- r1 : key |
3191 // -- r2 : receiver | 3192 // -- r2 : receiver |
3192 // -- lr : return address | 3193 // -- lr : return address |
3193 // -- r3 : scratch | 3194 // -- r3 : scratch |
3194 // ----------------------------------- | 3195 // ----------------------------------- |
3195 Code* stub; | 3196 Code* stub; |
3196 MaybeObject* maybe_stub = ComputeSharedKeyedStoreElementStub(receiver_map); | 3197 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 3198 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 3199 MaybeObject* maybe_stub = |
| 3200 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); |
3197 if (!maybe_stub->To(&stub)) return maybe_stub; | 3201 if (!maybe_stub->To(&stub)) return maybe_stub; |
3198 __ DispatchMap(r2, | 3202 __ DispatchMap(r2, |
3199 r3, | 3203 r3, |
3200 Handle<Map>(receiver_map), | 3204 Handle<Map>(receiver_map), |
3201 Handle<Code>(stub), | 3205 Handle<Code>(stub), |
3202 DO_SMI_CHECK); | 3206 DO_SMI_CHECK); |
3203 | 3207 |
3204 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 3208 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
3205 __ Jump(ic, RelocInfo::CODE_TARGET); | 3209 __ Jump(ic, RelocInfo::CODE_TARGET); |
3206 | 3210 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3381 | 3385 |
3382 // Return the generated code. | 3386 // Return the generated code. |
3383 return GetCode(); | 3387 return GetCode(); |
3384 } | 3388 } |
3385 | 3389 |
3386 | 3390 |
3387 #undef __ | 3391 #undef __ |
3388 #define __ ACCESS_MASM(masm) | 3392 #define __ ACCESS_MASM(masm) |
3389 | 3393 |
3390 | 3394 |
| 3395 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( |
| 3396 MacroAssembler* masm) { |
| 3397 // ---------- S t a t e -------------- |
| 3398 // -- lr : return address |
| 3399 // -- r0 : key |
| 3400 // -- r1 : receiver |
| 3401 // ----------------------------------- |
| 3402 Label slow, miss_force_generic; |
| 3403 |
| 3404 Register key = r0; |
| 3405 Register receiver = r1; |
| 3406 |
| 3407 __ JumpIfNotSmi(key, &miss_force_generic); |
| 3408 __ mov(r2, Operand(key, ASR, kSmiTagSize)); |
| 3409 __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 3410 __ LoadFromNumberDictionary(&slow, r4, key, r0, r2, r3, r5); |
| 3411 __ Ret(); |
| 3412 |
| 3413 __ bind(&slow); |
| 3414 __ IncrementCounter( |
| 3415 masm->isolate()->counters()->keyed_load_external_array_slow(), |
| 3416 1, r2, r3); |
| 3417 |
| 3418 // ---------- S t a t e -------------- |
| 3419 // -- lr : return address |
| 3420 // -- r0 : key |
| 3421 // -- r1 : receiver |
| 3422 // ----------------------------------- |
| 3423 Handle<Code> slow_ic = |
| 3424 masm->isolate()->builtins()->KeyedLoadIC_Slow(); |
| 3425 __ Jump(slow_ic, RelocInfo::CODE_TARGET); |
| 3426 |
| 3427 // Miss case, call the runtime. |
| 3428 __ bind(&miss_force_generic); |
| 3429 |
| 3430 // ---------- S t a t e -------------- |
| 3431 // -- lr : return address |
| 3432 // -- r0 : key |
| 3433 // -- r1 : receiver |
| 3434 // ----------------------------------- |
| 3435 |
| 3436 Handle<Code> miss_ic = |
| 3437 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); |
| 3438 __ Jump(miss_ic, RelocInfo::CODE_TARGET); |
| 3439 } |
| 3440 |
| 3441 |
3391 static bool IsElementTypeSigned(JSObject::ElementsKind elements_kind) { | 3442 static bool IsElementTypeSigned(JSObject::ElementsKind elements_kind) { |
3392 switch (elements_kind) { | 3443 switch (elements_kind) { |
3393 case JSObject::EXTERNAL_BYTE_ELEMENTS: | 3444 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
3394 case JSObject::EXTERNAL_SHORT_ELEMENTS: | 3445 case JSObject::EXTERNAL_SHORT_ELEMENTS: |
3395 case JSObject::EXTERNAL_INT_ELEMENTS: | 3446 case JSObject::EXTERNAL_INT_ELEMENTS: |
3396 return true; | 3447 return true; |
3397 | 3448 |
3398 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3449 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
3399 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3450 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
3400 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3451 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4178 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 4229 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
4179 __ Jump(ic, RelocInfo::CODE_TARGET); | 4230 __ Jump(ic, RelocInfo::CODE_TARGET); |
4180 } | 4231 } |
4181 | 4232 |
4182 | 4233 |
4183 #undef __ | 4234 #undef __ |
4184 | 4235 |
4185 } } // namespace v8::internal | 4236 } } // namespace v8::internal |
4186 | 4237 |
4187 #endif // V8_TARGET_ARCH_ARM | 4238 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |