OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm/lithium-codegen-arm.h" | 7 #include "src/arm/lithium-codegen-arm.h" |
8 #include "src/arm/lithium-gap-resolver-arm.h" | 8 #include "src/arm/lithium-gap-resolver-arm.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 3125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3136 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3136 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3137 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 3137 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
3138 } | 3138 } |
3139 | 3139 |
3140 | 3140 |
3141 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3141 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3142 Register scratch = scratch0(); | 3142 Register scratch = scratch0(); |
3143 Register function = ToRegister(instr->function()); | 3143 Register function = ToRegister(instr->function()); |
3144 Register result = ToRegister(instr->result()); | 3144 Register result = ToRegister(instr->result()); |
3145 | 3145 |
3146 // Check that the function really is a function. Load map into the | |
3147 // result register. | |
3148 __ CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE); | |
3149 DeoptimizeIf(ne, instr->environment()); | |
3150 | |
3151 // Make sure that the function has an instance prototype. | |
3152 Label non_instance; | |
3153 __ ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); | |
3154 __ tst(scratch, Operand(1 << Map::kHasNonInstancePrototype)); | |
3155 __ b(ne, &non_instance); | |
3156 | |
3157 // Get the prototype or initial map from the function. | 3146 // Get the prototype or initial map from the function. |
3158 __ ldr(result, | 3147 __ ldr(result, |
3159 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3148 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
3160 | 3149 |
3161 // Check that the function has a prototype or an initial map. | 3150 // Check that the function has a prototype or an initial map. |
3162 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3151 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
3163 __ cmp(result, ip); | 3152 __ cmp(result, ip); |
3164 DeoptimizeIf(eq, instr->environment()); | 3153 DeoptimizeIf(eq, instr->environment()); |
3165 | 3154 |
3166 // If the function does not have an initial map, we're done. | 3155 // If the function does not have an initial map, we're done. |
3167 Label done; | 3156 Label done; |
3168 __ CompareObjectType(result, scratch, scratch, MAP_TYPE); | 3157 __ CompareObjectType(result, scratch, scratch, MAP_TYPE); |
3169 __ b(ne, &done); | 3158 __ b(ne, &done); |
3170 | 3159 |
3171 // Get the prototype from the initial map. | 3160 // Get the prototype from the initial map. |
3172 __ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); | 3161 __ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset)); |
3173 __ jmp(&done); | |
3174 | |
3175 // Non-instance prototype: Fetch prototype from constructor field | |
3176 // in initial map. | |
3177 __ bind(&non_instance); | |
3178 __ ldr(result, FieldMemOperand(result, Map::kConstructorOffset)); | |
3179 | 3162 |
3180 // All done. | 3163 // All done. |
3181 __ bind(&done); | 3164 __ bind(&done); |
3182 } | 3165 } |
3183 | 3166 |
3184 | 3167 |
3185 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3168 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
3186 Register result = ToRegister(instr->result()); | 3169 Register result = ToRegister(instr->result()); |
3187 __ LoadRoot(result, instr->index()); | 3170 __ LoadRoot(result, instr->index()); |
3188 } | 3171 } |
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5890 __ Push(scope_info); | 5873 __ Push(scope_info); |
5891 __ push(ToRegister(instr->function())); | 5874 __ push(ToRegister(instr->function())); |
5892 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5875 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5893 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5876 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5894 } | 5877 } |
5895 | 5878 |
5896 | 5879 |
5897 #undef __ | 5880 #undef __ |
5898 | 5881 |
5899 } } // namespace v8::internal | 5882 } } // namespace v8::internal |
OLD | NEW |