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 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 } | 3092 } |
3093 | 3093 |
3094 | 3094 |
3095 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { | 3095 MaybeObject* KeyedLoadStubCompiler::CompileLoadElement(Map* receiver_map) { |
3096 // ----------- S t a t e ------------- | 3096 // ----------- S t a t e ------------- |
3097 // -- ra : return address | 3097 // -- ra : return address |
3098 // -- a0 : key | 3098 // -- a0 : key |
3099 // -- a1 : receiver | 3099 // -- a1 : receiver |
3100 // ----------------------------------- | 3100 // ----------------------------------- |
3101 Code* stub; | 3101 Code* stub; |
3102 MaybeObject* maybe_stub = ComputeSharedKeyedLoadElementStub(receiver_map); | 3102 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 3103 MaybeObject* maybe_stub = KeyedLoadElementStub(elements_kind).TryGetCode(); |
3103 if (!maybe_stub->To(&stub)) return maybe_stub; | 3104 if (!maybe_stub->To(&stub)) return maybe_stub; |
3104 __ DispatchMap(a1, | 3105 __ DispatchMap(a1, |
3105 a2, | 3106 a2, |
3106 Handle<Map>(receiver_map), | 3107 Handle<Map>(receiver_map), |
3107 Handle<Code>(stub), | 3108 Handle<Code>(stub), |
3108 DO_SMI_CHECK); | 3109 DO_SMI_CHECK); |
3109 | 3110 |
3110 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); | 3111 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Miss(); |
3111 __ Jump(ic, RelocInfo::CODE_TARGET); | 3112 __ Jump(ic, RelocInfo::CODE_TARGET); |
3112 | 3113 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 | 3184 |
3184 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { | 3185 MaybeObject* KeyedStoreStubCompiler::CompileStoreElement(Map* receiver_map) { |
3185 // ----------- S t a t e ------------- | 3186 // ----------- S t a t e ------------- |
3186 // -- a0 : value | 3187 // -- a0 : value |
3187 // -- a1 : key | 3188 // -- a1 : key |
3188 // -- a2 : receiver | 3189 // -- a2 : receiver |
3189 // -- ra : return address | 3190 // -- ra : return address |
3190 // -- a3 : scratch | 3191 // -- a3 : scratch |
3191 // ----------------------------------- | 3192 // ----------------------------------- |
3192 Code* stub; | 3193 Code* stub; |
3193 MaybeObject* maybe_stub = ComputeSharedKeyedStoreElementStub(receiver_map); | 3194 JSObject::ElementsKind elements_kind = receiver_map->elements_kind(); |
| 3195 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; |
| 3196 MaybeObject* maybe_stub = |
| 3197 KeyedStoreElementStub(is_js_array, elements_kind).TryGetCode(); |
3194 if (!maybe_stub->To(&stub)) return maybe_stub; | 3198 if (!maybe_stub->To(&stub)) return maybe_stub; |
3195 __ DispatchMap(a2, | 3199 __ DispatchMap(a2, |
3196 a3, | 3200 a3, |
3197 Handle<Map>(receiver_map), | 3201 Handle<Map>(receiver_map), |
3198 Handle<Code>(stub), | 3202 Handle<Code>(stub), |
3199 DO_SMI_CHECK); | 3203 DO_SMI_CHECK); |
3200 | 3204 |
3201 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); | 3205 Handle<Code> ic = isolate()->builtins()->KeyedStoreIC_Miss(); |
3202 __ Jump(ic, RelocInfo::CODE_TARGET); | 3206 __ Jump(ic, RelocInfo::CODE_TARGET); |
3203 | 3207 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 | 3387 |
3384 // Return the generated code. | 3388 // Return the generated code. |
3385 return GetCode(); | 3389 return GetCode(); |
3386 } | 3390 } |
3387 | 3391 |
3388 | 3392 |
3389 #undef __ | 3393 #undef __ |
3390 #define __ ACCESS_MASM(masm) | 3394 #define __ ACCESS_MASM(masm) |
3391 | 3395 |
3392 | 3396 |
| 3397 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( |
| 3398 MacroAssembler* masm) { |
| 3399 // ---------- S t a t e -------------- |
| 3400 // -- ra : return address |
| 3401 // -- a0 : key |
| 3402 // -- a1 : receiver |
| 3403 // ----------------------------------- |
| 3404 Label slow, miss_force_generic; |
| 3405 |
| 3406 Register key = a0; |
| 3407 Register receiver = a1; |
| 3408 |
| 3409 __ JumpIfNotSmi(key, &miss_force_generic); |
| 3410 __ lw(t0, FieldMemOperand(receiver, JSObject::kElementsOffset)); |
| 3411 __ sra(a2, a0, kSmiTagSize); |
| 3412 __ LoadFromNumberDictionary(&slow, t0, a0, v0, a2, a3, t1); |
| 3413 __ Ret(); |
| 3414 |
| 3415 // Slow case, key and receiver still in a0 and a1. |
| 3416 __ bind(&slow); |
| 3417 __ IncrementCounter( |
| 3418 masm->isolate()->counters()->keyed_load_external_array_slow(), |
| 3419 1, a2, a3); |
| 3420 // Entry registers are intact. |
| 3421 // ---------- S t a t e -------------- |
| 3422 // -- ra : return address |
| 3423 // -- a0 : key |
| 3424 // -- a1 : receiver |
| 3425 // ----------------------------------- |
| 3426 Handle<Code> slow_ic = |
| 3427 masm->isolate()->builtins()->KeyedLoadIC_Slow(); |
| 3428 __ Jump(slow_ic, RelocInfo::CODE_TARGET); |
| 3429 |
| 3430 // Miss case, call the runtime. |
| 3431 __ bind(&miss_force_generic); |
| 3432 |
| 3433 // ---------- S t a t e -------------- |
| 3434 // -- ra : return address |
| 3435 // -- a0 : key |
| 3436 // -- a1 : receiver |
| 3437 // ----------------------------------- |
| 3438 |
| 3439 Handle<Code> miss_ic = |
| 3440 masm->isolate()->builtins()->KeyedLoadIC_MissForceGeneric(); |
| 3441 __ Jump(miss_ic, RelocInfo::CODE_TARGET); |
| 3442 } |
| 3443 |
| 3444 |
3393 static bool IsElementTypeSigned(JSObject::ElementsKind elements_kind) { | 3445 static bool IsElementTypeSigned(JSObject::ElementsKind elements_kind) { |
3394 switch (elements_kind) { | 3446 switch (elements_kind) { |
3395 case JSObject::EXTERNAL_BYTE_ELEMENTS: | 3447 case JSObject::EXTERNAL_BYTE_ELEMENTS: |
3396 case JSObject::EXTERNAL_SHORT_ELEMENTS: | 3448 case JSObject::EXTERNAL_SHORT_ELEMENTS: |
3397 case JSObject::EXTERNAL_INT_ELEMENTS: | 3449 case JSObject::EXTERNAL_INT_ELEMENTS: |
3398 return true; | 3450 return true; |
3399 | 3451 |
3400 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3452 case JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
3401 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3453 case JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
3402 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3454 case JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS: |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4238 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); | 4290 masm->isolate()->builtins()->KeyedStoreIC_MissForceGeneric(); |
4239 __ Jump(ic, RelocInfo::CODE_TARGET); | 4291 __ Jump(ic, RelocInfo::CODE_TARGET); |
4240 } | 4292 } |
4241 | 4293 |
4242 | 4294 |
4243 #undef __ | 4295 #undef __ |
4244 | 4296 |
4245 } } // namespace v8::internal | 4297 } } // namespace v8::internal |
4246 | 4298 |
4247 #endif // V8_TARGET_ARCH_MIPS | 4299 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |