OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 3039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3050 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3050 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3051 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3051 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3052 } | 3052 } |
3053 | 3053 |
3054 | 3054 |
3055 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3055 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3056 Register scratch = scratch0(); | 3056 Register scratch = scratch0(); |
3057 Register function = ToRegister(instr->function()); | 3057 Register function = ToRegister(instr->function()); |
3058 Register result = ToRegister(instr->result()); | 3058 Register result = ToRegister(instr->result()); |
3059 | 3059 |
3060 // Check that the function really is a function. Load map into the | |
3061 // result register. | |
3062 __ GetObjectType(function, result, scratch); | |
3063 DeoptimizeIf(ne, instr->environment(), scratch, Operand(JS_FUNCTION_TYPE)); | |
3064 | |
3065 // Make sure that the function has an instance prototype. | |
3066 Label non_instance; | |
3067 __ lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); | |
3068 __ And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype)); | |
3069 __ Branch(&non_instance, ne, scratch, Operand(zero_reg)); | |
3070 | |
3071 // Get the prototype or initial map from the function. | 3060 // Get the prototype or initial map from the function. |
3072 __ lw(result, | 3061 __ lw(result, |
3073 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3062 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
3074 | 3063 |
3075 // Check that the function has a prototype or an initial map. | 3064 // Check that the function has a prototype or an initial map. |
3076 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 3065 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
3077 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); | 3066 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); |
3078 | 3067 |
3079 // If the function does not have an initial map, we're done. | 3068 // If the function does not have an initial map, we're done. |
3080 Label done; | 3069 Label done; |
3081 __ GetObjectType(result, scratch, scratch); | 3070 __ GetObjectType(result, scratch, scratch); |
3082 __ Branch(&done, ne, scratch, Operand(MAP_TYPE)); | 3071 __ Branch(&done, ne, scratch, Operand(MAP_TYPE)); |
3083 | 3072 |
3084 // Get the prototype from the initial map. | 3073 // Get the prototype from the initial map. |
3085 __ lw(result, FieldMemOperand(result, Map::kPrototypeOffset)); | 3074 __ lw(result, FieldMemOperand(result, Map::kPrototypeOffset)); |
3086 __ Branch(&done); | |
3087 | |
3088 // Non-instance prototype: Fetch prototype from constructor field | |
3089 // in initial map. | |
3090 __ bind(&non_instance); | |
3091 __ lw(result, FieldMemOperand(result, Map::kConstructorOffset)); | |
3092 | 3075 |
3093 // All done. | 3076 // All done. |
3094 __ bind(&done); | 3077 __ bind(&done); |
3095 } | 3078 } |
3096 | 3079 |
3097 | 3080 |
3098 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3081 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
3099 Register result = ToRegister(instr->result()); | 3082 Register result = ToRegister(instr->result()); |
3100 __ LoadRoot(result, instr->index()); | 3083 __ LoadRoot(result, instr->index()); |
3101 } | 3084 } |
(...skipping 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5921 __ li(at, scope_info); | 5904 __ li(at, scope_info); |
5922 __ Push(at, ToRegister(instr->function())); | 5905 __ Push(at, ToRegister(instr->function())); |
5923 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5906 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5924 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5907 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5925 } | 5908 } |
5926 | 5909 |
5927 | 5910 |
5928 #undef __ | 5911 #undef __ |
5929 | 5912 |
5930 } } // namespace v8::internal | 5913 } } // namespace v8::internal |
OLD | NEW |