| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 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 3000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 } | 3011 } |
| 3012 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); | 3012 Handle<Code> ic = LoadIC::initialize_stub(isolate(), NOT_CONTEXTUAL); |
| 3013 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3013 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3014 } | 3014 } |
| 3015 | 3015 |
| 3016 | 3016 |
| 3017 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 3017 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
| 3018 Register function = ToRegister(instr->function()); | 3018 Register function = ToRegister(instr->function()); |
| 3019 Register result = ToRegister(instr->result()); | 3019 Register result = ToRegister(instr->result()); |
| 3020 | 3020 |
| 3021 // Check that the function really is a function. | |
| 3022 __ CmpObjectType(function, JS_FUNCTION_TYPE, result); | |
| 3023 DeoptimizeIf(not_equal, instr->environment()); | |
| 3024 | |
| 3025 // Check whether the function has an instance prototype. | |
| 3026 Label non_instance; | |
| 3027 __ testb(FieldOperand(result, Map::kBitFieldOffset), | |
| 3028 Immediate(1 << Map::kHasNonInstancePrototype)); | |
| 3029 __ j(not_zero, &non_instance, Label::kNear); | |
| 3030 | |
| 3031 // Get the prototype or initial map from the function. | 3021 // Get the prototype or initial map from the function. |
| 3032 __ movp(result, | 3022 __ movp(result, |
| 3033 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 3023 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
| 3034 | 3024 |
| 3035 // Check that the function has a prototype or an initial map. | 3025 // Check that the function has a prototype or an initial map. |
| 3036 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 3026 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
| 3037 DeoptimizeIf(equal, instr->environment()); | 3027 DeoptimizeIf(equal, instr->environment()); |
| 3038 | 3028 |
| 3039 // If the function does not have an initial map, we're done. | 3029 // If the function does not have an initial map, we're done. |
| 3040 Label done; | 3030 Label done; |
| 3041 __ CmpObjectType(result, MAP_TYPE, kScratchRegister); | 3031 __ CmpObjectType(result, MAP_TYPE, kScratchRegister); |
| 3042 __ j(not_equal, &done, Label::kNear); | 3032 __ j(not_equal, &done, Label::kNear); |
| 3043 | 3033 |
| 3044 // Get the prototype from the initial map. | 3034 // Get the prototype from the initial map. |
| 3045 __ movp(result, FieldOperand(result, Map::kPrototypeOffset)); | 3035 __ movp(result, FieldOperand(result, Map::kPrototypeOffset)); |
| 3046 __ jmp(&done, Label::kNear); | |
| 3047 | |
| 3048 // Non-instance prototype: Fetch prototype from constructor field | |
| 3049 // in the function's map. | |
| 3050 __ bind(&non_instance); | |
| 3051 __ movp(result, FieldOperand(result, Map::kConstructorOffset)); | |
| 3052 | 3036 |
| 3053 // All done. | 3037 // All done. |
| 3054 __ bind(&done); | 3038 __ bind(&done); |
| 3055 } | 3039 } |
| 3056 | 3040 |
| 3057 | 3041 |
| 3058 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { | 3042 void LCodeGen::DoLoadRoot(LLoadRoot* instr) { |
| 3059 Register result = ToRegister(instr->result()); | 3043 Register result = ToRegister(instr->result()); |
| 3060 __ LoadRoot(result, instr->index()); | 3044 __ LoadRoot(result, instr->index()); |
| 3061 } | 3045 } |
| (...skipping 2798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5860 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5844 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5861 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5845 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5862 } | 5846 } |
| 5863 | 5847 |
| 5864 | 5848 |
| 5865 #undef __ | 5849 #undef __ |
| 5866 | 5850 |
| 5867 } } // namespace v8::internal | 5851 } } // namespace v8::internal |
| 5868 | 5852 |
| 5869 #endif // V8_TARGET_ARCH_X64 | 5853 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |