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 2928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2939 | 2939 |
2940 NonexistentHandlerFrontend(object, last, name, &success, global); | 2940 NonexistentHandlerFrontend(object, last, name, &success, global); |
2941 | 2941 |
2942 __ bind(&success); | 2942 __ bind(&success); |
2943 // Return undefined if maps of the full prototype chain are still the | 2943 // Return undefined if maps of the full prototype chain are still the |
2944 // same and no global property with this name contains a value. | 2944 // same and no global property with this name contains a value. |
2945 __ mov(eax, isolate()->factory()->undefined_value()); | 2945 __ mov(eax, isolate()->factory()->undefined_value()); |
2946 __ ret(0); | 2946 __ ret(0); |
2947 | 2947 |
2948 // Return the generated code. | 2948 // Return the generated code. |
2949 return GetCode(Code::HANDLER_FRAGMENT, Code::NONEXISTENT, name); | 2949 return GetCode(kind(), Code::NONEXISTENT, name); |
2950 } | 2950 } |
2951 | 2951 |
2952 | 2952 |
2953 Register* LoadStubCompiler::registers() { | 2953 Register* LoadStubCompiler::registers() { |
2954 // receiver, name, scratch1, scratch2, scratch3, scratch4. | 2954 // receiver, name, scratch1, scratch2, scratch3, scratch4. |
2955 static Register registers[] = { edx, ecx, ebx, eax, edi, no_reg }; | 2955 static Register registers[] = { edx, ecx, ebx, eax, edi, no_reg }; |
2956 return registers; | 2956 return registers; |
2957 } | 2957 } |
2958 | 2958 |
2959 | 2959 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3039 | 3039 |
3040 HandlerFrontendFooter(&success, &miss); | 3040 HandlerFrontendFooter(&success, &miss); |
3041 __ bind(&success); | 3041 __ bind(&success); |
3042 | 3042 |
3043 Counters* counters = isolate()->counters(); | 3043 Counters* counters = isolate()->counters(); |
3044 __ IncrementCounter(counters->named_load_global_stub(), 1); | 3044 __ IncrementCounter(counters->named_load_global_stub(), 1); |
3045 // The code above already loads the result into the return register. | 3045 // The code above already loads the result into the return register. |
3046 __ ret(0); | 3046 __ ret(0); |
3047 | 3047 |
3048 // Return the generated code. | 3048 // Return the generated code. |
3049 return GetCode(Code::IC_FRAGMENT, Code::NORMAL, name); | 3049 return GetICCode(kind(), Code::NORMAL, name); |
3050 } | 3050 } |
3051 | 3051 |
3052 | 3052 |
3053 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( | 3053 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement( |
3054 Handle<Map> receiver_map) { | 3054 Handle<Map> receiver_map) { |
3055 // ----------- S t a t e ------------- | 3055 // ----------- S t a t e ------------- |
3056 // -- ecx : key | 3056 // -- ecx : key |
3057 // -- edx : receiver | 3057 // -- edx : receiver |
3058 // -- esp[0] : return address | 3058 // -- esp[0] : return address |
3059 // ----------------------------------- | 3059 // ----------------------------------- |
3060 | 3060 |
3061 ElementsKind elements_kind = receiver_map->elements_kind(); | 3061 ElementsKind elements_kind = receiver_map->elements_kind(); |
3062 if (receiver_map->has_fast_elements() || | 3062 if (receiver_map->has_fast_elements() || |
3063 receiver_map->has_external_array_elements()) { | 3063 receiver_map->has_external_array_elements()) { |
3064 Handle<Code> stub = KeyedLoadFastElementStub( | 3064 Handle<Code> stub = KeyedLoadFastElementStub( |
3065 receiver_map->instance_type() == JS_ARRAY_TYPE, | 3065 receiver_map->instance_type() == JS_ARRAY_TYPE, |
3066 elements_kind).GetCode(isolate()); | 3066 elements_kind).GetCode(isolate()); |
3067 __ DispatchMap(edx, receiver_map, stub, DO_SMI_CHECK); | 3067 __ DispatchMap(edx, receiver_map, stub, DO_SMI_CHECK); |
3068 } else { | 3068 } else { |
3069 Handle<Code> stub = | 3069 Handle<Code> stub = |
3070 KeyedLoadDictionaryElementStub().GetCode(isolate()); | 3070 KeyedLoadDictionaryElementStub().GetCode(isolate()); |
3071 __ DispatchMap(edx, receiver_map, stub, DO_SMI_CHECK); | 3071 __ DispatchMap(edx, receiver_map, stub, DO_SMI_CHECK); |
3072 } | 3072 } |
3073 | 3073 |
3074 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 3074 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
3075 | 3075 |
3076 // Return the generated code. | 3076 // Return the generated code. |
3077 return GetCode(Code::IC_FRAGMENT, Code::NORMAL, factory()->empty_string()); | 3077 return GetICCode(kind(), Code::NORMAL, factory()->empty_string()); |
3078 } | 3078 } |
3079 | 3079 |
3080 | 3080 |
3081 Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC( | 3081 Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC( |
3082 MapHandleList* receiver_maps, | 3082 MapHandleList* receiver_maps, |
3083 CodeHandleList* handlers, | 3083 CodeHandleList* handlers, |
3084 Handle<Name> name, | 3084 Handle<Name> name, |
3085 Code::StubType type, | 3085 Code::StubType type, |
3086 IcCheckType check) { | 3086 IcCheckType check) { |
3087 Label miss; | 3087 Label miss; |
(...skipping 10 matching lines...) Expand all Loading... |
3098 __ cmp(map_reg, receiver_maps->at(current)); | 3098 __ cmp(map_reg, receiver_maps->at(current)); |
3099 __ j(equal, handlers->at(current)); | 3099 __ j(equal, handlers->at(current)); |
3100 } | 3100 } |
3101 | 3101 |
3102 __ bind(&miss); | 3102 __ bind(&miss); |
3103 GenerateLoadMiss(masm(), kind()); | 3103 GenerateLoadMiss(masm(), kind()); |
3104 | 3104 |
3105 // Return the generated code. | 3105 // Return the generated code. |
3106 InlineCacheState state = | 3106 InlineCacheState state = |
3107 receiver_maps->length() > 1 ? POLYMORPHIC : MONOMORPHIC; | 3107 receiver_maps->length() > 1 ? POLYMORPHIC : MONOMORPHIC; |
3108 return GetCode(Code::IC_FRAGMENT, type, name, state); | 3108 return GetICCode(kind(), type, name, state); |
3109 } | 3109 } |
3110 | 3110 |
3111 | 3111 |
3112 // Specialized stub for constructing objects from functions which only have only | 3112 // Specialized stub for constructing objects from functions which only have only |
3113 // simple assignments of the form this.x = ...; in their body. | 3113 // simple assignments of the form this.x = ...; in their body. |
3114 Handle<Code> ConstructStubCompiler::CompileConstructStub( | 3114 Handle<Code> ConstructStubCompiler::CompileConstructStub( |
3115 Handle<JSFunction> function) { | 3115 Handle<JSFunction> function) { |
3116 // ----------- S t a t e ------------- | 3116 // ----------- S t a t e ------------- |
3117 // -- eax : argc | 3117 // -- eax : argc |
3118 // -- edi : constructor | 3118 // -- edi : constructor |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 __ jmp(ic_slow, RelocInfo::CODE_TARGET); | 3826 __ jmp(ic_slow, RelocInfo::CODE_TARGET); |
3827 } | 3827 } |
3828 } | 3828 } |
3829 | 3829 |
3830 | 3830 |
3831 #undef __ | 3831 #undef __ |
3832 | 3832 |
3833 } } // namespace v8::internal | 3833 } } // namespace v8::internal |
3834 | 3834 |
3835 #endif // V8_TARGET_ARCH_IA32 | 3835 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |