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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/hydrogen-osr.h" | 8 #include "src/hydrogen-osr.h" |
9 #include "src/mips64/lithium-codegen-mips64.h" | 9 #include "src/mips64/lithium-codegen-mips64.h" |
10 #include "src/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/mips64/lithium-gap-resolver-mips64.h" |
(...skipping 3021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3032 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3032 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
3033 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3033 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3034 } | 3034 } |
3035 | 3035 |
3036 | 3036 |
3037 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3037 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
3038 Register scratch = scratch0(); | 3038 Register scratch = scratch0(); |
3039 Register function = ToRegister(instr->function()); | 3039 Register function = ToRegister(instr->function()); |
3040 Register result = ToRegister(instr->result()); | 3040 Register result = ToRegister(instr->result()); |
3041 | 3041 |
3042 // Check that the function really is a function. Load map into the | |
3043 // result register. | |
3044 __ GetObjectType(function, result, scratch); | |
3045 DeoptimizeIf(ne, instr->environment(), scratch, Operand(JS_FUNCTION_TYPE)); | |
3046 | |
3047 // Make sure that the function has an instance prototype. | |
3048 Label non_instance; | |
3049 __ lbu(scratch, FieldMemOperand(result, Map::kBitFieldOffset)); | |
3050 __ And(scratch, scratch, Operand(1 << Map::kHasNonInstancePrototype)); | |
3051 __ Branch(&non_instance, ne, scratch, Operand(zero_reg)); | |
3052 | |
3053 // Get the prototype or initial map from the function. | 3042 // Get the prototype or initial map from the function. |
3054 __ ld(result, | 3043 __ ld(result, |
3055 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3044 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
3056 | 3045 |
3057 // Check that the function has a prototype or an initial map. | 3046 // Check that the function has a prototype or an initial map. |
3058 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 3047 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
3059 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); | 3048 DeoptimizeIf(eq, instr->environment(), result, Operand(at)); |
3060 | 3049 |
3061 // If the function does not have an initial map, we're done. | 3050 // If the function does not have an initial map, we're done. |
3062 Label done; | 3051 Label done; |
3063 __ GetObjectType(result, scratch, scratch); | 3052 __ GetObjectType(result, scratch, scratch); |
3064 __ Branch(&done, ne, scratch, Operand(MAP_TYPE)); | 3053 __ Branch(&done, ne, scratch, Operand(MAP_TYPE)); |
3065 | 3054 |
3066 // Get the prototype from the initial map. | 3055 // Get the prototype from the initial map. |
3067 __ ld(result, FieldMemOperand(result, Map::kPrototypeOffset)); | 3056 __ ld(result, FieldMemOperand(result, Map::kPrototypeOffset)); |
3068 __ Branch(&done); | |
3069 | |
3070 // Non-instance prototype: Fetch prototype from constructor field | |
3071 // in initial map. | |
3072 __ bind(&non_instance); | |
3073 __ ld(result, FieldMemOperand(result, Map::kConstructorOffset)); | |
3074 | 3057 |
3075 // All done. | 3058 // All done. |
3076 __ bind(&done); | 3059 __ bind(&done); |
3077 } | 3060 } |
3078 | 3061 |
3079 | 3062 |
3080 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3063 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
3081 Register result = ToRegister(instr->result()); | 3064 Register result = ToRegister(instr->result()); |
3082 __ LoadRoot(result, instr->index()); | 3065 __ LoadRoot(result, instr->index()); |
3083 } | 3066 } |
(...skipping 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5950 __ li(at, scope_info); | 5933 __ li(at, scope_info); |
5951 __ Push(at, ToRegister(instr->function())); | 5934 __ Push(at, ToRegister(instr->function())); |
5952 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5935 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5953 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5936 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5954 } | 5937 } |
5955 | 5938 |
5956 | 5939 |
5957 #undef __ | 5940 #undef __ |
5958 | 5941 |
5959 } } // namespace v8::internal | 5942 } } // namespace v8::internal |
OLD | NEW |